diff options
author | Oliver Smith <osmith@sysmocom.de> | 2020-05-22 10:06:18 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2020-05-25 11:46:04 +0200 |
commit | b6965f877cbc0d88892f376d991327edceaca000 (patch) | |
tree | 34333ac1468fcc0dcb56d6c06ef8f59989ddc1f3 /scripts/common-obs.sh | |
parent | eb33aa7f63544c68421558373dcce787a714c33a (diff) |
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
Diffstat (limited to 'scripts/common-obs.sh')
-rw-r--r-- | scripts/common-obs.sh | 41 |
1 files changed, 41 insertions, 0 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 .. +} |