File: update-spec-version.sh

package info (click to toggle)
podman 5.4.2%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 23,124 kB
  • sloc: sh: 6,119; perl: 2,710; python: 2,258; ansic: 1,556; makefile: 1,022; xml: 121; ruby: 42; awk: 12; csh: 8
file content (20 lines) | stat: -rw-r--r-- 777 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# This script will update the Version field in the spec which is set to 0 by
# default. Useful for local manual rpm builds where the Version needs to be set
# correctly.

set -eox pipefail

PACKAGE=podman
SPEC_FILE=$PACKAGE.spec
VERSION=$(grep '^const RawVersion' ../version/rawversion/version.go | cut -d\" -f2)
RPM_VERSION=$(echo $VERSION | sed -e 's/^v//' -e 's/-/~/g')

# Update spec file to use local changes
sed -i "s/^Version:.*/Version: $RPM_VERSION/" $SPEC_FILE
sed -i "s/^Source0:.*/Source0: $PACKAGE-$VERSION.tar.gz/" $SPEC_FILE
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE

# Generate Source0 archive from HEAD
(cd .. && git archive --format=tar.gz --prefix=$PACKAGE-$VERSION/ HEAD -o rpm/$PACKAGE-$VERSION.tar.gz)