Skip to contentSkip to conversation

tools: fix make rpmball

PATCH Superseded Olaf Hering 3 participants 6 messages May 30, 2023 – Jun 12, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: fix make rpmball

Commit 438c5ffa44e99cceb574c0f9946aacacdedd2952 ("rpmball: Adjust to new rpm, do not require --force") attempted to handle stricter directory permissions in newer distributions.

This introduced a few issues:
- /boot used to be a constant prior commit 6475d700055fa952f7671cee982a23de2f5e4a7c ("use BOOT_DIR as xen.gz install location"), since this commit the location has to be referenced via ${BOOT_DIR}
- it assumed the prefix and the various configurable paths match the glob pattern /*/*/*

Adjust the code to build a filelist on demand and filter directories from an installed filesystem.rpm.

Take the opportunity to replace the usage of $RPM_BUILD_ROOT with %buildroot, and use pushd/popd pairs.

Fixes 438c5ffa4 ("rpmball: Adjust to new rpm, do not require --force")
---
 tools/misc/mkrpm | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)
tools/misc/mkrpm +24 -9
index 74f6761bb0..a7bf854197 100644
@@ -50,20 +50,35 @@ uninstall.
 %build
 
 %install
-rm -rf \$RPM_BUILD_ROOT
-mkdir -p \$RPM_BUILD_ROOT
-cd %{_xenroot}
-dist/install.sh \$RPM_BUILD_ROOT/
+rm -rf %buildroot
+mkdir -p %buildroot
+pushd %_xenroot
+dist/install.sh %buildroot
+
+pushd %buildroot
+popd
+rm -f dist/filesystem.txt
+rm -f dist/directories.txt
+rm -f dist/files.txt
+find %buildroot -type d | sed 's|^%buildroot||' | sort > dist/directories.txt
+find %buildroot -type f | sed 's|^%buildroot||' | sort > dist/files.txt
+find %buildroot -type l | sed 's|^%buildroot||' | sort >> dist/files.txt
+if rpm -ql filesystem > dist/filesystem.txt
+then
+  while read
+  do
+    sed -i "s|^\${REPLY}$||" dist/directories.txt
+  done < dist/filesystem.txt
+fi
+sed 's@^@%%dir @' dist/directories.txt >> dist/files.txt
 
-cd \$RPM_BUILD_ROOT
+popd
 
 %clean
-rm -rf \$RPM_BUILD_ROOT
+rm -rf %buildroot
 
-%files
+%files -f %_xenroot/dist/files.txt
 %defattr(-,root,root,-)
-/*/*/*
-/boot/*
 
 %post
 EOF
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · Olaf Hering

Commit 438c5ffa44e99cceb574c0f9946aacacdedd2952 ("rpmball: Adjust to new rpm, do not require --force") attempted to handle stricter directory permissions in newer distributions.

This introduced a few issues:
- /boot used to be a constant prior commit 6475d700055fa952f7671cee982a23de2f5e4a7c ("use BOOT_DIR as xen.gz install location"), since this commit the location has to be referenced via ${BOOT_DIR}
- it assumed the prefix and the various configurable paths match the glob pattern /*/*/*

Adjust the code to build a filelist on demand and filter directories from an installed filesystem.rpm.

Take the opportunity to replace the usage of $RPM_BUILD_ROOT with %buildroot, and use pushd/popd pairs.

Fixes 438c5ffa4 ("rpmball: Adjust to new rpm, do not require --force")
---
 tools/misc/mkrpm | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)
tools/misc/mkrpm +0 -1
index 74f6761bb0..a7bf854197 100644
@@ -50,20 +50,35 @@ uninstall.
 %build
 
 %install
-rm -rf \$RPM_BUILD_ROOT

tools/misc/mkrpm uninstall. · line 59

Quoted 10 lines
tools/misc/mkrpm +7 -3
-mkdir -p \$RPM_BUILD_ROOT
-cd %{_xenroot}
-dist/install.sh \$RPM_BUILD_ROOT/
+rm -rf %buildroot
+mkdir -p %buildroot
+pushd %_xenroot
+dist/install.sh %buildroot
+
+pushd %buildroot
+popd

Are these 2 lines left over from testing? They don't appear to do anything useful.

Beside that, patch looks fine:

Thanks,

Signature · 1 line
Anthony PERARD
#2 lore raw

Mon, 12 Jun 2023 11:40:55 +0100 Anthony PERARD <[email protected]>:

Quoted 5 lines · Olaf Hering

Review

Quoted 2 lines
(quoted diff) +2 -0
+pushd %buildroot
+popd  

Are these 2 lines left over from testing? They don't appear to do anything useful.

I think the intention was to test if mkdir succeeded. But then it should have been right after mkdir...

I will send v2 without these two lines.

Olaf

#3 lore raw
Quoted 8 lines · Olaf Hering

Mon, 12 Jun 2023 11:40:55 +0100 Anthony PERARD <[email protected]>:

Quoted 5 lines · Olaf Hering

Review

Quoted 2 lines
(quoted diff) +2 -0
+pushd %buildroot
+popd  

Are these 2 lines left over from testing? They don't appear to do anything useful.

Quoted 4 lines

I think the intention was to test if mkdir succeeded. But then it should have been right after mkdir...

I will send v2 without these two lines.

I'd be fine dropping them while committing.

Jan

#4 lore raw

Mon, 12 Jun 2023 13:44:34 +0200 Jan Beulich <[email protected]>:

Quoted 3 lines · Olaf Hering
Quoted 1 line

I will send v2 without these two lines.

I'd be fine dropping them while committing.

Another cosmetic change in such v2 would be the usage of | instead of @ in the last sed call, for consistency with the other three earlier sed calls. I think it was a result of copy&paste from elsewhere.

Olaf

#5 lore raw
Quoted 9 lines · Olaf Hering

Mon, 12 Jun 2023 13:44:34 +0200 Jan Beulich <[email protected]>:

Quoted 3 lines · Olaf Hering
Quoted 1 line

I will send v2 without these two lines.

I'd be fine dropping them while committing.

Another cosmetic change in such v2 would be the usage of | instead of @ in the last sed call, for consistency with the other three earlier sed calls. I think it was a result of copy&paste from elsewhere.

I see. If you want that, then please indeed send a v2.

Jan