File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # This script handles any custom processing of the spec file using the `fix-spec-file`
4+ # action in .packit.yaml. These steps only work on copr builds, not on official
5+ # Fedora builds.
6+
7+ set -uexo pipefail
8+
9+ PACKAGE=" containers-common"
10+ SPEC_FILE=common/rpm/" $PACKAGE " .spec
11+
12+ # Get Version from HEAD
13+ VERSION=$( grep ' ^const Version' common/version/version.go | cut -d\" -f2)
14+
15+ # RPM Version can't take "-"
16+ RPM_VERSION=" ${VERSION// -/ \~ } "
17+
18+ # Generate source tarball from HEAD
19+ git-archive-all -C " $( git rev-parse --show-toplevel) " --prefix=" $PACKAGE " -" $VERSION " / common/rpm/" $PACKAGE " -" $VERSION " .tar.gz
20+
21+ # RPM Spec modifications
22+
23+ # Use the Version from HEAD in rpm spec
24+ sed -i " s/^Version:.*/Version: $RPM_VERSION /" " $SPEC_FILE "
25+
26+ # Use Packit's supplied variable in the Release field in rpm spec.
27+ sed -i " s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE %{?dist}/" " $SPEC_FILE "
28+
29+ # Use above generated tarball as Source in rpm spec
30+ sed -i " s/^Source0:.*.tar.gz/Source0: $PACKAGE -$VERSION .tar.gz/" $SPEC_FILE
31+
32+ # Update setup macro to use the correct build dir
33+ sed -i " s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION /" " $SPEC_FILE "
Original file line number Diff line number Diff line change @@ -17,6 +17,15 @@ packages:
1717 downstream_package_name : containers-common
1818 specfile_path : common/rpm/containers-common.spec
1919
20+ srpm_build_deps :
21+ - git-archive-all
22+ - make
23+
24+ # https://packit.dev/docs/configuration/actions
25+ # fix-spec-file only operates on copr builds and doesn't affect official distro builds
26+ actions :
27+ fix-spec-file : " bash .packit-copr-rpm.sh"
28+
2029jobs :
2130 - job : copr_build
2231 trigger : pull_request
You can’t perform that action at this time.
0 commit comments