156 lines
4.5 KiB
RPMSpec
156 lines
4.5 KiB
RPMSpec
%global use_python3 1
|
|
%global use_python2 0
|
|
%global __python %{__python3}
|
|
%global python_sitelib %{python3_sitelib}
|
|
|
|
Summary: Builds packages inside chroots
|
|
Name: mock
|
|
Version: 2.2
|
|
Release: 2
|
|
License: GPLv2+
|
|
Source: https://github.com/rpm-software-management/mock/releases/download/mock-2.2-1/%{name}-%{version}.tar.gz
|
|
URL: https://github.com/rpm-software-management/mock/
|
|
Source1: mock_config.default
|
|
BuildArch: noarch
|
|
BuildRequires: bash-completion
|
|
BuildRequires: perl-interpreter
|
|
%if %{use_python3}
|
|
Requires: python3-distro
|
|
Requires: python3-jinja2
|
|
Requires: python3-six >= 1.4.0
|
|
Requires: python3-requests
|
|
Requires: python3-rpm
|
|
Requires: python3-pyroute2
|
|
BuildRequires: python3-devel
|
|
%endif
|
|
|
|
|
|
Requires: tar
|
|
Requires: pigz
|
|
Requires: usermode
|
|
Requires: createrepo_c
|
|
Requires: systemd
|
|
Requires: systemd-container
|
|
Requires: coreutils
|
|
Requires: util-linux
|
|
Requires: coreutils
|
|
Requires: procps-ng
|
|
Requires: dnf
|
|
Requires: dnf-plugins-core
|
|
|
|
|
|
%description
|
|
Mock takes an SRPM and builds it in a chroot.
|
|
|
|
%package plugins
|
|
Summary: Mock plugins integration module
|
|
Requires: %{name} = %{version}-%{release}
|
|
Requires: lvm2
|
|
Recommends: cvs git subversion tar
|
|
|
|
%description plugins
|
|
Mock plugins integration module.
|
|
|
|
%prep
|
|
%setup -q
|
|
for file in py/mock.py py/mock-parse-buildlog.py; do
|
|
sed -i 1"s|#!/usr/bin/python3 |#!%{__python} |" $file
|
|
done
|
|
|
|
%build
|
|
for i in py/mock.py py/mock-parse-buildlog.py; do
|
|
perl -p -i -e 's|^__VERSION__\s*=.*|__VERSION__="%{version}"|' $i
|
|
perl -p -i -e 's|^SYSCONFDIR\s*=.*|SYSCONFDIR="%{_sysconfdir}"|' $i
|
|
perl -p -i -e 's|^PYTHONDIR\s*=.*|PYTHONDIR="%{python_sitelib}"|' $i
|
|
perl -p -i -e 's|^PKGPYTHONDIR\s*=.*|PKGPYTHONDIR="%{python_sitelib}/mockbuild"|' $i
|
|
done
|
|
for i in docs/mock.1 docs/mock-parse-buildlog.1; do
|
|
perl -p -i -e 's|\@VERSION\@|%{version}"|' $i
|
|
done
|
|
|
|
%install
|
|
install -d %{buildroot}%{_bindir}
|
|
install -d %{buildroot}%{_libexecdir}/mock
|
|
install mockchain %{buildroot}%{_bindir}/mockchain
|
|
install py/mock-parse-buildlog.py %{buildroot}%{_bindir}/mock-parse-buildlog
|
|
install py/mock.py %{buildroot}%{_libexecdir}/mock/mock
|
|
ln -s consolehelper %{buildroot}%{_bindir}/mock
|
|
install create_default_route_in_container.sh %{buildroot}%{_libexecdir}/mock/
|
|
|
|
install -d %{buildroot}%{_sysconfdir}/pam.d
|
|
cp -a etc/pam/* %{buildroot}%{_sysconfdir}/pam.d/
|
|
|
|
install -d %{buildroot}%{_sysconfdir}/mock
|
|
cp -a etc/mock/* %{buildroot}%{_sysconfdir}/mock/
|
|
|
|
install -d %{buildroot}%{_sysconfdir}/security/console.apps/
|
|
cp -a etc/consolehelper/mock %{buildroot}%{_sysconfdir}/security/console.apps/%{name}
|
|
|
|
install -d %{buildroot}%{_datadir}/bash-completion/completions/
|
|
cp -a etc/bash_completion.d/* %{buildroot}%{_datadir}/bash-completion/completions/
|
|
ln -s mock %{buildroot}%{_datadir}/bash-completion/completions/mock-parse-buildlog
|
|
|
|
install -d %{buildroot}%{_sysconfdir}/pki/mock
|
|
cp -a etc/pki/* %{buildroot}%{_sysconfdir}/pki/mock/
|
|
|
|
install -d %{buildroot}%{python_sitelib}/
|
|
cp -a py/mockbuild %{buildroot}%{python_sitelib}/
|
|
|
|
install -d %{buildroot}%{_mandir}/man1
|
|
cp -a docs/mock.1 docs/mock-parse-buildlog.1 %{buildroot}%{_mandir}/man1/
|
|
install -d %{buildroot}%{_datadir}/cheat
|
|
cp -a docs/mock.cheat %{buildroot}%{_datadir}/cheat/mock
|
|
|
|
install -d %{buildroot}/var/lib/mock
|
|
install -d %{buildroot}/var/cache/mock
|
|
|
|
|
|
mkdir -p %{buildroot}%{_pkgdocdir}
|
|
install -p -m 0644 %{SOURCE1} %{buildroot}%{_pkgdocdir}/site-defaults.cfg
|
|
install -p -m 0644 %{SOURCE1} %{buildroot}/etc/mock/site-defaults.cfg
|
|
|
|
%check
|
|
|
|
%files
|
|
%defattr(-, root, root)
|
|
%{_bindir}/mockchain
|
|
%{_bindir}/mock
|
|
%{_bindir}/mock-parse-buildlog
|
|
|
|
%{python_sitelib}/*
|
|
%exclude %{python_sitelib}/mockbuild/scm.*
|
|
%exclude %{python_sitelib}/mockbuild/plugins/lvm_root.*
|
|
|
|
# config files
|
|
%config(noreplace) %{_sysconfdir}/%{name}/*.ini
|
|
%config(noreplace) %{_sysconfdir}/%{name}/site-defaults.cfg
|
|
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
|
|
%config(noreplace) %{_sysconfdir}/security/console.apps/%{name}
|
|
%dir %{_sysconfdir}/pki/mock
|
|
%config(noreplace) %{_sysconfdir}/pki/mock/*
|
|
|
|
%{_mandir}/man1/*
|
|
%{_datadir}/cheat/mock
|
|
%{_datadir}/bash-completion/completions/mock
|
|
%{_pkgdocdir}/site-defaults.cfg
|
|
%{_datadir}/bash-completion/completions/mock-parse-buildlog
|
|
%{_libexecdir}/mock
|
|
|
|
%dir %{_localstatedir}/cache/mock
|
|
%dir %{_localstatedir}/lib/mock
|
|
|
|
%files plugins
|
|
%{python_sitelib}/mockbuild/scm.py*
|
|
%{python_sitelib}/mockbuild/plugins/lvm_root.*
|
|
%if %{use_python3}
|
|
%{python3_sitelib}/mockbuild/__pycache__/scm.*.py*
|
|
%{python3_sitelib}/mockbuild/plugins/__pycache__/lvm_root.*.py*
|
|
%endif
|
|
|
|
%changelog
|
|
* Thu Nov 10 2022 xu_ping <xuping33@h-partners.com> 2.2-2
|
|
- fix source url
|
|
|
|
* Fri May 15 2020 hexiaowen <hexiaowen@huawei.com> 2.2-1
|
|
- first build
|