Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major overhaul of Jenkins build to fully integrate it into the
existing build environment rather than trying to hack it in on top. A new variable USE_MOCK determines whether to use mock or not. If not, the old yroot/yinst build environment is now ifdef'd for the non-USE_MOCK case. This ifdef'ing will make it easy to eventually retire the old system by cutting out the ifdef'd code. I also added the ability to isolate the srpm build from the rpm build. They will use separate mock chroots. That work is not completely done yet though.
- Loading branch information
Quentin Barnes
committed
Apr 19, 2015
1 parent
8c6456e
commit 04fe515
Showing
5 changed files
with
167 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,36 @@ | ||
RPMARCH := $(shell rpm -E '%{_arch}') | ||
RPMDIST := $(shell rpm -E '%{dist}') | ||
|
||
DIST ?= $(patsubst .%,%,$(RPMDIST)) | ||
OSMAJNUM ?= $(patsubst el%,%,$(DIST)) | ||
PKGARCH ?= $(RPMARCH) | ||
PKGNAME ?= iptables-daddr | ||
PKGSPECFILE ?= $(PKGNAME).spec | ||
MOCKPREFIX ?= l3dsr$(if $(JOB_NAME),-$(dir $(JOB_NAME))) | ||
RESULT_DIR ?= results_$(MOCKPREFIX)/$(DIST) | ||
|
||
MOCK = mock | ||
|
||
define nl | ||
|
||
|
||
endef | ||
|
||
ifeq ($(DIST),el6) | ||
kernel_vr = 2.6.32-71.el6 | ||
def_mock_args_extra += --define 'rhel_version 600' | ||
endif | ||
|
||
ifeq ($(DIST),el7) | ||
kernel_vr = 3.10.0-123.el7 | ||
def_mock_args_extra += --define 'rhel_version 700' | ||
endif | ||
|
||
$(if ($(kernel_vr),),,$(error Can't determine $$kernel_vr.)) | ||
|
||
kernel_devel = kernel-devel-$(kernel_vr) | ||
kernel_devel_rpm = $(kernel_devel).$(PKGARCH).rpm | ||
kernel_rpm_repo_url = http://repo.linux.corp.yahoo.com/rh$(DIST)_kernels/$(PKGARCH) | ||
# Start a build from Jenkins. | ||
# Jenkins passes in BUILD_DIST, BUILD_ARCH, and BUILD_NUMBER. | ||
|
||
def_make_args = \ | ||
NATIVE=1 \ | ||
CONFIG_ARGS='-r $(kernel_vr)' \ | ||
USE_MOCK=1 \ | ||
PLATFORMS='rh$(BUILD_DIST).$(BUILD_ARCH)' | ||
BUILD_NUMBER='$(BUILD_NUMBER)' | ||
|
||
def_mock_args = \ | ||
-r 'epel-$(OSMAJNUM)-$(PKGARCH)-yahoo' \ | ||
--uniqueext='$(MOCKPREFIX)' \ | ||
--resultdir '$(RESULT_DIR)/' \ | ||
--define 'kmod_kernel_version $(kernel_vr)'" \ | ||
--define 'kmodtool_list kmodtool.el5 kmodtool.el6'" \ | ||
$(def_mock_args_extra) | ||
|
||
def_deploy_rpms_args = -f -T '$(RESULT_DIR)' | ||
def_deploy_rpms_args = -f -T results_* | ||
|
||
clean_files = $(kernel_devel_rpm) | ||
clobber_files = $(clean_files) $(RESULT_DIR) | ||
distclean_files = $(clobber_files) $(dir $(RESULT_DIR)) | ||
clean_files = | ||
clobber_files = $(clean_files) \ | ||
$(wildcard results_*-build-src) \ | ||
$(wildcard results_*-build-$(BUILD_DIST)-$(BUILD_ARCH)) | ||
distclean_files = $(clobber_files) | ||
|
||
commit-%: BUILD_NUMBER:=$(if $(BUILD_NUMBER),0.$(BUILD_NUMBER)) | ||
commit-%: %; | ||
component-%: def_deploy_rpms_args += -R | ||
component-%: %; | ||
|
||
all: rpms | ||
|
||
publish: all | ||
./deploy-rpms $(def_deploy_rpms_args) | ||
|
||
tarball: | ||
all: | ||
$(MAKE) $(def_make_args) $@ | ||
|
||
srpm: tarball mock_prep | ||
$(MOCK) $(def_mock_args) \ | ||
--buildsrpm \ | ||
--arch noarch \ | ||
--spec '$(PKGSPECFILE)' \ | ||
--sources build-tarball | ||
|
||
rpms: srpm mock_prep $(kernel_devel_rpm) | ||
$(MOCK) $(def_mock_args) \ | ||
--yum-cmd install '$(kernel_devel_rpm)' | ||
$(MOCK) $(def_mock_args) \ | ||
--no-clean \ | ||
--rebuild $(RESULT_DIR)/*.src.rpm | ||
|
||
mock_prep: | ||
$(MOCK) $(def_mock_args) --scrub=all | ||
|
||
$(kernel_devel_rpm): | ||
wget -N -q '$(kernel_rpm_repo_url)/$(kernel_devel_rpm)' || \ | ||
{ rm -f -- '$(kernel_devel_rpm)'; exit 1; } | ||
publish: all | ||
./deploy-rpms $(def_deploy_rpms_args) \ | ||
-T $(wildcard results_*-build-$(BUILD_DIST)-$(BUILD_ARCH)) | ||
./deploy-rpms $(def_deploy_rpms_args) \ | ||
-T $(wildcard results_*-build-src) | ||
|
||
clean clobber distclean: | ||
$(foreach f,$(wildcard $($@_files)),rm -rf -- '$f'$(nl)) | ||
$(MAKE) $(def_make_args) $@ | ||
$(foreach f,$(wildcard $($@_files)),rm -rf -- '$f'$(nl)) | ||
|
||
.DEFAULT: commit-all | ||
.PHONY: all publish tarball srpm rpms mock_prep clean clobber distclean | ||
.PHONY: all publish clean clobber distclean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.