Change in osmo-ci[master]: OBS: add RPM spec files

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
Fri May 15 12:02:26 UTC 2020


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/18316 )


Change subject: OBS: add RPM spec files
......................................................................

OBS: add RPM spec files

Use existing osmocom-*-packages.sh scripts to add RPM spec files. Set
the same version, as in the debian .dsc files.

Related: OS#4550
Change-Id: If93b9d95e4c18cf1c29594c0802cbffaea27101c
---
M scripts/common-obs.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
3 files changed, 35 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/16/18316/1

diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 2b33039..afa5bad 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -77,3 +77,33 @@
 
 	git -C "$(dirname "$1")" commit -m "auto-commit: debian: depend on $2" .
 }
+
+# Copy a project's rpm spec file to the osc package dir, set the version/source and 'osc add' it
+# $1: oscdir (path to checked out OSC package)
+# $2: repodir (path to git repository)
+# $3: name (e.g. libosmocore)
+osmo_obs_add_rpm_spec() {
+	local oscdir="$1"
+	local repodir="$2"
+	local name="$3"
+	local spec="$repodir/contrib/$name.spec"
+	local tarball
+	local version
+
+	if ! [ -e "$spec" ]; then
+		echo "WARNING: RPM spec missing: $spec"
+		return
+	fi
+
+	cp "$spec" "$oscdir"
+
+	# Set version
+	version="$(grep "^Version: " "$oscdir"/*.dsc | cut -d: -f2 | xargs)"
+	sed -i "s/^Version:.*/Version:  $version/g" "$oscdir/$name.spec"
+
+	# Set source file
+	tarball="$(ls -1 "${name}_"*".tar."*)"
+	sed -i "s/^Source:.*/Source:  $tarball/g" "$oscdir/$name.spec"
+
+	osc add "$name.spec"
+}
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index ae57ab2..88c5094 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -119,6 +119,7 @@
     mv "$output/"*.tar* "$TOP/$PROJ/$project/"
     cd "$TOP/$PROJ"
     osc add "$project"
+    osmo_obs_add_rpm_spec "$TOP/$PROJ/$project" "$output" "$project"
   else
     cd "$TOP/$PROJ/$project"
 
@@ -128,8 +129,9 @@
       osc rm ./* || true
       mv "$output/"*.dsc .
       mv "$output/"*.tar* .
-        osc add ./*
-      fi
+      osc add ./*
+      osmo_obs_add_rpm_spec "$PWD" "$output" "$project"
+    fi
   fi
   cd "$TOP"
 }
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index 77552a6..b3f0461 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -130,6 +130,7 @@
 
   cd "$oscdir"
   osc add -- *.tar* *.dsc
+  osmo_obs_add_rpm_spec "$oscdir" "$repodir" "$name"
   osc ci -m "Snapshot $name $DT"
 }
 

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: If93b9d95e4c18cf1c29594c0802cbffaea27101c
Gerrit-Change-Number: 18316
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200515/d8c9b60e/attachment.htm>


More information about the gerrit-log mailing list