mirror of
https://github.com/containers/podman.git
synced 2025-10-25 10:16:43 +08:00
[CI:BUILD] Packit: add jobs for downstream Fedora package builds
Get rid of `podman.spec.rpkg` in favour of `rpm/podman.spec` which gets synced with fedora dist-git on every upstream release. The version in the new spec file is set to `0` by default and gets updated by packit automatically on every packit task. For local manual rpm builds using the spec, the helper script in the `rpm/` subdir will update the Version field with the latest version found in the upstream repo. Packit will automatically create a PR on fedora dist-git on every new upstream release. A sample PR will look like: https://src.fedoraproject.org/rpms/container-selinux/pull-request/10# A dry run for this can be triggered using: `$ packit propose-downstream --local-content` To run this command locally, you would need to have your packit user-configuration-file set. Ref: https://packit.dev/docs/configuration/#user-configuration-file along with a fedora api key created at: https://src.fedoraproject.org/settings#nav-api-tab with sufficient ACLs. Also includes a revised `package` Makefile target which will build rpms using `rpm/podman.spec`. Fixes: #18421. [NO NEW TESTS NEEDED] Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
25
.packit.sh
25
.packit.sh
@ -5,24 +5,33 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# Get Version from version/version.go in HEAD
|
||||
VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2 | sed -e 's/-/~/')
|
||||
# Set path to rpm spec file
|
||||
SPEC_FILE=rpm/podman.spec
|
||||
|
||||
# Get Version from HEAD
|
||||
VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2)
|
||||
|
||||
# RPM Version can't take "-"
|
||||
RPM_VERSION=$(echo $VERSION | sed -e 's/-/~/')
|
||||
|
||||
# Generate source tarball from HEAD
|
||||
git archive --prefix=podman-$VERSION/ -o podman-$VERSION.tar.gz HEAD
|
||||
|
||||
# rpmbuild expects source tarball in the same dir as spec file
|
||||
mv podman-$VERSION.tar.gz rpm/
|
||||
|
||||
# RPM Spec modifications
|
||||
|
||||
# Use the Version from version/version.go in rpm spec
|
||||
sed -i "s/^Version:.*/Version: $VERSION/" podman.spec
|
||||
# Use the Version from HEAD in rpm spec
|
||||
sed -i "s/^Version:.*/Version: $RPM_VERSION/" $SPEC_FILE
|
||||
|
||||
# Use Packit's supplied variable in the Release field in rpm spec.
|
||||
# podman.spec is generated using `rpkg spec --outdir ./` as mentioned in the
|
||||
# `post-upstream-clone` action in .packit.yaml.
|
||||
sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" podman.spec
|
||||
sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" $SPEC_FILE
|
||||
|
||||
# Use above generated tarball as Source in rpm spec
|
||||
sed -i "s/^Source:.*.tar.gz/Source: podman-$VERSION.tar.gz/" podman.spec
|
||||
sed -i "s/^Source0:.*.tar.gz/Source0: podman-$VERSION.tar.gz/" $SPEC_FILE
|
||||
|
||||
# Use the right build dir for autosetup stage in rpm spec
|
||||
sed -i "s/^%setup.*/%autosetup -Sgit -n %{name}-$VERSION/" podman.spec
|
||||
# Update setup macro to use the correct build dir
|
||||
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE
|
||||
|
||||
Reference in New Issue
Block a user