Skip to content

Commit

Permalink
Merge "Fix build of contrail-web-core and contrail-web-controller"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 23, 2015
2 parents 49b7e6a + c8eecd6 commit 2f943f2
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 93 deletions.
Expand Up @@ -26,6 +26,6 @@ script
exec start-stop-daemon --start --chuid $USER:$USER \
-d /var/lib/contrail-webui/contrail-web-core \
--pidfile /var/run/contrail-web-jobserver.pid \
--exec $COMMAND -- $OPTS
--startas /bin/bash -- -c "exec $COMMAND $OPTS"

end script
Expand Up @@ -26,6 +26,6 @@ script
exec start-stop-daemon --start --chuid $USER:$USER \
-d /var/lib/contrail-webui/contrail-web-core \
--pidfile /var/run/contrail-web-webserver.pid \
--exec $COMMAND -- $OPTS
--startas /bin/bash -- -c "exec $COMMAND $OPTS"

end script
Expand Up @@ -3,10 +3,6 @@
set -e

if [ "$1" = "configure" ]; then

sed -i -e 's/\/usr\/src\/contrail/\/var\/lib\/contrail-webui/' \
/var/lib/contrail-webui/contrail-web-controller/webroot/common/js/controller.config.global.js

# Create the "contrail" user
if ! getent passwd contrail > /dev/null 2>&1
then
Expand Down
4 changes: 2 additions & 2 deletions debian/contrail-web-controller/debian/control
Expand Up @@ -3,13 +3,13 @@ Section: web
Priority: optional
Maintainer: OpenContrail developers <dev@lists.opencontrail.org>
Uploaders: Raj Reddy <rajreddy@juniper.net>
Build-Depends: debhelper (>= 9)
Build-Depends: debhelper (>= 9), nodejs-legacy
Standards-Version: 3.9.5
Vcs-Browser: https://github.com/Juniper/contrail-web-controller
Homepage: https://github.com/Juniper/contrail-web-controller/

Package: contrail-web-controller
Architecture: amd64
Architecture: all
Depends: contrail-web-core
Recommends: redis-server
Description: OpenContrail WebUI Controller
Expand Down
46 changes: 12 additions & 34 deletions debian/contrail-web-controller/debian/rules
@@ -1,45 +1,23 @@
#!/usr/bin/make -f

SB_TOP := $(shell pwd | sed -re "s/(.*)\/build\/packages(.*)/\1/")
INSTALL_ROOT := $(shell pwd)
export REPO=${SB_TOP}/contrail-web-controller,webController

%:
dh $@

override_dh_installinit:
dh_installinit
dh_installinit --name=contrail-webui-jobserver
dh_installinit --name=contrail-webui-webserver

#BRANCH=--branch R1.06
#TAGS=tags/v1.06
SRC_PACKAGE = contrail-web-controller
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)/\3/p')
TARBALL = $(SRC_PACKAGE)_$(SRC_VERSION).orig.tar.gz
DEB_DIR := $(shell pwd)

get-orig-source:
if [ "$(BRANCH)x" != "x" ] ; then \
echo "Building $(BRANCH)... "; \
else \
echo "Building mainline... "; \
fi
rm -rf get-orig-source ../$(TARBALL)
mkdir get-orig-source
cd get-orig-source;git clone $(BRANCH) git@github.com:Juniper/contrail-webui-third-party
if [ "$(TAGS)x" != "x" ] ; then \
cd get-orig-source/contrail-webui-third-party;git checkout $(TAGS); \
fi
cd get-orig-source/contrail-webui-third-party;python ./fetch_packages.py
cd get-orig-source;git clone $(BRANCH) git@github.com:Juniper/contrail-web-core.git;
if [ "$(TAGS)x" != "x" ] ; then \
cd get-orig-source/contrail-web-core;git checkout $(TAGS); \
fi
cd get-orig-source;git clone $(BRANCH) git@github.com:Juniper/contrail-web-controller.git;
if [ "$(TAGS)x" != "x" ] ; then \
cd get-orig-source/contrail-web-controller;git checkout $(TAGS); \
fi
cd get-orig-source/contrail-web-core;make package REPO=$(DEB_DIR)/get-orig-source/contrail-web-controller,webController
GZIP=--best tar czf ../$(TARBALL) -C get-orig-source/$(SRC_PACKAGE) .
ls get-orig-source/$(SRC_PACKAGE) | xargs -n 1 -I'{}' mv get-orig-source/$(SRC_PACKAGE)/'{}' .
rm -rf get-orig-source
echo "../$(TARBALL) created"
override_dh_auto_build:
# We can't use make package directly because it tries to fetch third party
# from network which is not available during build
(cd ${SB_TOP}/contrail-web-core; \
./generate-files.sh 'prod-env' $(REPO))

