You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/02/27 10:28:51 UTC
[cloudstack-primate] 02/02: packaging: add deb,
rpm packaging support
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
commit 261a2bec411cb31f2d9f7c88ca1eed3e0978846b
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Thu Feb 27 15:38:23 2020 +0530
packaging: add deb, rpm packaging support
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
packaging/centos/primate.spec | 85 +++++++++++++++++++++++++++++
packaging/debian/changelog | 5 ++
packaging/debian/cloudstack-primate.install | 18 ++++++
packaging/debian/compat | 1 +
packaging/debian/control | 13 +++++
packaging/debian/copyright | 16 ++++++
packaging/debian/rules | 58 ++++++++++++++++++++
packaging/package.sh | 74 +++++++++++++++++++++++++
8 files changed, 270 insertions(+)
diff --git a/packaging/centos/primate.spec b/packaging/centos/primate.spec
new file mode 100644
index 0000000..a49f211
--- /dev/null
+++ b/packaging/centos/primate.spec
@@ -0,0 +1,85 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+%define __os_install_post %{nil}
+%global debug_package %{nil}
+
+Name: cloudstack
+Summary: Modern Apache CloudStack UI - Primate
+Release: %{_rel}
+Version: %{_ver}
+License: Apache License, Version 2
+Vendor: Apache CloudStack <de...@cloudstack.apache.org>
+Packager: Apache CloudStack <de...@cloudstack.apache.org>
+Group: System Environment/Libraries
+Source0: primate-%{_ver}.tgz
+BuildRoot: %{_tmppath}/%{name}-%{release}-build
+
+%description
+Modern Apache CloudStack UI - Primate
+
+%package primate
+Summary: Modern Apache CloudStack UI - Primate
+Requires: cloudstack-management >= 4.13.0
+Group: System Environment/Libraries
+%description primate
+Primate - modern role-base progressive UI for Apache CloudStack
+
+%prep
+echo "Starting Primate build..."
+
+%setup -q -n %{name}
+
+%build
+
+echo "Executing npm build..."
+npm install
+npm run build
+
+%install
+echo "Installing Primate"
+ls -lahi
+[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT}
+mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/cloudstack-management/webapp/primate
+mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cloudstack/primate
+mkdir -p ${RPM_BUILD_ROOT}%{_bindir}/
+
+ls
+cp -vr dist/* ${RPM_BUILD_ROOT}%{_datadir}/cloudstack-management/webapp/primate/
+# copy config to ${RPM_BUILD_ROOT}%{_sysconfdir}/cloudstack/primate
+
+%clean
+[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT}
+
+%preun primate
+echo "Running through the pre-uninstall cloudstack-primate"
+
+%pre primate
+echo "Running through pre-install cloudstack-primate"
+
+%post primate
+echo "Running through post-install cloudstack-primate"
+
+%postun primate
+echo "Running through the post-uninstall cloudstack-primate"
+
+%files primate
+%defattr(-,root,root,-)
+%{_datadir}/cloudstack-management/webapp/primate/*
+%changelog
+* Thu Feb 27 2020 Rohit Yadav <ro...@apache.org> 0.1.0
+- CloudStack Primate RPM
diff --git a/packaging/debian/changelog b/packaging/debian/changelog
new file mode 100644
index 0000000..f423ac3
--- /dev/null
+++ b/packaging/debian/changelog
@@ -0,0 +1,5 @@
+cloudstack-primate (VERSION) unstable; urgency=low
+
+ * CloudStack Primate technical preview version 0.1.0
+
+ -- Rohit Yadav <ro...@apache.org> Thu, 27 Feb 2020 12:00:00 +0530
diff --git a/packaging/debian/cloudstack-primate.install b/packaging/debian/cloudstack-primate.install
new file mode 100644
index 0000000..34d9bcd
--- /dev/null
+++ b/packaging/debian/cloudstack-primate.install
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+/usr/share/cloudstack-management/webapp/primate/*
diff --git a/packaging/debian/compat b/packaging/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/packaging/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/packaging/debian/control b/packaging/debian/control
new file mode 100644
index 0000000..26effef
--- /dev/null
+++ b/packaging/debian/control
@@ -0,0 +1,13 @@
+Source: cloudstack-primate
+Section: libs
+Priority: extra
+Maintainer: Apache CloudStack <de...@cloudstack.apache.org>
+Build-Depends: debhelper (>= 7), npm, nodejs
+Standards-Version: 3.8.1
+Homepage: https://cloudstack.apache.org/
+
+Package: cloudstack-primate
+Architecture: all
+Depends: cloudstack-management (>= 4.13.0)
+Description: CloudStack Primate
+ The modern CloudStack UI - Primate
diff --git a/packaging/debian/copyright b/packaging/debian/copyright
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/packaging/debian/copyright
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
diff --git a/packaging/debian/rules b/packaging/debian/rules
new file mode 100755
index 0000000..92e336c
--- /dev/null
+++ b/packaging/debian/rules
@@ -0,0 +1,58 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+DEBVERS := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
+PACKAGE = $(shell dh_listpackages|head -n 1|cut -d '-' -f 1)
+CLOUDSTACK = "cloudstack"
+SYSCONFDIR = "/etc"
+USRBINDIR = "/usr/bin"
+DESTDIR = "debian/tmp"
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+
+build: build-indep
+
+build-indep: build-indep-stamp
+
+build-indep-stamp: configure
+ cd .. && npm install && npm run build
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-arch-stamp build-indep-stamp
+ dh_clean
+
+install:
+ dh_testdir
+ dh_testroot
+ dh_prep -s
+
+ # cloudstack-primate
+ mkdir -p $(DESTDIR)/usr/share/$(CLOUDSTACK)-management/webapp/primate
+ cp -vr ../dist/* $(DESTDIR)/usr/share/$(CLOUDSTACK)-management/webapp/primate/
+
+ dh_installdirs
+ dh_install
+
+binary: install
+ dh_install
+ dh_installchangelogs
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
diff --git a/packaging/package.sh b/packaging/package.sh
new file mode 100644
index 0000000..c26d3b0
--- /dev/null
+++ b/packaging/package.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+set -x
+
+ROOT=$PWD
+
+function package_deb() {
+ VERSION=$(cd ../; grep --color=none \"version\" package.json | cut -d '"' -f4)
+ DATE=$(date +"%Y%m%d")
+ sed -i "s/VERSION/$VERSION-$DATE/g" debian/changelog
+ dpkg-buildpackage -uc -us
+}
+
+function package_rpm() {
+ CWD=`pwd`
+ RPMDIR=$CWD/../build
+
+ VERSION=$(cd ../; grep --color=none \"version\" package.json | cut -d '"' -f4)
+ REALVER=`echo $VERSION`
+ DEFVER="-D_ver $REALVER"
+ DEFREL="-D_rel $(date +"%Y%m%d")"
+
+ echo Preparing to package CloudStack Primate ${VERSION}
+
+ mkdir -p $RPMDIR/SPECS
+ mkdir -p $RPMDIR/BUILD
+ mkdir -p $RPMDIR/RPMS
+ mkdir -p $RPMDIR/SRPMS
+ mkdir -p $RPMDIR/SOURCES/cloudstack
+
+ echo ". preparing source tarball"
+ (cd ../; tar -c --exclude .git --exclude build . | tar -C $RPMDIR/SOURCES/cloudstack -x )
+ (cd $RPMDIR/SOURCES/; tar -czf primate-$VERSION.tgz cloudstack)
+
+ echo ". executing rpmbuild"
+ cp centos/primate.spec $RPMDIR/SPECS
+
+ (cd $RPMDIR; rpmbuild --define "_topdir $RPMDIR" "${DEFVER}" "${DEFREL}" ${DEFPRE+"${DEFPRE}"} -bb SPECS/primate.spec)
+
+ if [ $? -ne 0 ]; then
+ echo "RPM Build Failed "
+ exit 1
+ else
+ echo "RPM Build Done"
+ fi
+ exit
+}
+
+case "$1" in
+ deb ) package_deb
+ ;;
+ rpm ) package_rpm
+ ;;
+ * ) package_rpm
+ package_deb
+ ;;
+esac