diff options
author | Oliver Smith <osmith@sysmocom.de> | 2021-01-14 11:53:12 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2021-01-15 16:51:18 +0100 |
commit | d92c2d362d5c5c7dcf9822ca99b8e84b57a81614 (patch) | |
tree | dd76010928e56b0335649de26cd0c13b11e09ce6 | |
parent | d0ab94579bf16d69727bf2539cac691eafb2e388 (diff) |
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
-rw-r--r-- | scripts/common-obs.sh | 13 |
1 files changed, 7 insertions, 6 deletions
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 @@ osmo_obs_add_rpm_spec() { 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. |