summaryrefslogtreecommitdiffstats
path: root/scripts/osmocom-latest-packages.sh
blob: e8d61a3d0048876f0e64efe6ac473152049a68b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh

# requirements
# apt install git-buildpackage osc git

set -e

# OBS project name
PROJ=network:osmocom:latest

DT=$(date +%Y%m%d)
TOP=$(pwd)

if ! which osc >/dev/null 2>/dev/null ; then
  echo "osc binary not found"
  exit 1
fi

# start with a checkout of the project
if [ -d $PROJ ]; then
	(cd $PROJ && osc up)
else
	osc co $PROJ
fi

build() {
  project=$1
  output=$2
  echo
  echo "====> Building $project"
  cd "$TOP"
  [ -d "$1" ] || git clone "git://git.osmocom.org/$1"
  cd "$1"
  git fetch
  VER=$(git tag -l --sort=v:refname | grep "^[0-9]*.[0-9]*.[0-9]*$" | tail -n 1)
  git checkout -f -B "$VER" "refs/tags/$VER"
  gbp buildpackage -d -S -uc -us "--git-export-dir=$output" "--git-debian-branch=$VER"

  if [ ! -d "$TOP/$PROJ/$1" ] ; then
    # creating a new package is different from using old ones
    mkdir "$TOP/$PROJ/$1"
    mv "$output/"*.dsc "$TOP/$PROJ/$1/"
    cd "$TOP/$PROJ"
    osc add "$1"
  else
    cd "$TOP/$PROJ/$1"

    # update OBS only if the filename doesn't match
    file=$(cd "$output/" ; ls ./*.dsc)
    if [ ! -e "$file" ] ; then
      osc rm ./* || true
      mv "$output/"*.dsc .
      mv "$output/"*.tar* .
        osc add ./*
      fi
  fi
  cd "$TOP"
}

PACKAGES="
	libosmocore
	libosmo-sccp
	libosmo-abis
	libosmo-netif
	libsmpp34
	libasn1c
	libgtpnl
	libusrp
	osmo-iuh
	osmo-ggsn
	osmo-sgsn
	openbsc
	osmo-pcap
	osmo-trx
	osmo-sip-connector
	osmo-bts
	osmo-pcu
	osmo-hlr
	osmo-mgw
	osmo-msc
	osmo-bsc
	"
# add those two once they have tagged any versions that include the 'debian' sub-dir
	#rtl-sdr
	#osmo-fl2k

[ -d "$TOP/debsrc" ] && rm -rf "$TOP/debsrc"
mkdir "$TOP/debsrc"

for p in $PACKAGES; do
	build "$p" "$TOP/debsrc/$p"
done

cd "$TOP/$PROJ"
osc ci -m "Latest Tagged versions of $DT"