.PHONY: get-orig-source
override_dh_install:
cp -r -a contrail-web-controller/webroot ${INSTALL_ROOT}
dh_install
1 change: 1 addition & 0 deletions debian/contrail-web-core/debian/contrail-web-core.links
@@ -1,2 +1,3 @@
etc/contrail/config.global.js var/lib/contrail-webui/contrail-web-core/config/config.global.js
etc/contrail/contrail-webui-userauth.js var/lib/contrail-webui/contrail-web-core/config/userAuth.js
var/lib/contrail-webui/node_modules var/lib/contrail-webui/contrail-web-core/node_modules
2 changes: 1 addition & 1 deletion debian/contrail-web-core/debian/control
Expand Up @@ -3,7 +3,7 @@ Section: web
Priority: optional
Maintainer: OpenContrail developers <dev@lists.opencontrail.org>
Uploaders: Raj Reddy <rajreddy@juniper.net>
Build-Depends: debhelper (>= 9)
Build-Depends: debhelper (>= 9), nodejs-legacy
Standards-Version: 3.9.5
Vcs-Browser: https://github.com/Juniper/contrail-web-core
Homepage: https://github.com/Juniper/contrail-web-core/
Expand Down
61 changes: 30 additions & 31 deletions debian/contrail-web-core/debian/rules
@@ -1,37 +1,36 @@
#!/usr/bin/make -f

SB_TOP := $(shell pwd | sed -re "s/(.*)\/build\/packages(.*)/\1/")
INSTALL_ROOT := $(shell pwd)
export REPO=${SB_TOP}/contrail-web-core

%:
dh $@

#BRANCH=--branch R1.06
#TAGS=tags/v1.06
SRC_PACKAGE = contrail-web-core
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)/\3/p')
TARBALL = $(SRC_PACKAGE)_$(SRC_VERSION).orig.tar.gz
DEB_DIR := $(shell pwd)

get-orig-source:
if [ "$(BRANCH)x" != "x" ] ; then \
echo "Building $(BRANCH)... "; \
else \
echo "Building mainline... "; \
fi
rm -rf get-orig-source ../$(TARBALL)
mkdir get-orig-source
cd get-orig-source;git clone $(BRANCH) git@github.com:Juniper/$(SRC_PACKAGE).git
if [ "$(TAGS)x" != "x" ] ; then \
cd get-orig-source/$(SRC_PACKAGE);git checkout $(TAGS); \
fi
cd get-orig-source;git clone $(BRANCH) git@github.com:Juniper/contrail-webui-third-party.git
if [ "$(TAGS)x" != "x" ] ; then \
cd get-orig-source/contrail-webui-third-party;git checkout $(TAGS); \
fi
cd get-orig-source/contrail-webui-third-party;python ./fetch_packages.py
cd get-orig-source/$(SRC_PACKAGE);make package REPO=$(DEB_DIR)/get-orig-source/contrail-web-core
cd get-orig-source/$(SRC_PACKAGE); rm -rf Makefile
GZIP=--best tar czf ../$(TARBALL) -C get-orig-source/$(SRC_PACKAGE) .
ls get-orig-source/$(SRC_PACKAGE) | xargs -n 1 -I'{}' mv get-orig-source/$(SRC_PACKAGE)/'{}' .
rm -rf get-orig-source
echo "../$(TARBALL) created"
override_dh_auto_build:
# We can't use make package directly because it tries to fetch third party
# from network which is not available during build
(cd ${SB_TOP}/contrail-web-core; \
rm -f webroot/html/dashboard.html; \
rm -f webroot/html/login.html; \
rm -f webroot/html/login-error.html; \
cp -a webroot/html/dashboard.tmpl webroot/html/dashboard.html; \
cp -a webroot/html/login.tmpl webroot/html/login.html; \
cp -a webroot/html/login-error.tmpl webroot/html/login-error.html; \
./generate-files.sh 'prod-env' $(REPO); \
./dev-install.sh; \
./prod-dev.sh webroot/html/dashboard.html prod_env dev_env true; \
./prod-dev.sh webroot/html/login.html prod_env dev_env true; \
./prod-dev.sh webroot/html/login-error.html prod_env dev_env true)

