Revert "Revert "Feature 11008: Update of OSM Helm installer to latest versions""
[osm/devops.git] / devops-stages / stage-build.sh
1 #!/bin/sh
2 #
3 # Copyright ETSI
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
15 # under the License.
16
17 # Download helm chart dependencies
18 helm dependency update installers/helm/osm
19
20 PKG_DIRECTORIES="common jenkins installers tools docker"
21 MDG_NAME=devops
22 DEB_INSTALL=debian/osm-$MDG_NAME.install
23 export DEBEMAIL="OSM_TECH@LIST.ETSI.ORG"
24 export DEBFULLNAME="Open Source MANO"
25
26 PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0)
27 PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
28 PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
29 if [ "$PKG_VERSION_POST" -eq 0 ]; then
30 PKG_DIR="osm-${MDG_NAME}-${PKG_VERSION_PREFIX}"
31 else
32 PKG_DIR="osm-${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}"
33 fi
34
35 rm -rf $PKG_DIR
36 rm -f *.orig.tar.xz
37 rm -f *.deb
38 rm -f $DEB_INSTALL
39 mkdir -p $PKG_DIR
40
41 for dir in $PKG_DIRECTORIES; do
42 ln -s $PWD/$dir $PKG_DIR/.
43 echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL
44 done
45 cp LICENSE $PKG_DIR/.
46 echo "LICENSE usr/share/osm-$MDG_NAME" >> $DEB_INSTALL
47 cp -R debian $PKG_DIR/.
48
49 cd $PKG_DIR
50 dh_make -y --indep --createorig --a -c apache
51 dpkg-buildpackage -uc -us -tc -rfakeroot
52 cd -
53