Build the ISO as part of the makefile

Change-Id: Id2be52de5c8b86af1ca76cb0e70cd0ed80bac3a2
This commit is contained in:
John Hua 2016-08-11 16:46:38 +08:00 committed by Huan Xie
parent 039d0ad335
commit c60e97f59d
6 changed files with 66 additions and 66 deletions

1
.gitignore vendored
View File

@ -5,4 +5,5 @@
*.sublime-workspace
BUILD/*
output
suppack/xenserver-suppack
*~

View File

@ -17,7 +17,10 @@ rpm: output/${RPM_NAME}
docs: $(DOC_NAMES:%=output/${PLUGIN_NAME}-${PLUGIN_VERSION}-%.pdf)
${BUILDROOT}/${PLUGIN_NAME}: ${BRANDING}
iso: plugin_source/deployment_scripts/patchset/xenhost
suppack/build-xenserver-suppack.sh
${BUILDROOT}/${PLUGIN_NAME}: ${BRANDING} iso
mkdir -p ${BUILDROOT}/${PLUGIN_NAME}
cp -r plugin_source/* ${BUILDROOT}/${PLUGIN_NAME}
find ${BUILDROOT}/${PLUGIN_NAME} -type f -print0 | \
@ -27,6 +30,7 @@ ${BUILDROOT}/${PLUGIN_NAME}: ${BRANDING}
-e s/@PLUGIN_NAME@/${PLUGIN_NAME}/g {} \
-e s/@PLUGIN_VERSION@/${PLUGIN_VERSION}/g {} \
-e s/@PLUGIN_REVISION@/${PLUGIN_REVISION}/g {}
cp suppack/xenapi-plugins-*.iso ${BUILDROOT}/${PLUGIN_NAME}/deployment_scripts/
${BUILDROOT}/doc/source ${BUILDROOT}/doc/Makefile: ${BRANDING}
mkdir -p ${BUILDROOT}/doc

View File

@ -1,35 +0,0 @@
# build-xenserver-suppack.sh
This script is used to build iso for XenServer Dom0 xapi plugin.
It will build both Nova and Neutron Dom0 plugin RPM packages firstly,
and then make them in one ISO.
## usage:
#####./build-xenserver-suppack.sh $xcp-version $xs-build $os-git-branch $os-plugin-version
* xcp-version: Xen cloud platform version which can be used for this plugin
* xs-build: XenServer build number
* os-git-branch: OpenStack branch that's used for building this plugin
* os-plugin-version: OpenStack XenServer Dom0 plguin version
*NOTE: If no input parameters given, default values are used*
*xcp-version: 1.9.0
*xs-build: 90233c*
*os-git-branch: stable/liberty*
*os-plugin-version: 2015.1*
*os-release: liberty*

30
suppack/README.md Normal file
View File

@ -0,0 +1,30 @@
# build-xenserver-suppack.sh
This script is used to build iso for XenServer Dom0 xapi plugin.
It will build both Nova and Neutron Dom0 plugin RPM packages firstly,
and then make them in one ISO.
## usage:
#####./build-xenserver-suppack.sh OS_RELEASE PLATFORM_VERSION XS_BUILD XS_PLUGIN_VERSION
* OS_RELEASE: OpenStack branch that's used for building this plugin
* PLATFORM_VERSION: Xen cloud platform version which can be used for this plugin
* XS_BUILD: XenServer build number
* XS_PLUGIN_VERSION: OpenStack XenServer Dom0 plguin version
*NOTE: If no input parameters given, default values are used*
*OS_RELEASE: mitaka
*PLATFORM_VERSION: 1.9
*XS_BUILD: 90233c
*XS_PLUGIN_VERSION: 2015.1

View File

@ -17,7 +17,6 @@ set -eux
THIS_FILE=$(readlink -f $0)
FUELPLUG_UTILS_ROOT=$(dirname $THIS_FILE)
DEPLOYMENT_SCRIPT_ROOT=$(dirname $FUELPLUG_UTILS_ROOT)
cd $FUELPLUG_UTILS_ROOT
rm -rf xenserver-suppack
mkdir -p xenserver-suppack && cd xenserver-suppack
@ -26,29 +25,39 @@ mkdir -p xenserver-suppack && cd xenserver-suppack
# =============================================
# Configurable items
# xenserver version info
PLATFORM_VERSION=${1:-"1.9"}
XS_BUILD=${2:-"90233c"}
# OpenStack release
OS_RELEASE=${1:-"mitaka"}
# branch info
GITBRANCH=${3:-"origin/stable/liberty"}
# xenserver version info
PLATFORM_VERSION=${2:-"1.9"}
XS_BUILD=${3:-"90233c"}
# nova and neutron xenserver dom0 plugin version
XS_PLUGIN_VERSION=${4:-"2015.1"}
# OpenStack release
OS_RELEASE=${5:-"liberty"}
# branch info
GITBRANCH="origin/stable/$OS_RELEASE"
# repository info
NOVA_GITREPO="https://git.openstack.org/openstack/nova"
NEUTRON_GITREPO="https://git.openstack.org/openstack/neutron"
DDK_ROOT_URL="http://copper.eng.hq.xensource.com/builds/ddk-xs6_2.tgz"
RPM_BUILDER_REPO="https://github.com/citrix-openstack/xenserver-nova-suppack-builder"
# Update system and install dependencies
export DEBIAN_FRONTEND=noninteractive
# =============================================
# Install suppack builder
set +e
rpm -q supp-pack-build-2.1.0-xs55.noarch &> /dev/null
if [ $? -ne 0 ]; then
rpm -i http://coltrane.uk.xensource.com/usr/groups/release/XenServer-7.x/XS-7.0/RTM-125380/binary-packages/RPMS/domain0/RPMS/noarch/supp-pack-build-2.1.0-xs55.noarch.rpm
fi
rpm -q xcp-python-libs-1.9.0-159.noarch &> /dev/null
if [ $? -ne 0 ]; then
rpm -i http://coltrane.uk.xensource.com/usr/groups/release/XenServer-7.x/XS-7.0/RTM-125380/binary-packages/RPMS/domain0/RPMS/noarch/xcp-python-libs-1.9.0-159.noarch.rpm
fi
set -e
# =============================================
# Check out rpm packaging repo
rm -rf xenserver-nova-suppack-builder
@ -65,14 +74,15 @@ git clone "$NOVA_GITREPO" nova
cd nova
git checkout -b mos_nova "$GITBRANCH"
# patch xenhost as this file is not merged into this release
cp $DEPLOYMENT_SCRIPT_ROOT/patchset/xenhost plugins/xenserver/xenapi/etc/xapi.d/plugins/
cp $FUELPLUG_UTILS_ROOT/../plugin_source/deployment_scripts/patchset/xenhost plugins/xenserver/xenapi/etc/xapi.d/plugins/
cd ..
cp -r xenserver-nova-suppack-builder/plugins/xenserver/xenapi/* nova/plugins/xenserver/xenapi/
cd nova/plugins/xenserver/xenapi/contrib
./build-rpm.sh $XS_PLUGIN_VERSION
cd $FUELPLUG_UTILS_ROOT/xenserver-suppack/
cd $FUELPLUG_UTILS_ROOT/
RPMFILE=$(find -name "openstack-xen-plugins-*.noarch.rpm" -print)
cd xenserver-suppack
# =============================================
@ -87,23 +97,17 @@ cp -r xenserver-nova-suppack-builder/neutron/* \
neutron/neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/
cd neutron/neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/contrib
./build-rpm.sh $XS_PLUGIN_VERSION
cd $FUELPLUG_UTILS_ROOT/xenserver-suppack/
cd $FUELPLUG_UTILS_ROOT/
NEUTRON_RPMFILE=$(find -name "openstack-neutron-xen-plugins-*.noarch.rpm" -print)
# =============================================
# Create Supplemental pack
rm -rf suppack
mkdir suppack
mkdir -p suppack
DDKROOT=$(mktemp -d)
wget -qO - "$DDK_ROOT_URL" | sudo tar -xzf - -C "$DDKROOT"
sudo mkdir $DDKROOT/mnt/host
sudo mount --bind $(pwd) $DDKROOT/mnt/host
sudo tee $DDKROOT/buildscript.py << EOF
tee buildscript.py << EOF
from xcp.supplementalpack import *
from optparse import OptionParser
@ -124,14 +128,10 @@ setup(originator='xcp', name='xenapi-plugins-$OS_RELEASE', product='XenServer',
outdir=options.outdir, output=['iso'])
EOF
sudo chroot $DDKROOT python buildscript.py \
python buildscript.py \
--pdn=xenserverplugins \
--pdv=$OS_RELEASE \
--bld=0 \
--out=/mnt/host/suppack \
/mnt/host/$RPMFILE \
/mnt/host/$NEUTRON_RPMFILE
# Cleanup
sudo umount $DDKROOT/mnt/host
sudo rm -rf "$DDKROOT"
--out=$FUELPLUG_UTILS_ROOT \
$FUELPLUG_UTILS_ROOT/$RPMFILE \
$FUELPLUG_UTILS_ROOT/$NEUTRON_RPMFILE