From bd101b2edba9928cafddabb4612186ac825b7343 Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Fri, 24 Apr 2015 10:34:03 -0400 Subject: [PATCH] adding rpmbuild to the Makefile for the foreman build This will allow content in the genesis repo to be provided to the centos install via rpm Change-Id: Ib84759211c56006007913010fb3f73f84271b57d JIRA: BGS-41 Signed-off-by: Dan Radez --- foreman/build/Makefile | 34 +++++++++++++++++++++++++++------ foreman/build/c7-opnfv-x86_64-comps.xml | 22 ++++++++++++++++++--- foreman/build/opnfv-genesis.spec | 33 ++++++++++++++++++++++++++++++++ foreman/ci/build.sh | 15 ++++++++------- 4 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 foreman/build/opnfv-genesis.spec diff --git a/foreman/build/Makefile b/foreman/build/Makefile index c08844f..8b87ce6 100644 --- a/foreman/build/Makefile +++ b/foreman/build/Makefile @@ -16,13 +16,17 @@ SHELL = /bin/bash #Input args export UNIT_TEST = FALSE export INTERACTIVE = TRUE -export ISOSRC = file:$(shell pwd)/CentOS-7.0-1406-x86_64-Minimal.iso +export CENTDNLD = http://mirrors.cat.pdx.edu/centos/7.1.1503/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso +export ISOSRC = file:$(shell pwd)/CentOS-7-x86_64-DVD-1503-01.iso export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC)) export PRODNO = "OPNFV_BGS" export REVSTATE = "P0000" export NEWISO = $(shell pwd)/release/OPNFV-CentOS-7-x86_64-${REVSTATE}.iso -export VBOXRPM = $(shell pwd)/VirtualBox-4.3-4.3.26_98988_fedora18-1.x86_64.rpm +export VBOXDNLD = http://download.virtualbox.org/virtualbox/rpm/el/7.1/x86_64/VirtualBox-4.3-4.3.26_98988_el7-1.x86_64.rpm +export VBOXRPM = $(shell pwd)/VirtualBox-4.3-4.3.26_98988_el7-1.x86_64.rpm +export VAGRANTDNLD = https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.rpm export VAGRANTRPM = $(shell pwd)/vagrant_1.7.2_x86_64.rpm +export GENESISRPM = $(shell pwd)/x86_64/opnfv-genesis-0.1-1.x86_64.rpm # Note! Invoke with "make REVSTATE=RXXXX all" to make release build! # Invoke with ICOCACHE=/full/path/to/iso if cached ISO is in non-standard location. @@ -57,7 +61,13 @@ include cache.mk ############################################################################# $(ISOCACHE): - #cp ~/Downloads/opnfv_iso/CentOS-7.0-1406-x86_64-Minimal.iso $(ISOCACHE) + test -s $(ISOCACHE) || { wget -nv $(CENTDNLD) ; } + +$(VBOXRPM): + test -s $(VBOXRPM) || { wget -nv $(VBOXDNLD) ; } + +$(VAGRANTRPM): + test -s $(VAGRANTRPM) || { wget -nv $(VAGRANTDNLD) ; } .PHONY: mount-centiso umount-centiso mount-centiso: $(ISOCACHE) @@ -90,21 +100,33 @@ clean: clean-cache $(SUBCLEAN) $(SUBCLEAN): %.clean: $(MAKE) -C $* -f Makefile clean +.PHONY: rpm-clean +rpm-clean: + rpmbuild --clean opnfv-genesis.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' + +.PHONY: rpm +rpm: + pushd ../../ && git archive --format=tar --prefix=opnfv-genesis-0.1/ HEAD | gzip > foreman/build/opnfv-genesis.tar.gz + rpmbuild -ba opnfv-genesis.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' + @make rpm-clean + + # Todo: Make things smarter - we shouldn't need to clean everything # betwen make invocations. .PHONY: iso -iso: build-clean mount-centiso $(ISOCACHE) $(VBOXRPM) $(VAGRANTRPM) +iso: build-clean $(ISOCACHE) $(VBOXRPM) $(VAGRANTRPM) rpm + @make mount-centiso @mkdir centos release cp -r $(CENTDIR)/* centos @make umount-centiso # modify the installer iso's contents - @rm -rf centos/repodata @cp -f isolinux.cfg centos/isolinux/isolinux.cfg @cp $(VBOXRPM) centos/Packages @cp $(VAGRANTRPM) centos/Packages + @cp $(GENESISRPM) centos/Packages # regenerate yum repo data @echo "Generating new yum metadata" - createrepo centos/Packages -g ../../c7-opnfv-x86_64-comps.xml -o centos + createrepo --update -g ../c7-opnfv-x86_64-comps.xml centos # build the iso @echo "Building OPNFV iso" mkisofs -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -V "OPNFV CentOS 7 x86_64" -R -J -v -T -o $(NEWISO) centos diff --git a/foreman/build/c7-opnfv-x86_64-comps.xml b/foreman/build/c7-opnfv-x86_64-comps.xml index 3d0266e..1e384e6 100644 --- a/foreman/build/c7-opnfv-x86_64-comps.xml +++ b/foreman/build/c7-opnfv-x86_64-comps.xml @@ -150,12 +150,18 @@ biosdevname btrfs-progs coreutils + cpp cronie curl dhclient + dkms e2fsprogs filesystem + gcc glibc + glibc-devel + glibc-headers + git hostname initscripts iproute @@ -164,14 +170,24 @@ iputils irqbalance kbd + kernel-devel + kernel-headers kexec-tools less + libmpc + mpfr + man-db + ncurses + net-tools + less man-db ncurses openssh-clients openssh-server + opnfv-genesis parted passwd + patch plymouth policycoreutils procps-ng @@ -188,7 +204,7 @@ util-linux vagrant vim-minimal - VirtualBox + VirtualBox-4.3 xfsprogs yum dracut-config-generic @@ -203,7 +219,7 @@ opnfv_provisioning - OPNVF Provisioning Server Install + OPNFV Provisioning Server Install নূন্যতম ইনস্টল ন্যূনতম ইনস্টল Minimální instalace @@ -228,7 +244,7 @@ Мінімальна система 最小安装 最小型安裝 - Basic functionality. + Installs an OPNFV Provisioning Server মৌলি কাৰ্য্যকৰীতা। প্রাথমিক বৈশিষ্ট্য। Základní funkcionalita. diff --git a/foreman/build/opnfv-genesis.spec b/foreman/build/opnfv-genesis.spec new file mode 100644 index 0000000..674760f --- /dev/null +++ b/foreman/build/opnfv-genesis.spec @@ -0,0 +1,33 @@ +Name: opnfv-genesis +Version: 0.1 +Release: 1 +Summary: The files from the OPNFV genesis repo + +Group: System Environment +License: Apache 2.0 +URL: https://gerrit.opnfv.org/gerrit/genesis.git +Source0: opnfv-genesis.tar.gz + +#BuildRequires: +Requires: vagrant, VirtualBox-4.3 + +%description +The files from the OPNFV genesis repo + +%prep +%setup -q + + +%build + +%install +mkdir -p %{buildroot}/usr/bin/ +cp foreman/ci/deploy.sh %{buildroot}/usr/bin/ + +%files +/usr/bin/deploy.sh + + +%changelog +* Fri Apr 24 2015 Dan Radez - 0.1-1 +- Initial Packaging diff --git a/foreman/ci/build.sh b/foreman/ci/build.sh index f3d5cf0..0f71636 100755 --- a/foreman/ci/build.sh +++ b/foreman/ci/build.sh @@ -100,6 +100,7 @@ INCLUDE_DIR=../include # SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) LOCK_FILE="${SCRIPT_DIR}/.build.lck" +CACHE_TMP="${SCRIPT_DIR}/tmp" TEST_SUCCEED=0 TEST_FAIL=0 UNIT_TEST=0 @@ -290,11 +291,11 @@ echo $$ > ${LOCK_FILE} if [ ! -z ${BUILD_CACHE_URI} ]; then if [ ${POPULATE_CACHE} -ne 1 ]; then - rm -rf /tmp/cache - mkdir /tmp/cache + rm -rf ${CACHE_TMP}/cache + mkdir -p ${CACHE_TMP}/cache echo "Downloading cach file ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME} ..." set +e - ${REMOTE_ACCESS_METHD} -o /tmp/cache/${LOCAL_CACHE_ARCH_NAME}.tgz ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}.tgz + ${REMOTE_ACCESS_METHD} -o ${CACHE_TMP}/cache/${LOCAL_CACHE_ARCH_NAME}.tgz ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}.tgz tar -tzf ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}.tgz >/dev/null rc=$? set -e @@ -303,8 +304,8 @@ if [ ! -z ${BUILD_CACHE_URI} ]; then POPULATE_CACHE=1 else echo "Unpacking cache file ..." - tar -C /tmp/cache -xvf /tmp/cache/${LOCAL_CACHE_ARCH_NAME}.tgz - cp /tmp/cache/cache/.versions ${BUILD_BASE}/. + tar -C ${CACHE_TMP}/cache -xvf ${CACHE_TMP}/cache/${LOCAL_CACHE_ARCH_NAME}.tgz + cp ${CACHE_TMP}/cache/cache/.versions ${BUILD_BASE}/. set +e make -C ${BUILD_BASE} validate-cache; rc=$? @@ -314,9 +315,9 @@ if [ ! -z ${BUILD_CACHE_URI} ]; then echo "Cache invalid - a new cache will be built " POPULATE_CACHE=1 else - cp -rf /tmp/cache/cache/. ${BUILD_BASE} + cp -rf ${CACHE_TMP}/cache/cache/. ${BUILD_BASE} fi - rm -rf /tmp/cache + rm -rf ${CACHE_TMP}/cache fi fi fi -- 2.16.6