Skip to contentSkip to conversation

kbuild: rpm-pkg: fix rpm-pkg build error

PATCH New [email protected] 1 participant 1 message Apr 19, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: rpm-pkg: fix rpm-pkg build error

From: Jiwei Sun <[email protected]>

The following error will trigger when building rpm-pkg

$ make rpm-pkg
  SYNC    include/config/auto.conf.cmd
  HOSTLD  scripts/kconfig/conf
  UPD     include/config/kernel.release
  UPD     .tmp_HEAD
  ARCHIVE linux.tar.gz
sh ./scripts/package/mkspec >./kernel.spec
rpmbuild  --target x86_64-linux -bs kernel.spec \
--define='_smp_mflags %{nil}' --define='_sourcedir rpmbuild/SOURCES' --define='_srcrpmdir .'
Building target platforms: x86_64-linux
Building for target x86_64-linux
Wrote: ./kernel-6.3.0_rc7-47.src.rpm
rpmbuild  --target x86_64-linux -rb kernel-6.3.0_rc7-47.src.rpm \
--define='_smp_mflags %{nil}'
Installing kernel-6.3.0_rc7-47.src.rpm
Building target platforms: x86_64-linux
Building for target x86_64-linux
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.QtGSXP
+ umask 022
+ cd /mnt/datapart/rpmbuild/BUILD
+ cd /mnt/datapart/rpmbuild/BUILD
+ rm -rf linux
+ /usr/bin/gzip -dc /mnt/datapart/rpmbuild/SOURCES/linux.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd linux
/var/tmp/rpm-tmp.QtGSXP: line 40: cd: linux: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.QtGSXP (%prep)

There is linux.tar, not linux, and the linux.tar.gz is create by the following
quiet_cmd_archive = ARCHIVE $@

       cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \
                     --output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)

Here the $@ is linux.tar.gz, and $(basename $@) will be linux.tar,
The above fact is the cause, so use $(basename $(basename $@)) to get the right directory name.

---
 scripts/Makefile.package | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.package +1 -1
index 4d90691505b1..3718ecdf9edf 100644
@@ -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 $@) --prefix=$(basename $(basename $@))/ $(archive-args)
 
 # Linux source tarball
 # ---------------------------------------------------------------------------
Signature · 1 line
2.27.0