Message ID | 20230419170424.78688-1-masahiroy@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kbuild: use proper prefix for tarballs to fix rpm-pkg build error | expand |
On Thu 20 Apr 2023 02:04:24 GMT, Masahiro Yamada wrote: > Since commit f8d94c4e403c ("kbuild: do not create intermediate *.tar > for source tarballs"), 'make rpm-pkg' fails because the prefix of the > source tarball is 'linux.tar/' instead of 'linux/'. $(basename $@) > strips only '.gz' from the filename linux.tar.gz. > > You need to strip two suffixes from compressed tarballs and one suffix > from uncompressed tarballs (for example 'perf-6.3.0.tar' generated by > 'make perf-tar-src-pkg'). > > One tricky fix might be --prefix=$(firstword $(subst .tar, ,$@))/ > but I think it is better to hard-code the prefix. thanks, I appreciate the hard-coded archive-args! Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > Fixes: f8d94c4e403c ("kbuild: do not create intermediate *.tar for source tarballs") > Reported-by: Jiwei Sun <sunjw10@lenovo.com> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > scripts/Makefile.package | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/Makefile.package b/scripts/Makefile.package > index 4d90691505b1..4000ad04c122 100644 > --- a/scripts/Makefile.package > +++ b/scripts/Makefile.package > @@ -49,7 +49,7 @@ git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)" > > quiet_cmd_archive = ARCHIVE $@ > cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \ > - --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args) > + --output=$$(realpath $@) $(archive-args) > > # Linux source tarball > # --------------------------------------------------------------------------- > @@ -57,7 +57,7 @@ quiet_cmd_archive = ARCHIVE $@ > linux-tarballs := $(addprefix linux, .tar.gz) > > targets += $(linux-tarballs) > -$(linux-tarballs): archive-args = $$(cat $<) > +$(linux-tarballs): archive-args = --prefix=linux/ $$(cat $<) > $(linux-tarballs): .tmp_HEAD FORCE > $(call if_changed,archive) > > @@ -189,7 +189,7 @@ perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \ > perf-tarballs := $(addprefix perf-$(KERNELVERSION), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst) > > targets += $(perf-tarballs) > -$(perf-tarballs): archive-args = $(perf-archive-args) > +$(perf-tarballs): archive-args = --prefix=perf-$(KERNELVERSION)/ $(perf-archive-args) > $(perf-tarballs): tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE > $(call if_changed,archive) > > -- > 2.37.2
diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 4d90691505b1..4000ad04c122 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -49,7 +49,7 @@ git-config-tar.zst = -c tar.tar.zst.command="$(ZSTD)" quiet_cmd_archive = ARCHIVE $@ cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \ - --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args) + --output=$$(realpath $@) $(archive-args) # Linux source tarball # --------------------------------------------------------------------------- @@ -57,7 +57,7 @@ quiet_cmd_archive = ARCHIVE $@ linux-tarballs := $(addprefix linux, .tar.gz) targets += $(linux-tarballs) -$(linux-tarballs): archive-args = $$(cat $<) +$(linux-tarballs): archive-args = --prefix=linux/ $$(cat $<) $(linux-tarballs): .tmp_HEAD FORCE $(call if_changed,archive) @@ -189,7 +189,7 @@ perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \ perf-tarballs := $(addprefix perf-$(KERNELVERSION), .tar .tar.gz .tar.bz2 .tar.xz .tar.zst) targets += $(perf-tarballs) -$(perf-tarballs): archive-args = $(perf-archive-args) +$(perf-tarballs): archive-args = --prefix=perf-$(KERNELVERSION)/ $(perf-archive-args) $(perf-tarballs): tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE $(call if_changed,archive)
Since commit f8d94c4e403c ("kbuild: do not create intermediate *.tar for source tarballs"), 'make rpm-pkg' fails because the prefix of the source tarball is 'linux.tar/' instead of 'linux/'. $(basename $@) strips only '.gz' from the filename linux.tar.gz. You need to strip two suffixes from compressed tarballs and one suffix from uncompressed tarballs (for example 'perf-6.3.0.tar' generated by 'make perf-tar-src-pkg'). One tricky fix might be --prefix=$(firstword $(subst .tar, ,$@))/ but I think it is better to hard-code the prefix. Fixes: f8d94c4e403c ("kbuild: do not create intermediate *.tar for source tarballs") Reported-by: Jiwei Sun <sunjw10@lenovo.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- scripts/Makefile.package | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)