use docker container for archiving
[osm/devops.git] / devops-stages / stage-archive.sh
1 #!/bin/sh
2 # Copyright 2018 Sandvine
3 # All Rights Reserved.
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 PKG_DIRECTORIES="jenkins installers systest juju-charms descriptor-packages tools"
18 MDG_NAME=osm-devops
19 DEB_INSTALL=debian/$MDG_NAME.install
20 export DEBEMAIL="mmarchetti@sandvine.com"
21 export DEBFULLNAME="Michael Marchetti"
22
23 PKG_VERSION=$(git describe --tags --abbrev=0)
24 PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
25 PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
26 if [ "$PKG_VERSION_POST" -eq 0 ]; then
27 PKG_DIR="${MDG_NAME}-${PKG_VERSION_PREFIX}"
28 else
29 PKG_DIR="${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}"
30 fi
31
32 rm -rf $PKG_DIR
33 rm -f *.orig.tar.xz
34 rm -f *.deb
35 rm -f $DEB_INSTALL
36 mkdir -p $PKG_DIR
37
38 for dir in $PKG_DIRECTORIES; do
39 ln -s $PWD/$dir $PKG_DIR/.
40 echo "$dir/* usr/share/$MDG_NAME/$dir" >> $DEB_INSTALL
41 done
42 cp -R debian $PKG_DIR/.
43
44 cd $PKG_DIR
45 dh_make -y --indep --createorig --a -c apache
46 dpkg-buildpackage -uc -us -tc -rfakeroot
47 cd -
48
49 rm -rf pool
50 rm -rf dists
51 mkdir -p pool/$MDG_NAME
52 mv *.deb pool/$MDG_NAME/