scripts/common-obs.sh: move osmo_obs_checkout_copy

Refactor checkout_copy_debian8_jessie from osmocom-latest-packages.sh
and osmocom-nightly-packages.sh to take the distribution name as
argument and merge both to osmo_obs_checkout_copy in common-obs.sh.

Use debian8 as distribution name instead of debian8-jessie, so the
distribution name matches the suffix of the patch file
(build-for-debian8.patch).

A follow-up commit will apply a debian10 specific patch with this new
function.

Related: OS#4562
Change-Id: I2b69571ebc08a920c9147ce544fa8a2e6d950e65
This commit is contained in:
Oliver Smith 2020-05-22 10:06:18 +02:00
parent eb33aa7f63
commit b6965f877c
3 changed files with 49 additions and 34 deletions

View File

@ -120,3 +120,44 @@ osmo_obs_add_rpm_spec() {
osc add "$name.spec"
}
# Copy an already checked out repository dir and apply a distribution specific patch.
# $PWD must be where all repositories are checked out in subdirs.
# $1: distribution name (e.g. "debian8")
# $2: Osmocom repository (e.g. "osmo-trx")
osmo_obs_checkout_copy() {
local distro="$1"
local repo="$2"
echo
echo "====> Checking out $repo-$distro"
# Verify distro name for consistency
local distros="
debian8
"
local found=0
local distro_i
for distro_i in $distros; do
if [ "$distro_i" = "$distro" ]; then
found=1
break
fi
done
if [ "$found" -eq 0 ]; then
echo "ERROR: invalid distro name: $distro, should be one of: $distros"
exit 1
fi
# Copy
if [ -d "$repo-$distro" ]; then
rm -rf "$repo-$distro"
fi
cp -a "$repo" "$repo-$distro"
cd "$repo-$distro"
# Commit patch
patch -p1 < "debian/patches/build-for-$distro.patch"
git commit --amend --no-edit debian/
cd ..
}

View File

@ -63,22 +63,6 @@ checkout() {
fi
}
# Copy an already checked out repository dir and apply its debian 8 patch.
# $1: Osmocom repository
checkout_copy_debian8_jessie() {
echo
echo "====> Checking out $1-debian8-jessie"
cd "$TOP"
if [ -d "$1-debian8-jessie" ]; then
rm -rf "$1-debian8-jessie"
fi
cp -a "$1" "$1-debian8-jessie"
cd "$1-debian8-jessie"
patch -p1 < debian/patches/build-for-debian8.patch
git commit --amend --no-edit debian/
cd ..
}
build() {
project=$1
gitbpargs="$2"
@ -170,12 +154,13 @@ build_osmocom() {
checkout neocon https://github.com/laf0rge/neocon
checkout osmo-uecups
checkout_copy_debian8_jessie "osmo-gsm-manuals"
cd "$TOP"
osmo_obs_checkout_copy debian8 osmo-gsm-manuals
build osmocom-latest
build limesuite --git-upstream-tree="$(get_last_tag limesuite)"
build osmo-gsm-manuals
build osmo-gsm-manuals-debian8-jessie
build osmo-gsm-manuals-debian8
build libosmocore
build libosmo-sccp
build libosmo-abis

View File

@ -164,18 +164,6 @@ checkout_open5gs() {
meson subprojects download freeDiameter
}
# Copy an already checked out repository dir and apply its debian 8 patch.
# $1: Osmocom repository
checkout_copy_debian8_jessie() {
cd "$REPO"
cp -a "$1" "$1-debian8-jessie"
cd "$1-debian8-jessie"
patch -p1 < debian/patches/build-for-debian8.patch
git commit -m 'auto-commit: allow debian8 to build' debian/
cd ..
}
build_osmocom() {
DATA=$TOP/data
REPO=$TOP/repo
@ -223,13 +211,14 @@ build_osmocom() {
checkout neocon https://github.com/laf0rge/neocon
checkout osmo-uecups
checkout_copy_debian8_jessie "osmo-gsm-manuals"
checkout_copy_debian8_jessie "osmo-trx"
cd "$REPO"
osmo_obs_checkout_copy debian8 osmo-gsm-manuals
osmo_obs_checkout_copy debian8 osmo-trx
build osmocom-nightly
build limesuite no_commit --git-upstream-tree="$(get_last_tag limesuite)"
build osmo-gsm-manuals
build osmo-gsm-manuals-debian8-jessie
build osmo-gsm-manuals-debian8
build libosmocore
build libosmo-sccp
build libosmo-abis
@ -244,7 +233,7 @@ build_osmocom() {
build openbsc
build osmo-pcap
build osmo-trx
build osmo-trx-debian8-jessie
build osmo-trx-debian8
build osmo-sip-connector
build osmo-bts
build osmo-pcu