1
0
mirror of https://github.com/containers/buildah.git synced 2026-02-05 09:45:38 +01:00
Files
buildah/rpm/update-spec-version.sh
Lokesh Mandvekar e53e50f7a1 [skip-ci] Makefile: update rpm target
rpkg is now deprecated. This commit makes the rpm target consistent with
the one in Podman.

Using skip-ci as we don't need to run cirrus tests for this change.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2024-03-13 19:36:45 +05:30

21 lines
755 B
Bash

#!/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=buildah
SPEC_FILE=$PACKAGE.spec
VERSION=$(grep 'Version = ' ../define/types.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/^Source:.*/Source: $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)