Change in osmo-ci[master]: OBS: osmo_obs_add_rpm_spec: refactor

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:58 UTC 2021


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

Change subject: OBS: osmo_obs_add_rpm_spec: refactor
......................................................................

OBS: osmo_obs_add_rpm_spec: refactor

Rename $spec to $spec_in and add $spec to hold the destination path, to
avoid constructing it multiple times below.

Related: OS#4733
Change-Id: I4f3d4f8a8bc83ff22983e49f6a496dc8318b53cd
---
M scripts/common-obs.sh
1 file changed, 7 insertions(+), 6 deletions(-)

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



diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 47f3f3d..0655370 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -45,26 +45,27 @@
 	local oscdir="$1"
 	local repodir="$2"
 	local name="$3"
-	local spec="$(find "$repodir" -name "$name.spec.in")"
+	local spec_in="$(find "$repodir" -name "$name.spec.in")"
+	local spec="$oscdir/$name.spec"
 	local tarball
 	local version
 
-	if [ -z "$spec" ]; then
+	if [ -z "$spec_in" ]; then
 		echo "WARNING: RPM spec missing: $name.spec.in"
 		return
 	fi
 
-	cp "$spec" "$oscdir/$name.spec"
+	cp "$spec_in" "$spec"
 
 	# Set version
 	version="$(grep "^Version: " "$oscdir"/*.dsc | cut -d: -f2 | xargs)"
-	sed -i "s/^Version:.*/Version:  $version/g" "$oscdir/$name.spec"
+	sed -i "s/^Version:.*/Version:  $version/g" "$spec"
 
 	# Set source file
 	tarball="$(ls -1 "${name}_"*".tar."*)"
-	sed -i "s/^Source:.*/Source:  $tarball/g" "$oscdir/$name.spec"
+	sed -i "s/^Source:.*/Source:  $tarball/g" "$spec"
 
-	osc add "$name.spec"
+	osc add "$spec"
 }
 
 # Get the path to a distribution specific patch, either from osmo-ci.git or from the project repository.

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I4f3d4f8a8bc83ff22983e49f6a496dc8318b53cd
Gerrit-Change-Number: 22220
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/b4e3166a/attachment.htm>


More information about the gerrit-log mailing list