From 1434673f8f8dc53bce5c350f04ac8df67b2ff84f Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 7 May 2020 15:05:58 +0000 Subject: [PATCH] Added files for deb package creation Change-Id: I7cd40b9696009ffd778ba69ec2e6723a7f8e32e4 Signed-off-by: garciadeblas --- build-debpkg.sh | 56 ++++++++++++++++++++++++++++++++++ debian/control | 28 +++++++++++++++++ devops-stages/stage-archive.sh | 12 +++++++- devops-stages/stage-build.sh | 3 +- devops-stages/stage-test.sh | 2 +- 5 files changed, 98 insertions(+), 3 deletions(-) create mode 100755 build-debpkg.sh create mode 100644 debian/control diff --git a/build-debpkg.sh b/build-debpkg.sh new file mode 100755 index 0000000..9a0960a --- /dev/null +++ b/build-debpkg.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Copyright 2018 Telefonica +# All Rights Reserved. +# +# Licensed 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. + + +PKG_DIRECTORIES="lib static template" +PKG_FILES="LICENSE README.md" +MDG_NAME=ngui +DEB_INSTALL=debian/osm-${MDG_NAME}.install +export DEBEMAIL="gerardo.garciadeblas@telefonica.com" +export DEBFULLNAME="Gerardo Garcia" + +PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0) +PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g') +PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l) +PKG_VERSION_HASH=$(git describe --match "v*" --tags | awk '{print $3}' FS=-) +if [ "$PKG_VERSION_POST" -eq 0 ]; then + PKG_DIR="deb_dist/osm-${MDG_NAME}-${PKG_VERSION_PREFIX}" +else + PKG_DIR="deb_dist/osm-${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}+${PKG_VERSION_HASH}" +fi + +rm -rf $PKG_DIR +rm -f *.orig.tar.xz +rm -f *.deb +rm -f $DEB_INSTALL +mkdir -p $PKG_DIR + +for dir in $PKG_DIRECTORIES; do + ln -s $PWD/$dir $PKG_DIR/. + echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL +done +for f in $PKG_FILES; do + cp $f $PKG_DIR/. + echo "$f usr/share/osm-$MDG_NAME" >> $DEB_INSTALL +done +cp -R debian $PKG_DIR/. + +pushd $PKG_DIR +dh_make -y --indep --createorig --a -c apache +dpkg-buildpackage -uc -us -tc -rfakeroot +popd + + diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..2edab50 --- /dev/null +++ b/debian/control @@ -0,0 +1,28 @@ +## +# Licensed 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. +# +# For those usages not covered by the Apache License, Version 2.0 please +# contact with: OSM_TECH@list.etsi.org +## +Source: osm-ngui +Section: devel +Priority: optional +Maintainer: Gerardo Garcia +Build-Depends: debhelper (>=9) +Standards-Version: 3.9.6 +Homepage: http://osm.etsi.org + +Package: osm-ngui +Architecture: all +Depends: ${misc:Depends} +Description: Open Source MANO Next Generation UI based on Angular diff --git a/devops-stages/stage-archive.sh b/devops-stages/stage-archive.sh index 013953f..61fd185 100755 --- a/devops-stages/stage-archive.sh +++ b/devops-stages/stage-archive.sh @@ -12,4 +12,14 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -echo "ARCHIVE" +MDG=NG-UI + +rm -rf pool +rm -rf dists +mkdir -p pool/$MDG +mv deb_dist/*.deb pool/$MDG/ + +mkdir -p dists/unstable/$MDG/binary-amd64/ +apt-ftparchive packages pool/$MDG > dists/unstable/$MDG/binary-amd64/Packages +gzip -9fk dists/unstable/$MDG/binary-amd64/Packages +echo "ARCHIVE DONE" diff --git a/devops-stages/stage-build.sh b/devops-stages/stage-build.sh index b58d1f3..d8b0ff6 100755 --- a/devops-stages/stage-build.sh +++ b/devops-stages/stage-build.sh @@ -12,4 +12,5 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -echo "BUILD" +./build-debpkg.sh +echo "BUILD DONE" diff --git a/devops-stages/stage-test.sh b/devops-stages/stage-test.sh index 337cf59..bf8b350 100755 --- a/devops-stages/stage-test.sh +++ b/devops-stages/stage-test.sh @@ -11,4 +11,4 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -echo "TEST" +echo "UNITTEST DONE" -- 2.25.1