All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -rc] kbuild: properly exclude linux.tar.gz from tar archive
@ 2023-03-15 19:09 Leon Romanovsky
  2023-03-15 20:18 ` Nicolas Schier
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-15 19:09 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Leon Romanovsky, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, linux-kbuild, linux-kernel, Riad Abo Raed

From: Leon Romanovsky <leonro@nvidia.com>

Attempt to build rpm-pkg randomly fails in tar stage, with same error
as was reported by Nicolas [1]

tar -c -f linux.tar.gz -I pigz --exclude=./linux.tar.gz --exclude-from=.tmp_filelist_exclude --owner=0 --group=0 --sort=name --transform 's:^\.:linux:S' -C . .
tar: .: file changed as we read it
make[1]: *** [scripts/Makefile.package:58: linux.tar.gz] Error 1
make[1]: *** Deleting file 'linux.tar.gz'
make: *** [Makefile:1657: rpm-pkg] Error 2

The reason to it that tar is dependent on order of command line
arguments and needs to have excluded file before creating it. So as a
solution, touch that file to create it and move --exclude list before
any tar arguments.

[1] https://lore.kernel.org/all/Y%2Fk+v%2FYj8VQ6q32H@fjasle.eu/
Cc: Nicolas Schier <nicolas@fjasle.eu>
Fixes: 7bf4582d7aad ("kbuild: deb-pkg: create source package without cleaning")
Signed-off-by: Riad Abo Raed <riada@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 scripts/Makefile.package | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index b941e6341b36..be4623481ca2 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -44,7 +44,7 @@ filechk_filelist = \
 # ---------------------------------------------------------------------------
 
 quiet_cmd_tar = TAR     $@
-      cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
+      cmd_tar = touch ./$@ && tar $(tar-exclude-opt) -c -f $@ $(tar-compress-opt) \
                 --owner=0 --group=0 --sort=name \
                 --transform 's:^\.:$*:S' -C $(tar-rootdir) .
 
-- 
2.39.2


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

* Re: [PATCH -rc] kbuild: properly exclude linux.tar.gz from tar archive
  2023-03-15 19:09 [PATCH -rc] kbuild: properly exclude linux.tar.gz from tar archive Leon Romanovsky
@ 2023-03-15 20:18 ` Nicolas Schier
  2023-03-16  7:10   ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Schier @ 2023-03-15 20:18 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Masahiro Yamada, Leon Romanovsky, Nathan Chancellor,
	Nick Desaulniers, linux-kbuild, linux-kernel, Riad Abo Raed

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

On Wed 15 Mar 2023 21:09:33 GMT, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Attempt to build rpm-pkg randomly fails in tar stage, with same error
> as was reported by Nicolas [1]
> 
> tar -c -f linux.tar.gz -I pigz --exclude=./linux.tar.gz --exclude-from=.tmp_filelist_exclude --owner=0 --group=0 --sort=name --transform 's:^\.:linux:S' -C . .
> tar: .: file changed as we read it
> make[1]: *** [scripts/Makefile.package:58: linux.tar.gz] Error 1
> make[1]: *** Deleting file 'linux.tar.gz'
> make: *** [Makefile:1657: rpm-pkg] Error 2
> 
> The reason to it that tar is dependent on order of command line
> arguments and needs to have excluded file before creating it. So as a
> solution, touch that file to create it and move --exclude list before
> any tar arguments.

thanks for digging into and proposing a solution!  I'm afraid it will 
not be taken because of [2] will make the whole cmd_tar definition 
redundant due to the use of 'git archive'.

Nevertheless, this works for me.

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

Kind regards,
Nicolas


[2]: https://lore.kernel.org/linux-kbuild/20230312200731.599706-7-masahiroy@kernel.org/

