Skip to content

Commit e1aca41

Browse files
committed
[skip-ci] RPM: ensure config files are patched
This commit copies over shortnames.conf, registries.conf and storage.conf to the rpm build dir before running the patching script. Prior to this, the script would complain about not finding those files but the rpmbuild process itself didn't fail. Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com> (cherry picked from commit 06a4eef) Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
1 parent fd7af9f commit e1aca41

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

rpm/containers-common.spec

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ not required by Skopeo.
9898
%prep
9999
%autosetup -Sgit -n %{repo}-%{version_no_tilde}
100100

101-
# Fine-grain distro- and release-specific tuning of config files,
102-
# e.g., seccomp, composefs, registries on different RHEL/Fedora versions
103-
bash rpm/update-config-files.sh
104-
105-
%build
101+
# Copy manpages to docs subdir in builddir to build before installing.
106102
cp %{SOURCE1} docs/.
107103
cp %{SOURCE2} docs/.
108104
cp %{SOURCE3} docs/.
@@ -113,6 +109,18 @@ cp %{SOURCE7} docs/.
113109
cp %{SOURCE8} docs/.
114110
cp %{SOURCE9} docs/.
115111

112+
# Copy config files to builddir to patch them before installing.
113+
# Currently, only registries.conf and storage.conf files are patched before
114+
# installing.
115+
cp %{SOURCE10} shortnames.conf
116+
cp %{SOURCE13} registries.conf
117+
cp %{SOURCE14} storage.conf
118+
119+
# Fine-grain distro- and release-specific tuning of config files,
120+
# e.g., seccomp, composefs, registries on different RHEL/Fedora versions
121+
bash rpm/update-config-files.sh
122+
123+
%build
116124
mkdir -p man5
117125
for i in docs/*.5.md; do
118126
go-md2man -in $i -out man5/$(basename $i .md)
@@ -129,11 +137,11 @@ touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-images/images.lock
129137
install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers
130138
touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers/layers.lock
131139

132-
install -Dp -m0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
140+
install -Dp -m0644 shortnames.conf %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
133141
install -Dp -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml
134142
install -Dp -m0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/containers/policy.json
135-
install -Dp -m0644 %{SOURCE13} %{buildroot}%{_sysconfdir}/containers/registries.conf
136-
install -Dp -m0644 %{SOURCE14} %{buildroot}%{_datadir}/containers/storage.conf
143+
install -Dp -m0644 registries.conf %{buildroot}%{_sysconfdir}/containers/registries.conf
144+
install -Dp -m0644 storage.conf %{buildroot}%{_datadir}/containers/storage.conf
137145

138146
# RPM-GPG-KEY-redhat-release already exists on rhel envs, install only on
139147
# fedora and centos

rpm/update-config-files.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
set -exo pipefail
66

77
ensure() {
8+
if [[ ! -f $1 ]]; then
9+
echo "File not found:" $1
10+
exit 1
11+
fi
812
if grep ^$2[[:blank:]].*= $1 > /dev/null
913
then
1014
sed -i "s;^$2[[:blank:]]=.*;$2 = $3;" $1

0 commit comments

Comments
 (0)