From c8eecd6689c57032afa511a907206f580ffd517d Mon Sep 17 00:00:00 2001 From: Filip Pytloun Date: Fri, 17 Jul 2015 10:38:44 +0200 Subject: [PATCH] Fix build of contrail-web-core and contrail-web-controller It was only taking webroot without fetching third party stuff so it could not ever work deployed. It was also always fetching latest source from master, ignoring current VNC checkout Closes-Bug: #1475355 Change-Id: Icebdf538e02492afc8c900b0bb16bf980d2e4f27 --- ...ontroller.contrail-webui-jobserver.upstart | 2 +- ...ontroller.contrail-webui-webserver.upstart | 2 +- .../debian/contrail-web-controller.postinst | 4 -- debian/contrail-web-controller/debian/control | 4 +- debian/contrail-web-controller/debian/rules | 46 ++++---------- .../debian/contrail-web-core.links | 1 + debian/contrail-web-core/debian/control | 2 +- debian/contrail-web-core/debian/rules | 61 +++++++++---------- packages.make | 43 ++++++++----- versions.mk | 9 ++- 10 files changed, 81 insertions(+), 93 deletions(-) diff --git a/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-jobserver.upstart b/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-jobserver.upstart index a9323a01..c7a5efd0 100644 --- a/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-jobserver.upstart +++ b/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-jobserver.upstart @@ -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 diff --git a/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-webserver.upstart b/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-webserver.upstart index c5def056..4d0fa28f 100644 --- a/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-webserver.upstart +++ b/debian/contrail-web-controller/debian/contrail-web-controller.contrail-webui-webserver.upstart @@ -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 diff --git a/debian/contrail-web-controller/debian/contrail-web-controller.postinst b/debian/contrail-web-controller/debian/contrail-web-controller.postinst index 248aaba0..81b55329 100644 --- a/debian/contrail-web-controller/debian/contrail-web-controller.postinst +++ b/debian/contrail-web-controller/debian/contrail-web-controller.postinst @@ -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 diff --git a/debian/contrail-web-controller/debian/control b/debian/contrail-web-controller/debian/control index d6a554ba..7c2bb87f 100644 --- a/debian/contrail-web-controller/debian/control +++ b/debian/contrail-web-controller/debian/control @@ -3,13 +3,13 @@ Section: web Priority: optional Maintainer: OpenContrail developers Uploaders: Raj Reddy -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 diff --git a/debian/contrail-web-controller/debian/rules b/debian/contrail-web-controller/debian/rules index e3dbaed8..d7855da7 100755 --- a/debian/contrail-web-controller/debian/rules +++ b/debian/contrail-web-controller/debian/rules @@ -1,5 +1,9 @@ #!/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 $@ @@ -7,39 +11,13 @@ 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 diff --git a/debian/contrail-web-core/debian/contrail-web-core.links b/debian/contrail-web-core/debian/contrail-web-core.links index 730db645..0b014753 100644 --- a/debian/contrail-web-core/debian/contrail-web-core.links +++ b/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 diff --git a/debian/contrail-web-core/debian/control b/debian/contrail-web-core/debian/control index ed2d8b83..d18bec9b 100644 --- a/debian/contrail-web-core/debian/control +++ b/debian/contrail-web-core/debian/control @@ -3,7 +3,7 @@ Section: web Priority: optional Maintainer: OpenContrail developers Uploaders: Raj Reddy -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/ diff --git a/debian/contrail-web-core/debian/rules b/debian/contrail-web-core/debian/rules index b76f4cec..e721beff 100755 --- a/debian/contrail-web-core/debian/rules +++ b/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 diff --git a/packages.make b/packages.make index 03d2dee8..d8f92cb4 100644 --- a/packages.make +++ b/packages.make @@ -59,35 +59,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) diff --git a/versions.mk b/versions.mk index b789a277..2b5ccd09 100644 --- a/versions.mk +++ b/versions.mk @@ -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 # @@ -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