From bfea6499a3c96a7db62d72a9d2bee60967d59961 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 11 Apr 2019 14:48:17 +0200 Subject: nightly-packages: Move some code and rename some vars to look similar to latest-packages Change-Id: I177bb7fb75e293ef665e95363a38c6b4f8e49c13 --- scripts/osmocom-latest-packages.sh | 1 + scripts/osmocom-nightly-packages.sh | 52 +++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh index d647d32..e70dd92 100755 --- a/scripts/osmocom-latest-packages.sh +++ b/scripts/osmocom-latest-packages.sh @@ -18,6 +18,7 @@ if ! which osc >/dev/null 2>/dev/null ; then exit 1 fi +### OBS build prepare() { # start with a checkout of the project if [ -d $PROJ ]; then diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh index 26b8bc9..e9cc778 100755 --- a/scripts/osmocom-nightly-packages.sh +++ b/scripts/osmocom-nightly-packages.sh @@ -1,33 +1,21 @@ #!/bin/bash + # requirements # apt install devscripts git-buildpackage osc git set -e set -x +# OBS project name +PROJ=network:osmocom:nightly + +DT=$(date +%Y%m%d) +TOP=$(pwd)/$(mktemp -d nightly-3g_XXXXXX) + if ! which osc >/dev/null 2>/dev/null ; then echo "osc binary not found" exit 1 fi -DT=$(date +%Y%m%d) -PROJ=network:osmocom:nightly - -### common -checkout() { - local name=$1 - local branch=$2 - local url="https://git.osmocom.org" - - cd "$REPO" - - if [ -n "$branch" ] ; then - git clone "$url/$name" -b "$branch" - else - git clone "$url/$name" - fi - - cd - -} ### OBS build prepare() { @@ -56,6 +44,23 @@ get_commit_version() { echo -n "$version" } +### common +checkout() { + local name=$1 + local branch=$2 + local url="https://git.osmocom.org" + + cd "$REPO" + + if [ -n "$branch" ] ; then + git clone "$url/$name" -b "$branch" + else + git clone "$url/$name" + fi + + cd - +} + build() { local name=$1 local changelog=$2 @@ -144,12 +149,11 @@ create_osmo_trx_debian8_jessie() { } build_osmocom() { - BASE=$PWD - DATA=$BASE/data - REPO=$BASE/repo + DATA=$TOP/data + REPO=$TOP/repo # rather than including a dangerous 'rm -rf *' here, lets delegate to the user: - if [ -n "$(ls)" ]; then + if [ -n "$(ls $TOP)" ]; then echo "ERROR: I need to run in an empty directory." exit 1 fi @@ -224,6 +228,4 @@ build_osmocom() { post } -TMPDIR=$(mktemp -d nightly-3g_XXXXXX) -cd "$TMPDIR" build_osmocom -- cgit v1.2.3