Permalink
Browse files

Don't use the native OS's rpm command to determine the rpm names.

Problems happen when %dist is different inside mock than outside.

Also use to "rpm -q --specfile ...".  Without the "-q" doesn't
work on RHEL6.
  • Loading branch information...
qbarnes committed May 5, 2016
1 parent f507a3b commit f6f084a2bcc4e954eb42ea0b0a15a6badf61c886
Showing with 10 additions and 6 deletions.
  1. +9 −5 linux/mock/Makefile
  2. +1 −1 linux/rpm/Makefile
View
@@ -12,10 +12,6 @@
# Also see rpm/rpmdefs.mk for rarely set optional macros.
#
-include macros.mk package.mk rpm/rpmdefs.mk
-
-MOCK ?= mock
-
ifdef DIST
ifeq ($(DIST),"")
dist = %{nil}
@@ -24,6 +20,10 @@ ifdef DIST
endif
endif
+include macros.mk package.mk rpm/rpmdefs.mk
+
+MOCK ?= mock
+
srpm_resultdir = $(or $(MOCK_SRPM_RESULTDIR),results_srpm)
rpm_resultdir = $(or $(MOCK_RPM_RESULTDIR),results_rpm)
@@ -42,7 +42,11 @@ rpmspecfile = $(rpmdir)/$(specfile)
sources = SOURCES
sourcesfiles = $(addprefix $(sources)/,$(extrasrcfiles))
-rpmpkgs := $(shell rpm $(build_defs) --specfile '$(rpmspecfile)' 2> /dev/null)
+rpmpkgs := $(shell \
+ $(MOCK) $(mock_srpm_args) --quiet \
+ --copyin '$(rpmspecfile)' . && \
+ $(MOCK) $(mock_srpm_args) --quiet \
+ --shell "rpm -q $(build_defs) --specfile '$(specfile)'")
rpmpkgs := $(rpmpkgs) kmod-$(firstword $(rpmpkgs))
rpms = $(foreach p,$(rpmpkgs),$(rpm_resultdir)/$p.rpm)
View
@@ -28,7 +28,7 @@ ifdef DIST
endif
endif
-rpmpkgs := $(shell rpm $(build_defs) --specfile '$(specfile)' 2> /dev/null)
+rpmpkgs := $(shell rpm -q $(build_defs) --specfile '$(specfile)' 2> /dev/null)
rpmpkgs := $(rpmpkgs) kmod-$(firstword $(rpmpkgs))
pkgarches = $(foreach p,$(rpmpkgs),$(lastword $(subst ., ,$p)))

0 comments on commit f6f084a

Please sign in to comment.