xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] tools: fix make rpmball
@ 2021-07-07 13:10 Olaf Hering
  0 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2021-07-07 13:10 UTC (permalink / raw)
  To: xen-devel; +Cc: Olaf Hering, Ian Jackson, Wei Liu

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. This works on a SUSE system, and
will likely work on a RedHat based system as well.

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

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tools/misc/mkrpm | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/tools/misc/mkrpm b/tools/misc/mkrpm
index 68819b2d73..b31054444d 100644
--- a/tools/misc/mkrpm
+++ b/tools/misc/mkrpm
@@ -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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] tools: fix make rpmball
  2023-06-12 11:52       ` Olaf Hering
@ 2023-06-12 11:57         ` Jan Beulich
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2023-06-12 11:57 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, Wei Liu, Anthony PERARD

On 12.06.2023 13:52, Olaf Hering wrote:
> Mon, 12 Jun 2023 13:44:34 +0200 Jan Beulich <jbeulich@suse.com>:
> 
>> On 12.06.2023 13:35, Olaf Hering wrote:
>>> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] tools: fix make rpmball
  2023-06-12 11:44     ` Jan Beulich
@ 2023-06-12 11:52       ` Olaf Hering
  2023-06-12 11:57         ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2023-06-12 11:52 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Wei Liu, Anthony PERARD

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

Mon, 12 Jun 2023 13:44:34 +0200 Jan Beulich <jbeulich@suse.com>:

> On 12.06.2023 13:35, Olaf Hering wrote:
> > 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

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] tools: fix make rpmball
  2023-06-12 11:35   ` Olaf Hering
@ 2023-06-12 11:44     ` Jan Beulich
  2023-06-12 11:52       ` Olaf Hering
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2023-06-12 11:44 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, Wei Liu, Anthony PERARD

On 12.06.2023 13:35, Olaf Hering wrote:
> Mon, 12 Jun 2023 11:40:55 +0100 Anthony PERARD <anthony.perard@citrix.com>:
> 
>> On Tue, May 30, 2023 at 01:18:07PM +0200, Olaf Hering wrote:
>>> +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.

I'd be fine dropping them while committing.

Jan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] tools: fix make rpmball
  2023-06-12 10:40 ` Anthony PERARD
@ 2023-06-12 11:35   ` Olaf Hering
  2023-06-12 11:44     ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2023-06-12 11:35 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: xen-devel, Wei Liu

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

Mon, 12 Jun 2023 11:40:55 +0100 Anthony PERARD <anthony.perard@citrix.com>:

> On Tue, May 30, 2023 at 01:18:07PM +0200, Olaf Hering wrote:
> > +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

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] tools: fix make rpmball
  2023-05-30 11:18 Olaf Hering
@ 2023-06-12 10:40 ` Anthony PERARD
  2023-06-12 11:35   ` Olaf Hering
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony PERARD @ 2023-06-12 10:40 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, Wei Liu

On Tue, May 30, 2023 at 01:18:07PM +0200, Olaf Hering wrote:
> 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")
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>  tools/misc/mkrpm | 33 ++++++++++++++++++++++++---------
>  1 file changed, 24 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/misc/mkrpm b/tools/misc/mkrpm
> index 74f6761bb0..a7bf854197 100644
> --- a/tools/misc/mkrpm
> +++ b/tools/misc/mkrpm
> @@ -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

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


Beside that, patch looks fine:
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1] tools: fix make rpmball
@ 2023-05-30 11:18 Olaf Hering
  2023-06-12 10:40 ` Anthony PERARD
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2023-05-30 11:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Anthony PERARD

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")

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tools/misc/mkrpm | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/tools/misc/mkrpm b/tools/misc/mkrpm
index 74f6761bb0..a7bf854197 100644
--- a/tools/misc/mkrpm
+++ b/tools/misc/mkrpm
@@ -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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-12 11:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 13:10 [PATCH v1] tools: fix make rpmball Olaf Hering
2023-05-30 11:18 Olaf Hering
2023-06-12 10:40 ` Anthony PERARD
2023-06-12 11:35   ` Olaf Hering
2023-06-12 11:44     ` Jan Beulich
2023-06-12 11:52       ` Olaf Hering
2023-06-12 11:57         ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).