Change in osmo-ci[master]: OBS: move obs_prepare_conflict to own file

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Jan 18 10:03:53 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/22213 )

Change subject: OBS: move obs_prepare_conflict to own file
......................................................................

OBS: move obs_prepare_conflict to own file

Prepare to add another function that creates similar dummy packages for
rpm (current version only works for deb).

Related: OS#4733
Change-Id: I29a5f54fe3a09610cffa0eacb5f0ad99154612f7
---
A scripts/common-obs-conflict.sh
M scripts/common-obs.sh
2 files changed, 86 insertions(+), 81 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  osmith: Verified



diff --git a/scripts/common-obs-conflict.sh b/scripts/common-obs-conflict.sh
new file mode 100644
index 0000000..a3cde36
--- /dev/null
+++ b/scripts/common-obs-conflict.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# Create conflicting dummy packages in OBS (opensuse build service), so users can't mix packages
+# built from different branches by accident
+
+# 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 packages (e.g. "osmocom-latest")
+osmo_obs_prepare_conflict() {
+	local pkgname="$1"
+	shift
+	local pkgver="0.0.0"
+	local oldpwd="$PWD"
+
+	mkdir -p "$pkgname/debian/source"
+	cd "$pkgname/debian"
+
+	# Fill control
+	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
+EOF
+	printf "Conflicts: " >> control
+	first=1
+	for i in "$@"; do
+		if [ "$first" -eq 1 ]; then
+			first=0
+		else
+			printf ", " >> control
+		fi
+		printf "%s" "$i" >> control
+	done
+	printf "\n" >> control
+	cat << EOF >> control
+Description: Dummy package, which conflicts with: $@
+EOF
+
+	# Fill changelog
+	cat << EOF > changelog
+${pkgname} (${pkgver}) unstable; urgency=medium
+
+  * Dummy package, which conflicts with: $@
+
+ -- Oliver Smith <osmith at sysmocom.de>  Thu, 13 Jun 2019 12:50:19 +0200
+EOF
+
+	# Fill rules
+	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"
+}
diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 3aa2a36..ea1c5cb 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 # Various common code used in the OBS (opensuse build service) related osmo-ci shell scripts
+. "$(dirname "$0")/common-obs-conflict.sh"
 
 osmo_cmd_require \
 	dch \
@@ -14,87 +15,6 @@
 	sed \
 	wget
 
-# 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 packages (e.g. "osmocom-latest")
-osmo_obs_prepare_conflict() {
-	local pkgname="$1"
-	shift
-	local pkgver="0.0.0"
-	local oldpwd="$PWD"
-
-	mkdir -p "$pkgname/debian/source"
-	cd "$pkgname/debian"
-
-	# Fill control
-	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
-EOF
-	printf "Conflicts: " >> control
-	first=1
-	for i in "$@"; do
-		if [ "$first" -eq 1 ]; then
-			first=0
-		else
-			printf ", " >> control
-		fi
-		printf "%s" "$i" >> control
-	done
-	printf "\n" >> control
-	cat << EOF >> control
-Description: Dummy package, which conflicts with: $@
-EOF
-
-	# Fill changelog
-	cat << EOF > changelog
-${pkgname} (${pkgver}) unstable; urgency=medium
-
-  * Dummy package, which conflicts with: $@
-
- -- Oliver Smith <osmith at sysmocom.de>  Thu, 13 Jun 2019 12:50:19 +0200
-EOF
-
-	# Fill rules
-	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

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/22213
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I29a5f54fe3a09610cffa0eacb5f0ad99154612f7
Gerrit-Change-Number: 22213
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.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/20210118/11737502/attachment.htm>


More information about the gerrit-log mailing list