From 83491b1a092c58983e6aba6466fd85b479164937 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Tue, 10 Oct 2023 13:22:18 +0530 Subject: [PATCH] use rpm macros instead of RPM's exported shell vars --- master.inc | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/master.inc b/master.inc index cb20415..a599016 100644 --- a/master.inc +++ b/master.inc @@ -111,18 +111,18 @@ sed -i 's@KBUILD_IMAGE := $(boot)/Image.gz@KBUILD_IMAGE := $(boot)/Image@' arch/ %{make} PYTHON=%{__python3} %{make_targets} %install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT +rm -rf %{buildroot} +mkdir -p %{buildroot} # install the kernel -mkdir -p $RPM_BUILD_ROOT/boot -cp $(%{make} -s image_name) $RPM_BUILD_ROOT/boot/vmlinuz-%{KVERREL} -chmod 755 $RPM_BUILD_ROOT/boot/vmlinuz-%{KVERREL} -echo "%{KVERREL}" > $RPM_BUILD_ROOT/boot/.uname-%{KVERREL} +mkdir -p %{buildroot}/boot +cp $(%{make} -s image_name) %{buildroot}/boot/vmlinuz-%{KVERREL} +chmod 755 %{buildroot}/boot/vmlinuz-%{KVERREL} +echo "%{KVERREL}" > %{buildroot}/boot/.uname-%{KVERREL} # install DTBs %ifarch aarch64 || riscv64 -%{make} INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/boot/dtb-%{KVERREL} dtbs_install +%{make} INSTALL_DTBS_PATH=%{buildroot}/boot/dtb-%{KVERREL} dtbs_install # delete "arch/%{build_arch}/boot/dts" because "$PWD" will be packaged in "%devel" find arch/%{build_arch}/boot/dts -name '*.dtb' -type f -delete %endif @@ -130,33 +130,33 @@ find arch/%{build_arch}/boot/dts -name '*.dtb' -type f -delete # install modules # '$(mod-fw)' is overridden because there is no reason to install any firmware # since we already have 'linux-firmware' package as the dependency of this package. -%{make} INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=$RPM_BUILD_ROOT mod-fw= modules_install +%{make} INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} mod-fw= modules_install # install headers -%{make} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install +%{make} INSTALL_HDR_PATH=%{buildroot}/usr headers_install # install other key files too -install -m 644 .config $RPM_BUILD_ROOT/boot/config-%{KVERREL} -install -m 644 .config $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/config -install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-%{KVERREL} -install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/System.map +install -m 644 .config %{buildroot}/boot/config-%{KVERREL} +install -m 644 .config %{buildroot}/lib/modules/%{KVERREL}/config +install -m 644 System.map %{buildroot}/boot/System.map-%{KVERREL} +install -m 644 System.map %{buildroot}/lib/modules/%{KVERREL}/System.map # fix links -rm -rf $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build -rm -rf $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/source -ln -fns /usr/src/kernels/%{KVERREL} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build -ln -fns /usr/src/kernels/%{KVERREL} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/source +rm -rf %{buildroot}/lib/modules/%{KVERREL}/build +rm -rf %{buildroot}/lib/modules/%{KVERREL}/source +ln -fns /usr/src/kernels/%{KVERREL} %{buildroot}/lib/modules/%{KVERREL}/build +ln -fns /usr/src/kernels/%{KVERREL} %{buildroot}/lib/modules/%{KVERREL}/source # install actual Linux src to /usr/src/kernels/%{KVERREL} -mkdir -p $RPM_BUILD_ROOT/usr/src/kernels/%{KVERREL} +mkdir -p %{buildroot}/usr/src/kernels/%{KVERREL} if [ -f scripts/package/install-extmod-build ]; then - %{make} run-command KBUILD_RUN_COMMAND='${RPM_BUILD_DIR}/%{src_dir}/scripts/package/install-extmod-build $RPM_BUILD_ROOT/usr/src/kernels/%{KVERREL}' + %{make} run-command KBUILD_RUN_COMMAND='%{_builddir}/%{src_dir}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KVERREL}' else - touch $RPM_BUILD_ROOT/usr/src/kernels/%{KVERREL}/MAYBE_THIS_WORKS + touch %{buildroot}/usr/src/kernels/%{KVERREL}/MAYBE_THIS_WORKS fi %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %post set -xeuf -o pipefail