> [1] https://lore.kernel.org/all/Y%2Fk+v%2FYj8VQ6q32H@fjasle.eu/
> Cc: Nicolas Schier <nicolas@fjasle.eu>
> Fixes: 7bf4582d7aad ("kbuild: deb-pkg: create source package without cleaning")
> Signed-off-by: Riad Abo Raed <riada@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  scripts/Makefile.package | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index b941e6341b36..be4623481ca2 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -44,7 +44,7 @@ filechk_filelist = \
>  # ---------------------------------------------------------------------------
>  
>  quiet_cmd_tar = TAR     $@
> -      cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
> +      cmd_tar = touch ./$@ && tar $(tar-exclude-opt) -c -f $@ $(tar-compress-opt) \
>                  --owner=0 --group=0 --sort=name \
>                  --transform 's:^\.:$*:S' -C $(tar-rootdir) .
>  
> -- 
> 2.39.2

-- 
Nicolas Schier
 
epost|xmpp: nicolas@fjasle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH -rc] kbuild: properly exclude linux.tar.gz from tar archive
  2023-03-15 20:18 ` Nicolas Schier
@ 2023-03-16  7:10   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-16  7:10 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	linux-kbuild, linux-kernel, Riad Abo Raed

On Wed, Mar 15, 2023 at 09:18:08PM +0100, Nicolas Schier wrote:
> On Wed 15 Mar 2023 21:09:33 GMT, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> > 
> > Attempt to build rpm-pkg randomly fails in tar stage, with same error
> > as was reported by Nicolas [1]
> > 
> > tar -c -f linux.tar.gz -I pigz --exclude=./linux.tar.gz --exclude-from=.tmp_filelist_exclude --owner=0 --group=0 --sort=name --transform 's:^\.:linux:S' -C . .
> > tar: .: file changed as we read it
> > make[1]: *** [scripts/Makefile.package:58: linux.tar.gz] Error 1
> > make[1]: *** Deleting file 'linux.tar.gz'
> > make: *** [Makefile:1657: rpm-pkg] Error 2
> > 
> > The reason to it that tar is dependent on order of command line
> > arguments and needs to have excluded file before creating it. So as a
> > solution, touch that file to create it and move --exclude list before
> > any tar arguments.
> 
> thanks for digging into and proposing a solution!  I'm afraid it will 
> not be taken because of [2] will make the whole cmd_tar definition 
> redundant due to the use of 'git archive'.

OK, good to know.

> 
> Nevertheless, this works for me.
> 
> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

Thanks

> 
> Kind regards,
> Nicolas
> 
> 
> [2]: https://lore.kernel.org/linux-kbuild/20230312200731.599706-7-masahiroy@kernel.org/
> 
> > [1] https://lore.kernel.org/all/Y%2Fk+v%2FYj8VQ6q32H@fjasle.eu/
> > Cc: Nicolas Schier <nicolas@fjasle.eu>
> > Fixes: 7bf4582d7aad ("kbuild: deb-pkg: create source package without cleaning")
> > Signed-off-by: Riad Abo Raed <riada@nvidia.com>
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> >  scripts/Makefile.package | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> > index b941e6341b36..be4623481ca2 100644
> > --- a/scripts/Makefile.package
> > +++ b/scripts/Makefile.package
> > @@ -44,7 +44,7 @@ filechk_filelist = \
> >  # ---------------------------------------------------------------------------
> >  
> >  quiet_cmd_tar = TAR     $@
> > -      cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
> > +      cmd_tar = touch ./$@ && tar $(tar-exclude-opt) -c -f $@ $(tar-compress-opt) \
> >                  --owner=0 --group=0 --sort=name \
> >                  --transform 's:^\.:$*:S' -C $(tar-rootdir) .
> >  
> > -- 
> > 2.39.2
> 
> -- 
> Nicolas Schier
>  
> epost|xmpp: nicolas@fjasle.eu          irc://oftc.net/nsc
> ↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
>      -- frykten for herren er opphav til kunnskap --



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

end of thread, other threads:[~2023-03-16  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 19:09 [PATCH -rc] kbuild: properly exclude linux.tar.gz from tar archive Leon Romanovsky
2023-03-15 20:18 ` Nicolas Schier
2023-03-16  7:10   ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.