[lkml]   [2017]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 6/9] kbuild: rpm-pkg: replace $RPM_BUILD_ROOT with %{buildroot}
$RPM_BUILD_ROOT must be escaped to prevent shell from expanding it
when generating the spec file.

%{build_root} is more readable than \$RPM_BUILD_ROOT.

Signed-off-by: Masahiro Yamada <>

scripts/package/mkspec | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 8a9ab85..11e07b5 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -81,30 +81,30 @@ $S %build
$S make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
- mkdir -p \$RPM_BUILD_ROOT/boot
+ mkdir -p %{buildroot}/boot
%ifarch ia64
- mkdir -p \$RPM_BUILD_ROOT/boot/efi
- cp \$(make image_name) \$RPM_BUILD_ROOT/boot/efi/vmlinuz-$KERNELRELEASE
- ln -s efi/vmlinuz-$KERNELRELEASE \$RPM_BUILD_ROOT/boot/
+ mkdir -p %{buildroot}/boot/efi
+ cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
+ ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
- cp \$(make image_name) \$RPM_BUILD_ROOT/boot/vmlinuz-$KERNELRELEASE
+ cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
-$M make %{?_smp_mflags} INSTALL_MOD_PATH=\$RPM_BUILD_ROOT KBUILD_SRC= modules_install
- make %{?_smp_mflags} INSTALL_HDR_PATH=\$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install
- cp .config \$RPM_BUILD_ROOT/boot/config-$KERNELRELEASE
+$M make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install
+ make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install
+ cp %{buildroot}/boot/$KERNELRELEASE
+ cp .config %{buildroot}/boot/config-$KERNELRELEASE
bzip2 -9 --keep vmlinux
- mv vmlinux.bz2 \$RPM_BUILD_ROOT/boot/vmlinux-$KERNELRELEASE.bz2
-$S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build
-$S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source
-$S$M mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
-$S$M tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
+ mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
+$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
+$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
+$S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
+$S$M tar cf - . $EXCLUDES | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE
+$S$M cd %{buildroot}/lib/modules/$KERNELRELEASE
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE source

- rm -rf \$RPM_BUILD_ROOT
+ rm -rf %{buildroot}

if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/$KERNELRELEASE ]; then
 \ /
  Last update: 2017-09-30 03:11    [W:0.097 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site