Skip to content

Commit

Permalink
kbuild: use proper prefix for tarballs to fix rpm-pkg build error
Browse files Browse the repository at this point in the history
Since commit f8d94c4 ("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: f8d94c4 ("kbuild: do not create intermediate *.tar for source tarballs")
Reported-by: Jiwei Sun <sunjw10@lenovo.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
  • Loading branch information
masahir0y committed Apr 23, 2023
1 parent 8b82422 commit 9cedc5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/Makefile.package
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ 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
# ---------------------------------------------------------------------------

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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 9cedc5e

Please sign in to comment.