76fd650
# next four lines substituted by autoconf
78b6aeb
%global major 1
78b6aeb
%global minor 2
fdd6c7b
%global sub 17
78b6aeb
%global extralevel %{nil}
78b6aeb
%global release_version %{major}.%{minor}.%{sub}%{extralevel}
293fded
78b6aeb
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
293fded
af65557
%if 0%{?fedora} > 21
af65557
%global use_python3 1
af65557
%global use_python2 0
af65557
%else
af65557
%global use_python3 0
af65557
%global use_python2 1
af65557
%endif
af65557
af65557
%if %{use_python3}
af65557
%global python_sitelib %{python3_sitelib}
af65557
%else
af65557
%global python_sitelib %{python_sitelib}
af65557
%endif
af65557
fbf2e29
# mock group id allocate for Fedora
fbf2e29
%global mockgid  135
fbf2e29
Seth Vidal 32b2475
Summary: Builds packages inside chroots
Seth Vidal 32b2475
Name: mock
293fded
Version: %{release_version}
78b6aeb
Release: 1%{?dist}
3ea2d8b
License: GPLv2+
6219f59
Source: https://git.fedorahosted.org/cgit/mock.git/snapshot/%{name}-%{version}.tar.xz
16328cd
URL: https://fedoraproject.org/wiki/Mock
2770ef6
BuildArch: noarch
0668632
%if 0%{?fedora} > 21
5e91867
Requires: yum >= 3.4.3-505
0668632
%else
c81e926
Requires: yum >= 2.4
0668632
%endif
c81e926
Requires: tar
c81e926
Requires: pigz
c81e926
Requires: usermode
9e2a08e
Requires: yum-utils
c280da3
Requires: createrepo_c
36e0617
%if 0%{?use_python2}
c280da3
Requires: pyliblzma
36e0617
%endif
699daea
%if 0%{?rhel} != 6 && 0%{?fedora} > 0 && 0%{?fedora} < 24
c81e926
Requires: systemd
c81e926
%endif
fdd6c7b
%if 0%{?fedora} > 23
699daea
Requires: systemd-container
699daea
%endif
Seth Vidal 32b2475
Requires(pre): shadow-utils
23f9673
Requires(post): coreutils
af65557
BuildRequires: autoconf, automake
6219f59
%if 0%{?fedora} || 0%{?rhel} > 6
6219f59
BuildRequires: bash-completion
6219f59
%endif
af65557
%if %{use_python3}
af65557
Requires: python3
af65557
Requires: python3-six
af65557
Requires: python3-requests
af65557
Requires: rpm-python3
af65557
BuildRequires: python3-devel
af65557
%else
af65557
Requires: python-ctypes
af65557
Requires: python-six
af65557
Requires: python-requests
af65557
Requires: python >= 2.6
af65557
BuildRequires: python-devel
af65557
%endif
699daea
%if 0%{?fedora}
7ed7574
Recommends: dnf
7ed7574
Recommends: dnf-plugins-core
0668632
Recommends: btrfs-progs
0668632
%endif
9a6484d
%if 0%{?rhel} >= 7
0668632
Requires: btrfs-progs
0668632
%endif
0668632
Seth Vidal 32b2475
Seth Vidal 32b2475
%description
c280da3
Mock takes an SRPM and builds it in a chroot.
Seth Vidal 32b2475
fbf2e29
%package scm
fbf2e29
Summary: Mock SCM integration module
c81e926
Requires: %{name} = %{version}-%{release}
c81e926
Requires: cvs
c81e926
Requires: git
c81e926
Requires: subversion
c81e926
Requires: tar
fbf2e29
fbf2e29
%description scm
c280da3
Mock SCM integration module.
fbf2e29
c81e926
%package lvm
c81e926
Summary: LVM plugin for mock
c81e926
Requires: %{name} = %{version}-%{release}
c81e926
Requires: lvm2
c81e926
c81e926
%description lvm
c81e926
Mock plugin that enables using LVM as a backend and support creating snapshots
c81e926
of the buildroot.
c81e926
Seth Vidal 32b2475
%prep
Seth Vidal 32b2475
%setup -q
c81e926
%if 0%{?rhel} == 6
b1d5982
sed -i "s|^USE_NSPAWN = True|USE_NSPAWN = False|" py/mockbuild/util.py
c81e926
%endif
af65557
%if %{use_python3}
af65557
sed -i 's/AM_PATH_PYTHON/AM_PATH_PYTHON([3])/' configure.ac
af65557
for file in py/mock.py py/mockchain.py; do
af65557
  sed -i 1"s|#!/usr/bin/python |#!/usr/bin/python3 |" $file
