summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-05-13 09:55:18 +0200
committerOliver Smith <osmith@sysmocom.de>2020-05-19 16:58:37 +0200
commit4f66f303075912f551fa32d6c3c188be083d201c (patch)
tree636f103a754e018d7c2a566ac6fc01c979443346
parent71cc851e35d3260a5d08083053f01f2e037c5d04 (diff)
OBS: add RPM spec files
Use existing osmocom-*-packages.sh scripts to add RPM spec.in files. Set the same version, as in the debian .dsc files. Related: OS#4550 Change-Id: If93b9d95e4c18cf1c29594c0802cbffaea27101c
-rw-r--r--scripts/common-obs.sh30
-rwxr-xr-xscripts/osmocom-latest-packages.sh6
-rwxr-xr-xscripts/osmocom-nightly-packages.sh1
3 files changed, 35 insertions, 2 deletions
diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 2b33039..5e21574 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -77,3 +77,33 @@ osmo_obs_add_debian_dependency() {
git -C "$(dirname "$1")" commit -m "auto-commit: debian: depend on $2" .
}
+
+# Copy a project's rpm spec.in 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="$(find "$repodir" -name "$name.spec.in")"
+ local tarball
+ local version
+
+ if [ -z "$spec" ]; then
+ echo "WARNING: RPM spec missing: $name.spec.in"
+ return
+ fi
+
+ cp "$spec" "$oscdir/$name.spec"
+
+ # 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 @@ build() {
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 @@ build() {
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 @@ build() {
cd "$oscdir"
osc add -- *.tar* *.dsc
+ osmo_obs_add_rpm_spec "$oscdir" "$repodir" "$name"
osc ci -m "Snapshot $name $DT"
}