Skip to contentSkip to conversation

make binrpm-pkg problem with Fedora 22

PATCH In review Jim Davis 3 participants 5 messages May 29, 2015 – Jun 15, 2015 Kbuild

lore
Share & tools
lore

Jim Davis

author
#0 lore raw

On a new Fedora 22 install, running 'make binrpm-pkg' in the v4.1-rc5 kernel source tree fails with

rpm --define "_builddir ." --target \
    x86_64 -bb ./binkernel.spec

rpm --target: unknown option scripts/package/Makefile:60: recipe for target 'binrpm-pkg' failed

From that makefile,

# Do we have rpmbuild, otherwise fall back to the older rpm RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
else echo rpm; fi)

but it looks like the rpmbuild functionality has been taken out of (plain) rpm now.

Jim

#1 lore raw
Quoted 7 lines · Jim Davis

On a new Fedora 22 install, running 'make binrpm-pkg' in the v4.1-rc5 kernel source tree fails with

rpm --define "_builddir ." --target \
    x86_64 -bb ./binkernel.spec

rpm --target: unknown option scripts/package/Makefile:60: recipe for target 'binrpm-pkg' failed

This looks like the issue I ran into a few times after installing
Fedora: the need to install the rpm-build package separately, because it isn't included in the default install. At least, the installs I do tend to have it excluded. (The gotcha that I trip over _every_ time is that rpmbuild is packaged in rpm-build. Note the hyphen.)

Quoted 8 lines

From that makefile,

# Do we have rpmbuild, otherwise fall back to the older rpm RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
else echo rpm; fi)

but it looks like the rpmbuild functionality has been taken out of (plain) rpm now.

This made me grep rpm's history a bit. I found a change from 2008 that reads:
Update rpm manpage wrt build modes
- the build modes have been removed ages ago, just point to rpmbuild manual

And there's a change from 2000 that already reads:
Remove build modes from rpm, use rpmb and/or popt glue instead.

We could consult people actually familiar with rpm's history, but it appears plain rpm hasn't been able to build rpms for quite some time. So I think scripts/package/Makefile should only (try to) use rpmbuild.

Hope this helps,

Paul Bolle

author
#2 lore raw
Quoted 24 lines · Paul Bolle
Quoted 7 lines · Jim Davis

On a new Fedora 22 install, running 'make binrpm-pkg' in the v4.1-rc5 kernel source tree fails with

rpm --define "_builddir ." --target \
    x86_64 -bb ./binkernel.spec

rpm --target: unknown option scripts/package/Makefile:60: recipe for target 'binrpm-pkg' failed

This looks like the issue I ran into a few times after installing
Fedora: the need to install the rpm-build package separately, because it isn't included in the default install. At least, the installs I do tend to have it excluded. (The gotcha that I trip over _every_ time is that rpmbuild is packaged in rpm-build. Note the hyphen.)

Quoted 8 lines

From that makefile,

# Do we have rpmbuild, otherwise fall back to the older rpm RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
else echo rpm; fi)

but it looks like the rpmbuild functionality has been taken out of (plain) rpm now.

Quoted 7 lines

This made me grep rpm's history a bit. I found a change from 2008 that reads:
Update rpm manpage wrt build modes
- the build modes have been removed ages ago, just point to rpmbuild manual

And there's a change from 2000 that already reads:
Remove build modes from rpm, use rpmb and/or popt glue instead.

Right; the most recent Fedora documentation on rpm I could find
(http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch08s02.html)
said the rpm -b passthrough to rpmbuild went away in version 4.1, which was released in 2002. Downloading the 4.1 tarball, and the 4.0.4 tarball before it, and comparing the man pages, it looks like 4.1 was indeed the last version where that trick in the makefile would have worked.

Quoted 4 lines

We could consult people actually familiar with rpm's history, but it appears plain rpm hasn't been able to build rpms for quite some time. So I think scripts/package/Makefile should only (try to) use rpmbuild.

I'll see if I can knock together a patch in my copious spare time.

Jim

author
#3 lore raw

PATCH 1/1 scripts/package/Makefile: rpmbuild is needed for rpm targets

Before rpm release 4.1, in 2002, either the rpm command or the rpmbuild command could be used in the rpm-pkg or binrpm-pkg targets, and the Makefile chose the rpm command if the rpmbuild command wasn't found.

After release 4.1, however, the rpm command could no longer be used in place of the rpmbuild command. As the rpmbuild command is not installed by default, this can lead to failures with the rpm-pkg and binrpm-pkg targets:

rpm --define "_builddir ." --target \
    x86_64 -bb ./binkernel.spec
    rpm --target: unknown option
    scripts/package/Makefile:60: recipe for target 'binrpm-pkg' failed

Change the Makefile to use rpmbuild unconditionally to avoid this.

---
 scripts/package/Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/package/Makefile +2 -6
index 99ca6e7..8b11d5a 100644
@@ -21,10 +21,6 @@
 # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
 # but the binrpm-pkg target can; for some reason O= gets ignored.
 
-# Do we have rpmbuild, otherwise fall back to the older rpm
-RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
-	           else echo rpm; fi)
-
 # Remove hyphens since they have special meaning in RPM filenames
 KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
 # Include only those top-level files that are needed by make, plus the GPL copy
@@ -51,7 +47,7 @@ rpm-pkg rpm: FORCE
 	rm -f $(objtree)/.scmversion
 	$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
 	mv -f $(objtree)/.tmp_version $(objtree)/.version
-	$(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
+	rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
 	rm $(KERNELPATH).tar.gz kernel.spec
 
 # binrpm-pkg
@@ -62,7 +58,7 @@ binrpm-pkg: FORCE
 	$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
 	mv -f $(objtree)/.tmp_version $(objtree)/.version
 
-	$(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
+	rpmbuild --define "_builddir $(objtree)" --target \
 		$(UTS_MACHINE) -bb $(objtree)/binkernel.spec
 	rm binkernel.spec
 

--
2.4.2

#4 lore raw

Re: [PATCH] scripts/package/Makefile: rpmbuild is needed for rpm targets

Quoted 10 lines · Jim Davis

Before rpm release 4.1, in 2002, either the rpm command or the rpmbuild command could be used in the rpm-pkg or binrpm-pkg targets, and the Makefile chose the rpm command if the rpmbuild command wasn't found.

After release 4.1, however, the rpm command could no longer be used in place of the rpmbuild command. As the rpmbuild command is not installed by default, this can lead to failures with the rpm-pkg and binrpm-pkg targets:

Quoted 8 lines
rpm --define "_builddir ." --target \
    x86_64 -bb ./binkernel.spec
    rpm --target: unknown option
    scripts/package/Makefile:60: recipe for target 'binrpm-pkg' failed

Change the Makefile to use rpmbuild unconditionally to avoid this.

I agree that compatibility with rpm < 4.1 is not an issue nowadays and "rpmbuild: command not found" is a lot more informative error message. I applied the patch to kbuild.git#misc.

thanks,
Michal