af65557
done
af65557
%endif
e087a33
Seth Vidal 32b2475
%build
6813eac
autoreconf -vif
293fded
%configure
293fded
make
Seth Vidal 32b2475
Seth Vidal 32b2475
%install
Seth Vidal 32b2475
rm -rf $RPM_BUILD_ROOT
Seth Vidal 32b2475
make DESTDIR=$RPM_BUILD_ROOT install
293fded
mkdir -p $RPM_BUILD_ROOT/var/lib/mock
a2383be
mkdir -p $RPM_BUILD_ROOT/var/cache/mock
49927b8
ln -s consolehelper $RPM_BUILD_ROOT/usr/bin/mock
Seth Vidal 32b2475
a658f51
echo "%defattr(0644, root, mock)" > %{name}.cfgs
23f9673
find $RPM_BUILD_ROOT%{_sysconfdir}/mock -name "*.cfg" \
a658f51
    | sed -e "s|^$RPM_BUILD_ROOT|%%config(noreplace) |" >> %{name}.cfgs
a658f51
23f9673
# just for %%ghosting purposes
23f9673
ln -s fedora-rawhide-x86_64.cfg $RPM_BUILD_ROOT%{_sysconfdir}/mock/default.cfg
5561ec2
6219f59
if [ -d $RPM_BUILD_ROOT%{_datadir}/bash-completion ]; then
6219f59
    echo %{_datadir}/bash-completion/completions/mock >> %{name}.cfgs
6219f59
    echo %{_datadir}/bash-completion/completions/mockchain >> %{name}.cfgs
6219f59
elif [ -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d ]; then
6219f59
    echo %{_sysconfdir}/bash_completion.d/mock >> %{name}.cfgs
6219f59
fi
6219f59
f3eaee2
%if 0%{?rhel} == 6
f3eaee2
    # can be removed when yum-utils >= 1.1.31 lands in el6
f3eaee2
    echo "config_opts['plugin_conf']['package_state_enable'] = False" >> $RPM_BUILD_ROOT%{_sysconfdir}/mock/site-defaults.cfg
9a6484d
    echo "config_opts['use_nspawn'] = False" >> $RPM_BUILD_ROOT%{_sysconfdir}/mock/site-defaults.cfg
f3eaee2
%endif
Seth Vidal 32b2475
%pre
fbf2e29
fbf2e29
# check for existence of mock group, create it if not found
9f2fec5
getent group mock > /dev/null || groupadd -f -g %mockgid -r mock
fbf2e29
exit 0
Seth Vidal 32b2475
23f9673
%post
fbf2e29
fbf2e29
# fix cache permissions from old installs
c81e926
chmod 2775 %{_localstatedir}/cache/%{name}
c81e926
b1d5982
if [ -s /etc/os-release ]; then
af65557
    # fedora and rhel7
af65557
    if grep -Fq Rawhide /etc/os-release; then
af65557
        ver=rawhide
c280da3
    else
af65557
        ver=$(source /etc/os-release && echo $VERSION_ID | cut -d. -f1 | grep -o '[0-9]\+')
c280da3
    fi
af65557
else
af65557
    # rhel6 or something obsure, use buildtime version
af65557
    ver=%{?rhel}%{?fedora}
