| Felipe Vicens | 4cc047e | 2020-06-24 15:55:57 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Copyright 2020 ETSI |
| 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 | |
| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 18 | PKG_DIRECTORIES="robot-systest conformance-tests cloud-scripts" |
| beierlm | a1f627a | 2021-03-23 16:04:34 -0400 | [diff] [blame] | 19 | PKG_FILES="CONTRIBUTING.md LICENSE README.md charm.sh requirements.txt" |
| Felipe Vicens | 4cc047e | 2020-06-24 15:55:57 +0200 | [diff] [blame] | 20 | MDG_NAME=tests |
| 21 | DEB_INSTALL=debian/osm-${MDG_NAME}.install |
| 22 | export DEBEMAIL="gerardo.garciadeblas@telefonica.com" |
| 23 | export DEBFULLNAME="Gerardo Garcia" |
| 24 | |
| 25 | PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0) |
| 26 | PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g') |
| 27 | PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l) |
| 28 | PKG_VERSION_HASH=$(git describe --match "v*" --tags | awk '{print $3}' FS=-) |
| 29 | if [ "$PKG_VERSION_POST" -eq 0 ]; then |
| 30 | PKG_DIR="deb_dist/osm-${MDG_NAME}-${PKG_VERSION_PREFIX}" |
| 31 | else |
| 32 | PKG_DIR="deb_dist/osm-${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}+${PKG_VERSION_HASH}" |
| 33 | fi |
| 34 | |
| 35 | rm -rf $PKG_DIR |
| 36 | rm -f *.orig.tar.xz |
| 37 | rm -f *.deb |
| 38 | rm -f $DEB_INSTALL |
| beierlm | fc82df5 | 2020-07-17 15:03:15 -0400 | [diff] [blame] | 39 | rm -rf deb_dist/* |
| Felipe Vicens | 4cc047e | 2020-06-24 15:55:57 +0200 | [diff] [blame] | 40 | mkdir -p $PKG_DIR |
| 41 | |
| 42 | for dir in $PKG_DIRECTORIES; do |
| 43 | ln -s $PWD/$dir $PKG_DIR/. |
| 44 | echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL |
| 45 | done |
| 46 | for f in $PKG_FILES; do |
| 47 | cp $f $PKG_DIR/. |
| 48 | echo "$f usr/share/osm-$MDG_NAME" >> $DEB_INSTALL |
| 49 | done |
| 50 | cp -R debian $PKG_DIR/. |
| 51 | |
| 52 | pushd $PKG_DIR |
| 53 | dh_make -y --indep --createorig --a -c apache |
| 54 | dpkg-buildpackage -uc -us -tc -rfakeroot |
| beierlm | 5365350 | 2020-07-17 13:29:45 -0400 | [diff] [blame] | 55 | RC=$? |
| Felipe Vicens | 4cc047e | 2020-06-24 15:55:57 +0200 | [diff] [blame] | 56 | popd |
| beierlm | 5365350 | 2020-07-17 13:29:45 -0400 | [diff] [blame] | 57 | exit $RC |