2008-07-24 04:53:54

by Jeremy Kerr

[permalink] [raw]
Subject: [PATCH 1/2] scripts/package: don't break if %{_smp_mflags} isn't set

Currently, if we do a 'make rpm-pkg' without the _smp_mflags rpm macro
defined, the build fails with:

[snip]
Executing(%build): /bin/bash -e /var/tmp/rpm-tmp.67959
+ umask 022
+ cd /home/jk/devel/kernel-snapshot/rpm/BUILD
+ cd kernel-2.6.26
+ make clean
+ make '%{_smp_mflags}'
make[3]: *** No rule to make target `%{_smp_mflags}'. Stop.
error: Bad exit status from /var/tmp/rpm-tmp.67959 (%build)

This change uses the 'null if not set' reference to the _smp_mflags
macro instead.

Signed-off-by: Jeremy Kerr <[email protected]>

---
scripts/package/mkspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index ffd61fe..20f7da6 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -57,7 +57,7 @@ fi
echo "%build"

if ! $PREBUILT; then
-echo "make clean && make %{_smp_mflags}"
+echo "make clean && make %{?_smp_mflags}"
echo ""
fi


2008-07-24 04:54:48

by Jeremy Kerr

[permalink] [raw]
Subject: [PATCH 2/2] scripts/package: allow custom options to rpm

Add a RPMOPTS make variable to allow arbitrary options to be passed
to rpm during 'make rpm-pkg'. For example:

make RPMOPTS="--define '_topdir /home/jk/rpm'" rpm-pkg

Signed-off-by: Jeremy Kerr <[email protected]>

---
scripts/package/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 5e32607..c162409 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -47,7 +47,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE
set -e; \
mv -f $(objtree)/.tmp_version $(objtree)/.version

- $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
+ $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
rm ../$(KERNELPATH).tar.gz

clean-files := $(objtree)/kernel.spec
@@ -64,7 +64,8 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE
set -e; \
mv -f $(objtree)/.tmp_version $(objtree)/.version

- $(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
+ $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \
+ $(UTS_MACHINE) -bb $<

clean-files += $(objtree)/binkernel.spec