af65557
fi
af65557
mock_arch=$(python -c "import rpmUtils.arch; baseArch = rpmUtils.arch.getBaseArch(); print baseArch")
af65557
cfg=%{?fedora:fedora}%{?rhel:epel}-$ver-${mock_arch}.cfg
af65557
[ -e %{_sysconfdir}/%{name}/$cfg ] || exit -2
af65557
if [ "$(readlink %{_sysconfdir}/%{name}/default.cfg)" != "$cfg" ]; then
af65557
  ln -s $cfg %{_sysconfdir}/%{name}/default.cfg 2>/dev/null || ln -s -f $cfg %{_sysconfdir}/%{name}/default.cfg.rpmnew
c81e926
fi
23f9673
:
23f9673
23f9673
%files -f %{name}.cfgs
Seth Vidal 32b2475
%defattr(-, root, root)
49927b8
49927b8
# executables
49927b8
%{_bindir}/mock
cd46534
%{_bindir}/mockchain
5561ec2
%attr(0755, root, root) %{_sbindir}/mock
293fded
293fded
# python stuff
293fded
%{python_sitelib}/*
fbf2e29
%exclude %{python_sitelib}/mockbuild/scm.*
c81e926
%exclude %{python_sitelib}/mockbuild/plugins/lvm_root.*
293fded
293fded
# config files
Seth Vidal 32b2475
%dir  %{_sysconfdir}/%{name}
23f9673
%ghost %config(noreplace,missingok) %{_sysconfdir}/%{name}/default.cfg
293fded
%config(noreplace) %{_sysconfdir}/%{name}/*.ini
49927b8
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
49927b8
%config(noreplace) %{_sysconfdir}/security/console.apps/%{name}
293fded
f3eaee2
# gpg keys
f3eaee2
%dir %{_sysconfdir}/pki/mock
f3eaee2
%config(noreplace) %{_sysconfdir}/pki/mock/*
f3eaee2
49927b8
# docs
ef5fe3f
%{_mandir}/man1/mock.1*
cd46534
%{_mandir}/man1/mockchain.1*
09bef10
%doc ChangeLog
49927b8
35d5baa
# cache & build dirs
35d5baa
%defattr(0775, root, mock, 02775)
c81e926
%dir %{_localstatedir}/cache/mock
c81e926
%dir %{_localstatedir}/lib/mock
fbf2e29
fbf2e29
%files scm
fbf2e29
%{python_sitelib}/mockbuild/scm.py*
dcfea83
c81e926
%files lvm
c81e926
%{python_sitelib}/mockbuild/plugins/lvm_root.*
94ee71d
c81e926
%changelog
699daea
* Tue Mar  8 2016 Miroslav Suchý <msuchy@redhat.com> - 1.2.16-1
699daea
- remove old %if statements
699daea
- systemd-nspawn is now in systemd-container package
699daea
- become root user correct way [RHBZ#1312820][RHBZ#1311796]
699daea
- remove the sparc config
699daea
- Let logging format messages on demand
699daea
- tell nspawn which variables it should set [RHBZ#1311796]
699daea
- do not call /bin/su and rather utilize --user of systemd-nspawn [RHBZ#1301953]
699daea
78b6aeb
* Mon Feb 22 2016 Miroslav Suchý <msuchy@redhat.com> - 1.2.15-1
78b6aeb
- ccache plugin disabled by default
78b6aeb
- F21 configs removed
78b6aeb
- F24 configs added
78b6aeb
- typo fixed [RHBZ#1285630]
78b6aeb
- read user config from ~/.config/mock.cfg too
78b6aeb
- disable "local" dnf plugin [RHBZ#1264215]
78b6aeb
- when removing buildroot, do that as root [RHBZ#1294979]
9dcce51
b6c7481
* Fri Nov 20 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.14-1
b6c7481
- after unpacking chroot, change back to $CWD [RHBZ#1281369]
b6c7481
- Fix package manager version handling for CentOS
b6c7481
- use --setopt=deltarpm=false as default value for dnf_common_opts [RHBZ#1281355]
b6c7481
- add arguments, do not over ride previous ones
fdd6c7b
- Add %%(resultdir) placeholder for sign plugin. [RHBZ#1272123]
b6c7481
- decode shell output when running under Python3 [RHBZ#1267161]
b6c7481
- create tmpfs with unlimited inodes [RHBZ#1266453]
b6c7481
- typo [RHBZ#1241827]
b6c7481
- do not use machinectl --no-legend as it is not el7 compatible [RHBZ#1241827]
b6c7481
- directly tell yum which yum.conf he should use [RHBZ#1264462]
d2acf13
16328cd
* Wed Sep 16 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.13-1
16328cd
- Use 'machinectl terminate' inside orphanskill() when systemd-nspawn used [RHBZ#1171737]
16328cd
- use quite systemd-nspawn in quite mode [RHBZ#1262889]
16328cd
- when calling systemd-nspawn become root first [RHBZ#1241827]
16328cd
- revert F23 configs back to yum
16328cd
- Give user hint what to do if he miss scm plugin.
16328cd
- when cleaning up /dev/ do not fail on mountpoins
16328cd
- warn (but not fail) on RHELs when you try to use DNF
16328cd
- migrate package_state to use dnf when package_manager is set to dnf
16328cd
- redownload metadata if they changed on server [RHBZ#1230508]
16328cd
- provide --scrub=dnf-cache as alias for yum-cache [RHBZ#1241296]
16328cd
- copy files to correct location [RHBZ#1252088]
16328cd
- do not install weak deps in chroot [RHBZ#1254634]
16328cd
- Try to set PTY window size [RHBZ#1155199]
16328cd
- Set default LVM pool name [RHBZ#1163008]
16328cd
- better parsing of content-disposition header [RHBZ#1248344]
16328cd
- backend: Ensure output files are owned by unpriv user with nspawn
16328cd
- Add "rpmbuild_networking" key (False by default) for nspawn backend
16328cd
- fdfd464 Update Fedora Wiki URLs
16328cd
- use yum-deprecated as the yum_command if it exists
16328cd
5e91867
* Tue Jul 14 2015 clark Williams <williams@redhat.com> - 1.2.12-1
5e91867
- from Dennis Gilmore <dennis@ausil.us>:
5e91867
  - setup support so loopback devices can work [RHBZ#1245401]
5e91867
- from Miroslav Suchý <msuchy@redhat.com>:
5e91867
  - clarify path [RHBZ#1228751]
5e91867
  - document target_arch and legal_host_arches in site-defaults.cfg [RHBZ#1228751]
5e91867
  - document "yum.conf" in site-defaults.cfg [RHBZ#1228751]
5e91867
  - correctly specify requires of yum [RHBZ#1244475]
5e91867
  - bump up releasever in rawhide targets
5e91867
  - remove EOLed gpg keys
5e91867
  - add f23 configs
5e91867
  - removing EOLed f19 and f20 configs
5e91867
9a6484d
* Tue Jul 14 2015 clark Williams <williams@redhat.com> - 1.2.11-1
9a6484d
- dropped code that does stray mount cleanup of chroot [RHBZ#1208092]
9a6484d
- modified package_manager resolvedep cmd to use repoquery when dnf is installed
c01b7dc
36e0617
* Tue Jun  2 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.10-1
36e0617
- do not require pyliblzma if using python3 [RHBZ#1227209]
36e0617
- add warning to site-defaults.cfg that assumeyes=1 is important [RHBZ#1225004]
36e0617
- sync comments in site-defaults.cfg with code [RHBZ#1224961]
36e0617
- check for dangling link of /etc/mtab [RHBZ#1224732]
36e0617
- Fix --install filename completion
36e0617
0f02041
* Wed May 13 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.9-1
0f02041
- scm: do not keep copy of environ, this is now handled by uidmanager [RHBZ#1204395]
0f02041
- Add pm_request plugin
0f02041
- Drop lvm2-python-libs requires and enable lvm subpackage on el6
0f02041
- Use lvs instead of lvm python bindings
0f02041
- Unshare IPC ns only for chroot processes
0f02041
- Add missing flush in logOutput
0f02041
- Avoid infinite recursion in selinux plugin
0f02041
0668632
* Wed Apr 29 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.8-1
0668632
- LVM plugin is removed on F22+ due RHBZ 1136366
0668632
- allow the chroot's location to be configurable [RHBZ#452730]
0668632
- send output of --chroot to log [RHBZ#1214178]
0668632
- chroot_scan: implement "only_failed" option [RHBZ#1190763]
0668632
- add comment why this previous commit was done [RHBZ#1192128]
0668632
- use rpm macros instead of cmd option for --nocheck [RHBZ#1192128]
0668632
- plugin options can be string if specified on command line [RHBZ#1193487]
0668632
- root_cache: do not assume volatile root with tmpfs [RHBZ#1193487]
0668632
- use CONFIG instead of CHROOT in help/man for --root option [RHBZ#1197131]
0668632
- more clarification on --dnf-cmd/--yum-cmd [RHBZ#1211621]
0668632
- scm correct the logic of exclude_vcs [RHBZ#1204240]
0668632
- ignore missing files in ccache [RHBZ#1210569]
0668632
- install buildsys-macros in el5 chroot [RHBZ#1213482]
0668632
- remove forgotten print statement [RHBZ#1202845]
0668632
- add a plugin that calls command (from the host) on the produced rpms.
0668632
- save/restore os.environ when dropping/restoring Privs [RHBZ#1204395]
0668632
- mock-scm pull tarball name from specfile instead of hardcoding [RHBZ#1204935]
0668632
- clarify "--yum-cmd" / "--dnf-cmd" options [RHBZ#1211621]
0668632
- return the SRPM name from do_buildsrpm (required for SCM builds) [1190450]
0668632
- binding DNF cache directory with yum_cache [RHBZ#1176560]
0668632
- suggest user to install dnf-plugins-core [RHBZ#1196248]
0668632
- ignore btrfs errors on non-btrfs systems [RHBZ#1205564]
0668632
- on F21- use hard deps instead of soft [RHBZ#1198769]
0668632
- delete btrfs subvolumes on exit [RHBZ#1205564]
0668632
- on python3 convert err from bytes to str [RHBZ#1211199]
0668632
- on F22+ use yum-deprecated instead of yum [RHBZ#1211978]
0668632
- if mountpoint is inside chroot, remove chroot part [RHBZ#1208299]
0668632
- chmod directory only if we really created it [RHBZ#1209532]
0668632
- port epel-5 configs to Python 3 [RHBZ#1204662]
0668632
- use nosync only for package management and chroot init [RHBZ#1184964]
0668632
- missing config file should not be fatal [RHBZ#1195749]
0668632
- pass variable "name" [RHBZ#1194171]
0668632
- correct chroot_scan configuration sample in site-defaults
0668632
- install missing chroot_scan plugin
0668632
- avoid creating resultdir as root
0668632
0668632
7ed7574
* Fri Feb 13 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.7-1
7ed7574
- add Fedora 22 configs
7ed7574
- rawhide configs use DNF
7ed7574
- touch should not truncate file [RHBZ#1188770]
7ed7574
08bdeba
* Mon Feb  2 2015 Clark Williams <williams@redhat.com> - 1.2.6-1
08bdeba
- fix broken build issue
08bdeba
- From Mikhail Campos Guadamuz <Mikhail_Campos-Guadamuz@epam.com>:
08bdeba
  - use default logging.ini if non-default does not exist [RHBZ#1187727]
08bdeba
- From Michael Simacek <msimacek@redhat.com>:
08bdeba
  - Update manpage regarding multiple arguments
08bdeba
  - Take package arguments in update [RHBZ#1187136]
08bdeba
- From Miroslav Suchý <msuchy@redhat.com>:
08bdeba
  - reset LC before calling lvm commands [RHBZ#1185912]
08bdeba
b1d5982
* Fri Jan 23 2015 Clark Williams <williams@redhat.com> - 1.2.5-1
b1d5982
- mounts: do not mount /dev/shm or /dev/pts if internal setup false
b1d5982
- actually package compress_logs plugin
b1d5982
- use relative imports
b1d5982
- touch /etc/os-release after install @buildsys-build [RHBZ#1183454]
b1d5982
- parse /etc/os-release only if it exists and size is non-zero [RHBZ#1183454]
b1d5982
25cbeb9
* Fri Jan 16 2015 Miroslav Suchý <msuchy@redhat.com> - 1.2.4-1
25cbeb9
- each user have its own ccache cache [RHBZ#1168116]
25cbeb9
- man: write example for --chroot option
25cbeb9
- sort options in man page
25cbeb9
- sort command in man page
25cbeb9
- add Fedora 22 GPG keys
25cbeb9
- improve --resultdir part of man page [RHBZ#1181554]
25cbeb9
- allow the subsitution of resultdir into the yum.conf block [RHBZ#1125376]
25cbeb9
- do no print duplicities in bash completion
25cbeb9
- Fixed systemd-nspawn machine name collision [RHBZ#1174286]
25cbeb9
- do shell expansion on  --new-chroot --chroot [RHBZ#1174317]
25cbeb9
- log executing command after nspawn expansion
25cbeb9
- make sure that mockchain generate unique repoid for all repos [RHBZ#1179806]
25cbeb9
- workaround old python-six in EL7
25cbeb9
- Remove checking for chroot existence in --chroot
25cbeb9
- Exclude .bash_history and .bashrc from builddir cleanup
25cbeb9
- Ignore broken symlinks in chown_home_dir
25cbeb9
- create SCM files as non-privileg user [RHBZ#1178576]
25cbeb9
- With --no-clean, delete /builddir except build/SOURCES [RHBZ#1173126]
25cbeb9
- Man page formatting improvements
25cbeb9
- Move the pool size check to later time when pool already exists
25cbeb9
- Always use returnOutput in lvm plugin to get possible error output
25cbeb9
- put correct version in man page
25cbeb9
- Fix unicode characters in logs on Python 2 [RHBZ#1171707]
25cbeb9
- Added new option 'postinstall' [RHBZ#1168911]
25cbeb9
- Use keepcache=1 in yum.conf [RHBZ#1169126]
25cbeb9
- Warn user when LVM thin pool is filled up [RHBZ#1167761]
25cbeb9
- add missing max_metadata_age_days do site-defaults.cfg
25cbeb9
- add age_check to site-default.cfg
25cbeb9
- compress also logs created by package_state plugin
25cbeb9
d2faac0
* Thu Dec  4 2014 Miroslav Suchý <msuchy@redhat.com> - 1.2.3-1
d2faac0
- fixed incorrect command construction in PackageManager:build_invocation [RHBZ#1170230]
d2faac0
- completion: correctly expand --install [RHBZ#1168220]
d2faac0
- copyin: when source is directory, then handle corner cases [RHBZ#1169051]
d2faac0
- increase default for tmpfs to 768
d2faac0
- check if key exist [RHBZ#476837]
d2faac0
- Added tmpfs new option 'keep_mounted' [RHBZ#476837]
d2faac0
- add 2 common tmpfs dirs to find_non_nfs_dir()
d2faac0
- Added new option --symlink-dereference used with --buildsrpm [BZ# 1165242]
d2faac0
- accept None as macro value in config [RHBZ#1165778]
d2faac0
- Don't do yum update when --no-clean specified [RHBZ#1165716]
d2faac0
- do not delete /buildir when --no-clean was set [RHBZ#483486]
d2faac0
- bash completation for --copyin and --sources
d2faac0
- bash_completion.d/mock: fix syntax error
d2faac0
- Correct check for --source cmd option, single file can be used [RHBZ#1165213]
d2faac0
- update BUGS part of man page
d2faac0
- add missing options to man page