mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
packaging: add deb, rpm packaging support
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
ba4552cfa4
commit
1ea8033f29
85
ui/packaging/centos/primate.spec
Normal file
85
ui/packaging/centos/primate.spec
Normal file
@ -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 <dev@cloudstack.apache.org>
|
||||
Packager: Apache CloudStack <dev@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 <rohit@apache.org> 0.1.0
|
||||
- CloudStack Primate RPM
|
||||
5
ui/packaging/debian/changelog
Normal file
5
ui/packaging/debian/changelog
Normal file
@ -0,0 +1,5 @@
|
||||
cloudstack-primate (VERSION) unstable; urgency=low
|
||||
|
||||
* CloudStack Primate technical preview version 0.1.0
|
||||
|
||||
-- Rohit Yadav <rohit@apache.org> Thu, 27 Feb 2020 12:00:00 +0530
|
||||
18
ui/packaging/debian/cloudstack-primate.install
Normal file
18
ui/packaging/debian/cloudstack-primate.install
Normal file
@ -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/*
|
||||
1
ui/packaging/debian/compat
Normal file
1
ui/packaging/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
||||
13
ui/packaging/debian/control
Normal file
13
ui/packaging/debian/control
Normal file
@ -0,0 +1,13 @@
|
||||
Source: cloudstack-primate
|
||||
Section: libs
|
||||
Priority: extra
|
||||
Maintainer: Apache CloudStack <dev@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
|
||||
16
ui/packaging/debian/copyright
Normal file
16
ui/packaging/debian/copyright
Normal file
@ -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.
|
||||
58
ui/packaging/debian/rules
Executable file
58
ui/packaging/debian/rules
Executable file
@ -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
|
||||
74
ui/packaging/package.sh
Normal file
74
ui/packaging/package.sh
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user