diff --git a/.packit.sh b/.packit.sh new file mode 100644 index 00000000..3af84ee3 --- /dev/null +++ b/.packit.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# This script handles any custom processing of the spec file generated using the `post-upstream-clone` +# action and gets used by the fix-spec-file action in .packit.yaml. + +set -eo pipefail + +# Get Version from HEAD +VERSION=$(grep '^const Version' version/version.go | cut -d\" -f2 | sed -e 's/-/~/') + +# Generate source tarball +git archive --prefix=skopeo-$VERSION/ -o skopeo-$VERSION.tar.gz HEAD + +# RPM Spec modifications + +# Update Version in spec with Version from Cargo.toml +sed -i "s/^Version:.*/Version: $VERSION/" skopeo.spec + +# Update Release in spec with Packit's release envvar +sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" skopeo.spec + +# Update Source tarball name in spec +sed -i "s/^Source:.*.tar.gz/Source: skopeo-$VERSION.tar.gz/" skopeo.spec + +# Update setup macro to use the correct build dir +sed -i "s/^%setup.*/%autosetup -Sgit -n %{name}-$VERSION/" skopeo.spec diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 00000000..9c7aaabf --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,27 @@ +--- +# See the documentation for more information: +# https://packit.dev/docs/configuration/ + +# NOTE: The Packit copr_build tasks help to check if every commit builds on +# supported Fedora and CentOS Stream arches. +# They do not block the current Cirrus-based workflow. + +# Build targets can be found at: +# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/packit-builds/ + +specfile_path: skopeo.spec + +jobs: + - job: copr_build + trigger: pull_request + owner: rhcontainerbot + project: packit-builds + enable_net: true + srpm_build_deps: + - make + - rpkg + actions: + post-upstream-clone: + - "rpkg spec --outdir ./" + fix-spec-file: + - "bash .packit.sh"