From b6965f877cbc0d88892f376d991327edceaca000 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 22 May 2020 10:06:18 +0200 Subject: 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 --- scripts/common-obs.sh | 41 +++++++++++++++++++++++++++++++++++++ scripts/osmocom-latest-packages.sh | 21 +++---------------- scripts/osmocom-nightly-packages.sh | 21 +++++-------------- 3 files changed, 49 insertions(+), 34 deletions(-) diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh index c07fbaa..3d86865 100644 --- a/scripts/common-obs.sh +++ b/scripts/common-obs.sh @@ -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 .. +} diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh index 5e35659..8bf4fb2 100755 --- a/scripts/osmocom-latest-packages.sh +++ b/scripts/osmocom-latest-packages.sh @@ -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 diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh index a79a754..ca4b253 100755 --- a/scripts/osmocom-nightly-packages.sh +++ b/scripts/osmocom-nightly-packages.sh @@ -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 -- cgit v1.2.3