Change in ...osmo-ci[master]: OBS: make nightly packages conflict with latest
laforge
gerrit-no-reply at lists.osmocom.org
Tue Jun 18 18:16:53 UTC 2019
laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ci/+/14490 )
Change subject: OBS: make nightly packages conflict with latest
......................................................................
OBS: make nightly packages conflict with latest
Add conflicting dummy packages osmocom-nightly and osmocom-latest, and
make all packages from each repository depend on the right one.
As usually, the latest packages will only get changed when a new release
appears. So the dependency will get introduced after tagging a new
release. I have tested in an own OBS namespace, that everything works as
expected.
Related: OS#2640
Change-Id: I79c45e798c10a65443b9fb9ecb54393d1918608a
---
A scripts/common-obs.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
3 files changed, 95 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved; Verified
diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
new file mode 100644
index 0000000..2b33039
--- /dev/null
+++ b/scripts/common-obs.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+# Various common code used in the OBS (opensuse build service) related osmo-ci shell scripts
+
+# Create the source for a dummy package, that conflicts with another dummy package in the current directory. Example
+# of the structure that will be generated:
+# osmocom-nightly
+# └── debian
+# ├── changelog
+# ├── compat
+# ├── control
+# ├── copyright
+# ├── rules
+# └── source
+# └── format
+# $1: name of dummy package (e.g. "osmocom-nightly")
+# $2: name of conflicting package (e.g. "osmocom-latest")
+osmo_obs_prepare_conflict() {
+ local pkgname="$1"
+ local pkgname_conflict="$2"
+ local pkgver="0.0.0"
+ local oldpwd="$PWD"
+
+ mkdir -p "$pkgname/debian/source"
+ cd "$pkgname/debian"
+
+ # Fill control, changelog, rules
+ cat << EOF > control
+Source: ${pkgname}
+Section: unknown
+Priority: optional
+Maintainer: Oliver Smith <osmith at sysmocom.de>
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.8
+
+Package: ${pkgname}
+Depends: \${misc:Depends}
+Architecture: any
+Conflicts: ${pkgname_conflict}
+Description: Dummy package, which conflicts with ${pkgname_conflict}
+EOF
+ cat << EOF > changelog
+${pkgname} (${pkgver}) unstable; urgency=medium
+
+ * Dummy package, which conflicts with ${pkgname_conflict}.
+
+ -- Oliver Smith <osmith at sysmocom.de> Thu, 13 Jun 2019 12:50:19 +0200
+EOF
+ cat << EOF > rules
+#!/usr/bin/make -f
+%:
+ dh \$@
+EOF
+
+ # Finish up debian dir
+ chmod +x rules
+ echo "9" > compat
+ echo "3.0 (native)" > source/format
+ touch copyright
+
+ # Put in git repository
+ cd ..
+ git init .
+ git add -A
+ git commit -m "auto-commit: $pkgname dummy package" || true
+ git tag -f "$pkgver"
+
+ cd "$oldpwd"
+}
+
+# Add dependency to all (sub)packages in debian/control and commit the change.
+# $1: path to debian/control file
+# $2: name of the package to depend on
+osmo_obs_add_debian_dependency() {
+ # Note: adding the comma at the end should be fine. If there is a Depends: line, it is most likely not empty. It
+ # should at least have ${misc:Depends} according to lintian.
+ sed "s/^Depends: /Depends: $2, /g" -i "$1"
+
+ git -C "$(dirname "$1")" commit -m "auto-commit: debian: depend on $2" .
+}
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index 543c43a..2a9e28d 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+. "$(dirname "$0")/common-obs.sh"
# requirements
# apt install git-buildpackage osc git
@@ -28,6 +29,9 @@
fi
[ -d "$DEBSRCDIR" ] && rm -rf "$DEBSRCDIR"
mkdir "$DEBSRCDIR"
+
+ cd "$TOP"
+ osmo_obs_prepare_conflict "osmocom-latest" "osmocom-nightly"
}
get_last_tag() {
@@ -84,6 +88,11 @@
VER=$(get_last_tag "$project")
if [ -x ./git-version-gen ]; then
./git-version-gen . > .tarball-version 2>/dev/null
+ fi
+
+ osmo_obs_add_debian_dependency "./debian/control" "osmocom-latest"
+
+ if [ -x ./git-version-gen ]; then
gbp buildpackage -S -uc -us -d --git-ignore-branch "--git-export-dir=$output" \
"--git-debian-branch=$VER" --git-ignore-new $gitbpargs \
--git-postexport='cp $GBP_GIT_DIR/../.tarball-version $GBP_TMP_DIR/'
@@ -152,6 +161,7 @@
checkout_copy_debian8_jessie "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
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index 27cd9dc..172e4e0 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+. "$(dirname "$0")/common-obs.sh"
# requirements
# apt install devscripts git-buildpackage osc git
@@ -23,6 +24,9 @@
mkdir -p "$REPO/osc/"
cd "$REPO/osc"
osc co "$PROJ"
+
+ cd "$REPO"
+ osmo_obs_prepare_conflict "osmocom-nightly" "osmocom-latest"
}
get_last_tag() {
@@ -98,6 +102,7 @@
if [ "$changelog" = "commit" ] ; then
VER=$(get_commit_version)
+ osmo_obs_add_debian_dependency "./debian/control" "osmocom-nightly"
dch -b -v "$VER" -m "Snapshot build"
git commit -m "$VER snapshot" debian/
fi
@@ -205,6 +210,7 @@
checkout_copy_debian8_jessie "osmo-gsm-manuals"
checkout_copy_debian8_jessie "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
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/14490
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I79c45e798c10a65443b9fb9ecb54393d1918608a
Gerrit-Change-Number: 14490
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190618/31a0b8c1/attachment.html>
More information about the gerrit-log
mailing list