diff options
author | Dan Radez <dradez@redhat.com> | 2015-04-24 10:34:03 -0400 |
---|---|---|
committer | Dan Radez <dradez@redhat.com> | 2015-05-04 12:03:37 -0400 |
commit | bd101b2edba9928cafddabb4612186ac825b7343 (patch) | |
tree | b4260ab049034b9d254d395eaf305c13f54cfd20 | |
parent | 4266577cd0a7c0816cd3bf951522c7ad1633f02b (diff) |
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 <dradez@redhat.com>
-rw-r--r-- | foreman/build/Makefile | 34 | ||||
-rw-r--r-- | foreman/build/c7-opnfv-x86_64-comps.xml | 22 | ||||
-rw-r--r-- | foreman/build/opnfv-genesis.spec | 33 | ||||
-rwxr-xr-x | foreman/ci/build.sh | 15 |
4 files changed, 88 insertions, 16 deletions
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 @@ <packagereq type="mandatory">biosdevname</packagereq> <packagereq type="mandatory">btrfs-progs</packagereq> <packagereq type="mandatory">coreutils</packagereq> + <packagereq type="mandatory">cpp</packagereq> <packagereq type="mandatory">cronie</packagereq> <packagereq type="mandatory">curl</packagereq> <packagereq type="mandatory">dhclient</packagereq> + <packagereq type="mandatory">dkms</packagereq> <packagereq type="mandatory">e2fsprogs</packagereq> <packagereq type="mandatory">filesystem</packagereq> + <packagereq type="mandatory">gcc</packagereq> <packagereq type="mandatory">glibc</packagereq> + <packagereq type="mandatory">glibc-devel</packagereq> + <packagereq type="mandatory">glibc-headers</packagereq> + <packagereq type="mandatory">git</packagereq> <packagereq type="mandatory">hostname</packagereq> <packagereq type="mandatory">initscripts</packagereq> <packagereq type="mandatory">iproute</packagereq> @@ -164,14 +170,24 @@ <packagereq type="mandatory">iputils</packagereq> <packagereq type="mandatory">irqbalance</packagereq> <packagereq type="mandatory">kbd</packagereq> + <packagereq type="mandatory">kernel-devel</packagereq> + <packagereq type="mandatory">kernel-headers</packagereq> <packagereq type="mandatory">kexec-tools</packagereq> <packagereq type="mandatory">less</packagereq> + <packagereq type="mandatory">libmpc</packagereq> + <packagereq type="mandatory">mpfr</packagereq> + <packagereq type="mandatory">man-db</packagereq> + <packagereq type="mandatory">ncurses</packagereq> + <packagereq type="mandatory">net-tools</packagereq> + <packagereq type="mandatory">less</packagereq> <packagereq type="mandatory">man-db</packagereq> <packagereq type="mandatory">ncurses</packagereq> <packagereq type="mandatory">openssh-clients</packagereq> <packagereq type="mandatory">openssh-server</packagereq> + <packagereq type="mandatory">opnfv-genesis</packagereq> <packagereq type="mandatory">parted</packagereq> <packagereq type="mandatory">passwd</packagereq> + <packagereq type="mandatory">patch</packagereq> <packagereq type="mandatory">plymouth</packagereq> <packagereq type="mandatory">policycoreutils</packagereq> <packagereq type="mandatory">procps-ng</packagereq> @@ -188,7 +204,7 @@ <packagereq type="mandatory">util-linux</packagereq> <packagereq type="mandatory">vagrant</packagereq> <packagereq type="mandatory">vim-minimal</packagereq> - <packagereq type="mandatory">VirtualBox</packagereq> + <packagereq type="mandatory">VirtualBox-4.3</packagereq> <packagereq type="mandatory">xfsprogs</packagereq> <packagereq type="mandatory">yum</packagereq> <packagereq type="optional">dracut-config-generic</packagereq> @@ -203,7 +219,7 @@ <environment> <id>opnfv_provisioning</id> - <name>OPNVF Provisioning Server Install</name> + <name>OPNFV Provisioning Server Install</name> <name xml:lang='as'>নূন্যতম ইনস্টল</name> <name xml:lang='bn_IN'>ন্যূনতম ইনস্টল</name> <name xml:lang='cs'>Minimální instalace</name> @@ -228,7 +244,7 @@ <name xml:lang='uk'>Мінімальна система</name> <name xml:lang='zh_CN'>最小安装</name> <name xml:lang='zh_TW'>最小型安裝</name> - <description>Basic functionality.</description> + <description>Installs an OPNFV Provisioning Server</description> <description xml:lang='as'>মৌলি কাৰ্য্যকৰীতা।</description> <description xml:lang='bn_IN'>প্রাথমিক বৈশিষ্ট্য।</description> <description xml:lang='cs'>Základní funkcionalita.</description> 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 <dradez@redhatcom> - 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 |