blob: 2ce413348db18bafa75a9d25f72cc174831ef42e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# keep gid same with upstream
%global mockgid 135
Name: mock-core-configs
Version: 31.6
Release: 1
Summary: Mock core config files basic chroots
License: GPLv2+
URL: https://github.com/rpm-software-management/mock/
# Source is created by
# git clone https://github.com/rpm-software-management/mock.git
# cd mock/mock-core-configs
# git reset --hard %%{name}-%%{version}-%%{release}
# tito build --tgz
Source: https://github.com/rpm-software-management/mock/releases/download/%{name}-%{version}-1/%{name}-%{version}.tar.gz
BuildArch: noarch
# distribution-gpg-keys contains GPG keys used by mock configs
Requires: distribution-gpg-keys >= 1.29
Requires(post): coreutils
Requires(post): python3-dnf
Requires(post): python3-hawkey
Requires(post): system-release
Requires(post): python3
Requires(post): sed
Requires(pre): shadow-utils
%description
Config files which allow you to create chroots for:
* Fedora
* Epel
* Mageia
* Custom chroot
* OpenSuse Tumbleweed and Leap
* openEuler
%prep
%setup -q
%build
# nothing to do here
%install
mkdir -p %{buildroot}%{_sysusersdir}
mkdir -p %{buildroot}%{_sysconfdir}/mock/eol
mkdir -p %{buildroot}%{_sysconfdir}/mock/templates
cp -a etc/mock/*.cfg %{buildroot}%{_sysconfdir}/mock
cp -a etc/mock/templates/*.tpl %{buildroot}%{_sysconfdir}/mock/templates
cp -a etc/mock/eol/*cfg %{buildroot}%{_sysconfdir}/mock/eol
# generate files section with config - there is many of them
echo "%defattr(0644, root, mock)" > %{name}.cfgs
find %{buildroot}%{_sysconfdir}/mock -name "*.cfg" -o -name '*.tpl' \
| sed -e "s|^%{buildroot}|%%config(noreplace) |" >> %{name}.cfgs
# bash-completion
if [ -d %{buildroot}%{_datadir}/bash-completion ]; then
echo %{_datadir}/bash-completion/completions/mock >> %{name}.cfgs
echo %{_datadir}/bash-completion/completions/mockchain >> %{name}.cfgs
elif [ -d %{buildroot}%{_sysconfdir}/bash_completion.d ]; then
echo %{_sysconfdir}/bash_completion.d/mock >> %{name}.cfgs
fi
%pre
# check for existence of mock group, create it if not found
getent group mock > /dev/null || groupadd -f -g %mockgid -r mock
exit 0
%post
# get release ver such as: 22.03
ver=$(source /etc/os-release && echo $VERSION_ID)
mock_arch=$(python3 -c "import dnf.rpm; import hawkey; print(dnf.rpm.basearch(hawkey.detect_arch()))")
cfg=openeuler-$ver-${mock_arch}.cfg
if [ -e %{_sysconfdir}/mock/$cfg ]; then
if [ "$(readlink %{_sysconfdir}/mock/default.cfg)" != "$cfg" ]; then
ln -s $cfg %{_sysconfdir}/mock/default.cfg 2>/dev/null || ln -s -f $cfg %{_sysconfdir}/mock/default.cfg.rpmnew
fi
else
echo "Warning: file %{_sysconfdir}/mock/$cfg does not exist."
echo " unable to update %{_sysconfdir}/mock/default.cfg"
fi
:
%files -f %{name}.cfgs
%license COPYING
%dir %{_sysconfdir}/mock
%dir %{_sysconfdir}/mock/eol
%dir %{_sysconfdir}/mock/templates
%ghost %config(noreplace,missingok) %{_sysconfdir}/mock/default.cfg
%changelog
* Fri May 19 2023 lichaoran <pkwarcraft@hotmail.com> 36.1-1
- Init package
|