Skip to content

Commit

Permalink
[release-1.24] Packit: enable pre-merge copr builds
Browse files Browse the repository at this point in the history
Add el8 copr build tasks via packit to check for rpm buildability.

Signed-off-by: Lokesh Mandvekar <[email protected]>
  • Loading branch information
lsm5 committed Jan 24, 2024
1 parent a718678 commit 696a6cb
Show file tree
Hide file tree
Showing 3 changed files with 1,407 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .packit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

# This script handles any custom processing of the spec file using the `fix-spec-file`
# action in .packit.yaml. These steps only work on copr builds, not on official
# Fedora builds.

set -eox pipefail

PACKAGE=buildah

# Set path to rpm spec file
SPEC_FILE=rpm/$PACKAGE.spec

# Get Version from HEAD
VERSION=$(grep 'Version = ' define/types.go | cut -d\" -f2)

# RPM Version can't take "-"
RPM_VERSION=$(echo $VERSION | sed -e 's/-/~/')

# Generate source tarball from HEAD
git-archive-all -C $(git rev-parse --show-toplevel) --prefix=$PACKAGE-$VERSION/ rpm/$PACKAGE-$VERSION.tar.gz

# RPM Spec modifications

# 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.
sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" $SPEC_FILE

# Use above generated tarball as Source in rpm spec
sed -i "s/^Source0:.*.tar.gz/Source0: $PACKAGE-$VERSION.tar.gz/g" $SPEC_FILE

# Update setup macro to use the correct build dir
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE
24 changes: 24 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# See the documentation for more information:
# https://packit.dev/docs/configuration/

specfile_path: rpm/buildah.spec

srpm_build_deps:
- make
- git-archive-all

actions:
fix-spec-file:
- "bash .packit.sh"

jobs:
- job: copr_build
trigger: pull_request
notifications:
failure_comment:
message: "Ephemeral COPR build failed. @containers/packit-build please check."
enable_net: true
targets:
- epel-8-x86_64
- epel-8-aarch64
Loading

0 comments on commit 696a6cb

Please sign in to comment.