Add branding and version number templating support

Note: This changes the build method, and so the CI will be broken.  Once this
patch set is merged, the CI can be updated to store the documentation and RPM
built by the Makefile, and also updated to use the RPM from the new location

Change-Id: Ic1721f161c42fb323a7d3fd730dcff1dd76ba583
This commit is contained in:
Bob Ball 2016-07-27 16:44:29 +01:00
parent ac57c42f6a
commit 1725b5aaba
36 changed files with 86 additions and 31 deletions

5
.gitignore vendored
View File

@ -3,5 +3,6 @@
*.pyc
*.rpm
*.sublime-workspace
doc/build/*/*
!doc/build/*/*.pdf
BUILD/*
output
*~

53
Makefile Normal file
View File

@ -0,0 +1,53 @@
BRANDING=branding.inc
include ${BRANDING}
RPM_NAME=${PLUGIN_NAME}-${PLUGIN_VERSION}-${PLUGIN_VERSION}.${PLUGIN_REVISION}-1.noarch.rpm
BUILDROOT=BUILD
DOC_NAMES=user-guide test-plan test-report
.SUFFIXES:
build: rpm docs
rpm: output/${RPM_NAME}
docs: $(DOC_NAMES:%=output/${PLUGIN_NAME}-${PLUGIN_VERSION}-%.pdf)
${BUILDROOT}/${PLUGIN_NAME}: ${BRANDING}
mkdir -p ${BUILDROOT}/${PLUGIN_NAME}
cp -r plugin_source/* ${BUILDROOT}/${PLUGIN_NAME}
find ${BUILDROOT}/${PLUGIN_NAME} -type f -print0 | \
xargs -0 -i sed -i \
-e s/@HYPERVISOR_NAME@/${HYPERVISOR_NAME}/g \
-e s/@HYPERVISOR_LOWER@/${HYPERVISOR_LOWER}/g \
-e s/@PLUGIN_NAME@/${PLUGIN_NAME}/g {} \
-e s/@PLUGIN_VERSION@/${PLUGIN_VERSION}/g {} \
-e s/@PLUGIN_REVISION@/${PLUGIN_REVISION}/g {}
${BUILDROOT}/doc/source ${BUILDROOT}/doc/Makefile: ${BRANDING}
mkdir -p ${BUILDROOT}/doc
cp -r doc/Makefile doc/source ${BUILDROOT}/doc
find ${BUILDROOT}/doc -type f -print0 | \
xargs -0 -i sed -i \
-e s/@HYPERVISOR_NAME@/${HYPERVISOR_NAME}/g \
-e s/@PLUGIN_NAME@/${PLUGIN_NAME}/g {} \
-e s/@PLUGIN_VERSION@/${PLUGIN_VERSION}/g {} \
-e s/@PLUGIN_REVISION@/${PLUGIN_REVISION}/g {}
output/${RPM_NAME}: ${BUILDROOT}/${PLUGIN_NAME}
mkdir -p output
(cd ${BUILDROOT}; fpb --check ${PLUGIN_NAME})
(cd ${BUILDROOT}; fpb --build ${PLUGIN_NAME})
cp ${BUILDROOT}/${PLUGIN_NAME}/${RPM_NAME} $@
${BUILDROOT}/doc/build/latex/%.pdf: ${BUILDROOT}/doc/Makefile ${shell find ${BUILDROOT}/doc/source}
make -C ${BUILDROOT}/doc latexpdf
output/${PLUGIN_NAME}-${PLUGIN_VERSION}-%.pdf: ${BUILDROOT}/doc/build/latex/%.pdf
mkdir -p output
cp $^ $@
clean:
rm -rf ${BUILDROOT} output

View File

@ -20,5 +20,5 @@ How to build plugin
pip show fuel-plugin-builder | grep ^Version # make sure here >= 4.0.1
git clone https://git.openstack.org/openstack/fuel-plugin-xenserver
fpb --check fuel-plugin-xenserver
fpb --build fuel-plugin-xenserver
cd fuel-plugin-xenserver
make

5
branding.inc Normal file
View File

@ -0,0 +1,5 @@
HYPERVISOR_NAME=XenServer
HYPERVISOR_LOWER=xenserver
PLUGIN_NAME=fuel-plugin-xenserver
PLUGIN_VERSION=3.90
PLUGIN_REVISION=5

View File

@ -125,8 +125,6 @@ latexpdf:
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
mv $(BUILDDIR)/latex/test-plan.pdf .
mv $(BUILDDIR)/latex/test-report.pdf .
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex

Binary file not shown.

View File

@ -49,7 +49,7 @@ test_report = 'test-report'
# General information about the project.
project = u'fuel-plugin-xenserver'
copyright = u'2015, John Hua (john.hua@citrix.com)'
copyright = u'2016, John Hua (john.hua@citrix.com)'
author = u'John Hua (john.hua@citrix.com)'
# The version info for the project you're documenting, acts as replacement for
@ -57,9 +57,9 @@ author = u'John Hua (john.hua@citrix.com)'
# built documents.
#
# The short X.Y version.
version = '3.1'
version = '@PLUGIN_VERSION@'
# The full version, including alpha/beta/rc tags.
release = '3.1-3.1.2-1'
release = '@PLUGIN_VERSION@-@PLUGIN_REVISION@'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -222,11 +222,11 @@ latex_elements = {
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# Grouping the document tree into LaTeX filrm es. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'fuel-plugin-xenserver.tex', u'fuel-plugin-xenserver Documentation',
(master_doc, 'user-guide.tex', u'User Guide for XenServer Fuel Plugin',
author, 'manual'),
(test_plan, 'test-plan.tex', u'Test Plan for XenServer Fuel Plugin',
author, 'howto'),

View File

@ -9,7 +9,8 @@ Requirement Version/Comment
========================= ============================
Fuel 8.0
XenServer 6.5 SP1 + Hotfix XS65ESP1013
XenServer plugin for Fuel 3.1.2
7.0
XenServer plugin for Fuel @PLUGIN_VERSION@
========================= ============================
* This plugin will not install XenServer or configure the Virtual

View File

@ -1,6 +1,3 @@
Guide to the XenServer Plugin for Fuel 8.0
==========================================
Intro
-----

View File

@ -67,8 +67,8 @@ https://docs.mirantis.com/openstack/fuel/fuel-8.0/mos-planning-guide.html
Product compatibility matrix
----------------------------
The plugin is compatible with MOS 8.0 and XenServer 6.5 SP1, with all
hotfixes applied (Especially hotfix XS65ESP1013).
The plugin is compatible with MOS 8.0 and XenServer versions 6.5 SP1
and 7.0, with all hotfixes applied.
Prerequirements

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
- name: 'hypervisor:xen'
label: 'XenServer'
description: 'Select this option if you run OpenStack on XenServer Hypervisor'
- name: 'hypervisor:@HYPERVISOR_LOWER@'
label: '@HYPERVISOR_NAME@'
description: 'Select this option if you run OpenStack on @HYPERVISOR_NAME@ Hypervisor'
incompatible:
- name: 'hypervisor:vmware'
description: ''

View File

@ -15,12 +15,12 @@ import yaml
XS_RSA = '/root/.ssh/xs_rsa'
ASTUTE_PATH = '/etc/astute.yaml'
ASTUTE_SECTION = 'fuel-plugin-xenserver'
LOG_ROOT = '/var/log/fuel-plugin-xenserver'
ASTUTE_SECTION = '@PLUGIN_NAME@'
LOG_ROOT = '/var/log/@PLUGIN_NAME@'
LOG_FILE = 'compute_post_deployment.log'
HIMN_IP = '169.254.0.1'
INT_BRIDGE = 'br-int'
XS_PLUGIN_ISO = 'xenserverplugins-liberty.iso'
XS_PLUGIN_ISO = 'xenapi-plugins-liberty.iso'
DIST_PACKAGES_DIR = '/usr/lib/python2.7/dist-packages/'
PLATFORM_VERSION = '1.9'
@ -166,7 +166,7 @@ def init_eth():
"""Initialize the net interface connected to HIMN
Returns:
the IP addresses of local host and XenServer.
the IP addresses of local host and hypervisor.
"""
domid = execute('xenstore-read', 'domid')
@ -206,7 +206,7 @@ def init_eth():
logging.info('himn_local: %s' % himn_local)
return eth, himn_local
reportError('HIMN failed to get IP address from XenServer')
reportError('HIMN failed to get IP address from Hypervisor')
def check_host_compatibility(himn, username):

View File

@ -1,6 +1,6 @@
#!/bin/bash
LOG_ROOT="/var/log/fuel-plugin-xenserver/"
LOG_ROOT="/var/log/@PLUGIN_NAME@/"
mkdir -p $LOG_ROOT
LOG_FILE=$LOG_ROOT"controller_post_deployment.log"

View File

@ -122,7 +122,7 @@ xcp = Requires(originator='xcp', name='main', test='ge',
product='XenServer', version='$PLATFORM_VERSION',
build='$XS_BUILD')
setup(originator='xcp', name='xenserverplugins-$OS_RELEASE', product='XenServer',
setup(originator='xcp', name='xenapi-plugins-$OS_RELEASE', product='XenServer',
version=options.product_version, build=options.build, vendor='Citrix Systems, Inc.',
description="OpenStack XenServer Plugins", packages=args, requires=[xcp],
outdir=options.outdir, output=['iso'])

View File

@ -1,11 +1,11 @@
# Plugin name
name: fuel-plugin-xenserver
name: @PLUGIN_NAME@
# Human-readable name for your plugin
title: XenServer Plugin
title: @HYPERVISOR_NAME@ Plugin
# Plugin version
version: '3.90.5'
version: '@PLUGIN_VERSION@.@PLUGIN_REVISION@'
# Description
description: Enable Mirantis OpenStack to integrate with Xenserver
description: Enable Mirantis OpenStack to integrate with @HYPERVISOR_NAME@
# Required fuel version
fuel_version: ['8.0']
# Specify license of your plugin