.PHONY: get-orig-source
override_dh_install:
cp -r -a ${SB_TOP}/contrail-web-core/Gruntfile.js ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/keys ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/package.json ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/webroot ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/jobServerStart.js ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/node_modules ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/src ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/webServerStart.js ${INSTALL_ROOT}
cp -r -a ${SB_TOP}/contrail-web-core/config ${INSTALL_ROOT}
dh_install
43 changes: 27 additions & 16 deletions packages.make
Expand Up @@ -62,35 +62,46 @@ package-contrail-webui-bundle: clean-contrail-webui-bundle debian-contrail-webui
(cd build/packages/$(PACKAGE); fakeroot debian/rules get-orig-source)
(cd build/packages/$(PACKAGE); dpkg-buildpackage -uc -us -b -rfakeroot)

package-contrail-web-core: clean-contrail-web-core debian-contrail-web-core
fetch-webui-third-party:
@echo "Fetching webui third party"
(cd contrail-webui-third-party; python fetch_packages.py -f packages.xml)
rm -rf contrail-web-core/node_modules
mkdir contrail-web-core/node_modules
cp -rf contrail-webui-third-party/node_modules/* contrail-web-core/node_modules/

package-contrail-web-core: clean-contrail-web-core debian-contrail-web-core fetch-webui-third-party
$(eval PACKAGE := $(patsubst package-%,%,$@))
@echo "Building package $(PACKAGE)"
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(CONTRAIL_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); make -f debian/rules get-orig-source)
(cd build/packages/$(PACKAGE); dpkg-buildpackage -uc -us -b -rfakeroot)
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(WEBUI_CORE_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); sed -i 's/SERIES/$(SERIES)/g' debian/changelog)
(cd build/packages/$(PACKAGE); dpkg-buildpackage -j$(JOBS) -uc -us -b -rfakeroot)

source-package-contrail-web-core: clean-contrail-web-core debian-contrail-web-core
source-package-contrail-web-core: clean-contrail-web-core debian-contrail-web-core fetch-webui-third-party
$(eval PACKAGE := $(patsubst source-package-%,%,$@))
@echo "Building source package $(PACKAGE)"
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(CONTRAIL_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(WEBUI_CORE_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); sed -i 's/SERIES/$(SERIES)/g' debian/changelog)
(cd build/packages/$(PACKAGE); make -f debian/rules get-orig-source)
(cd build/packages/$(PACKAGE); dpkg-buildpackage -S -rfakeroot $(KEYOPT))
tar zcf build/packages/$(PACKAGE)_$(WEBUI_CORE_VERSION).orig.tar.gz contrail-web-core contrail-webui-third-party
(cd build/packages/$(PACKAGE); dpkg-buildpackage -j$(JOBS) -S -rfakeroot $(KEYOPT))

source-contrail-web-controller: fetch-webui-third-party
$(eval PACKAGE := $(patsubst source-%,%,$@))
tar zcf build/packages/$(PACKAGE)_$(WEBUI_CONTROLLER_VERSION).orig.tar.gz contrail-web-controller contrail-web-core

package-contrail-web-controller: clean-contrail-web-controller debian-contrail-web-controller
package-contrail-web-controller: clean-contrail-web-controller debian-contrail-web-controller source-contrail-web-controller
$(eval PACKAGE := $(patsubst package-%,%,$@))
@echo "Building package $(PACKAGE)"
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(CONTRAIL_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); make -f debian/rules get-orig-source)
(cd build/packages/$(PACKAGE); dpkg-buildpackage -uc -us -b -rfakeroot)
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(WEBUI_CONTROLLER_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); sed -i 's/SERIES/$(SERIES)/g' debian/changelog)
tar xzf build/packages/$(PACKAGE)_$(WEBUI_CONTROLLER_VERSION).orig.tar.gz -C build/packages/$(PACKAGE)/
(cd build/packages/$(PACKAGE); dpkg-buildpackage -j$(JOBS) -uc -us -b -rfakeroot)

source-package-contrail-web-controller: clean-contrail-web-controller debian-contrail-web-controller
source-package-contrail-web-controller: clean-contrail-web-controller debian-contrail-web-controller source-contrail-web-controller
$(eval PACKAGE := $(patsubst source-package-%,%,$@))
@echo "Building source package $(PACKAGE)"
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(CONTRAIL_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); sed -i 's/VERSION/$(WEBUI_CONTROLLER_VERSION)/g' debian/changelog)
(cd build/packages/$(PACKAGE); sed -i 's/SERIES/$(SERIES)/g' debian/changelog)
(cd build/packages/$(PACKAGE); make -f debian/rules get-orig-source)
(cd build/packages/$(PACKAGE); dpkg-buildpackage -S -rfakeroot $(KEYOPT))
(cd build/packages/$(PACKAGE); dpkg-buildpackage -j$(JOBS) -S -rfakeroot $(KEYOPT))

package-contrail: debian-contrail
$(eval PACKAGE := contrail)
Expand Down
9 changes: 6 additions & 3 deletions versions.mk
Expand Up @@ -9,7 +9,8 @@ CONTRAIL_VERSION = $(VERSION)
NEUTRON_VERSION = $(VERSION)
CEILOMETER_VERSION = $(VERSION)
CONTRAIL_HEAT_VERSION = $(VERSION)
#WEBUI_VERSION = $(VERSION)
WEBUI_CORE_VERSION = $(VERSION)
WEBUI_CONTROLLER_VERSION = $(VERSION)

else
#
Expand All @@ -18,14 +19,16 @@ else
#

CONTROLLER_REF := $(shell (cd controller; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
WEBUI_CORE_REF := $(shell (cd contrail-web-core; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
WEBUI_CONTROLLER_REF := $(shell (cd contrail-web-controller; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
NEUTRON_REF := $(shell (cd openstack/neutron_plugin; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
CEILOMETER_REF := $(shell (cd openstack/ceilometer_plugin; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
CONTRAIL_HEAT_REF := $(shell (cd openstack/contrail-heat; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
#WEBUI_REF := $(shell (cd contrail-web-core; git log --oneline -1) | awk '/[0-9a-f]+/ { print $$1; }')
CONTRAIL_VERSION = 1.1master~$(CONTROLLER_REF)
WEBUI_CORE_VERSION = 1.1master~$(CONTROLLER_REF)
WEBUI_CONTROLLER_VERSION = 1.1master~$(CONTROLLER_REF)
NEUTRON_VERSION = 1.1master~$(NEUTRON_REF)
CEILOMETER_VERSION = 1.1master~$(CEILOMETER_REF)
CONTRAIL_HEAT_VERSION = 1.1master~$(CONTRAIL_HEAT_REF)
#WEBUI_VERSION = 1.1master~$(WEBUI_REF)

endif

0 comments on commit 2f943f2

Please sign in to comment.