aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-05-13 09:55:18 +0200
committerOliver Smith <osmith@sysmocom.de>2020-05-13 15:46:50 +0200
commit3232c7102b2274afbb08b5385f43582e5a464f85 (patch)
tree5f2f8c2f6c4ae216aed9abca58b418852ce9ece1
parent5edcd058f6ae90d5e594776737f0b448b590ccc1 (diff)
OBS: add RPM spec filesosmith/rpm
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
-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..afa5bad 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 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 @@ 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 433a615..5c1bfea 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -131,6 +131,7 @@ build() {
cd "$oscdir"
osc add -- *.tar* *.dsc
+ osmo_obs_add_rpm_spec "$oscdir" "$repodir" "$name"
osc ci -m "Snapshot $name $DT"
}