Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
specfile_path: rpm/podman-bootc.spec
upstream_tag_template: v{version}

# add or remove files that should be synced
files_to_sync:
- rpm/podman-bootc.spec
- .packit.yaml

# name in upstream package repository or registry (e.g. in PyPI)
upstream_package_name: podman-bootc
# downstream (Fedora) RPM package name
downstream_package_name: podman-bootc

srpm_build_deps:
- git-archive-all
- make
- golang

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

jobs:
- job: copr_build
trigger: pull_request
enable_net: true
targets:
- fedora-all-x86_64

37 changes: 37 additions & 0 deletions rpm/packit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -eox pipefail

PACKAGE=podman-bootc

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

# Get full version from HEAD
VERSION=$(git describe --always --long --dirty)

# RPM Version can't take "-"
RPM_VERSION="${VERSION//-/\~}"

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

# Generate vendor dir
RPM_VENDOR_FILE=$PACKAGE-$VERSION-vendor.tar.gz
go mod vendor
tar -czf "rpm/$RPM_VENDOR_FILE" vendor/

# 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

# Ensure last part of the release string is the git shortcommit without a prepended "g"
sed -i "/^Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/ s/\(.*\)g/\1/" $SPEC_FILE

# Use above generated tarballs as Sources in rpm spec
sed -i "s/^Source0:.*/Source0: $RPM_SOURCE_FILE/" $SPEC_FILE
sed -i "s/^Source1:.*/Source1: $RPM_VENDOR_FILE/" $SPEC_FILE
56 changes: 56 additions & 0 deletions rpm/podman-bootc.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# https://github.com/containers/podman-bootc
%global goipath github.com/containers/podman-bootc
Version: 0.1.1

%gometa -L -f

%global golicenses LICENSE
%global godocs README.md

Name: podman-bootc
Release: %autorelease
Summary: Streamlining podman + bootc interactions

License: Apache-2.0
URL: %{gourl}
Source0: %{gosource}
Source1: vendor.tar.gz # Vendor file place holder

BuildRequires: gcc
BuildRequires: golang
BuildRequires: make
BuildRequires: libvirt-devel

Requires: xorriso
Requires: podman
Requires: qemu
Requires: libvirt

%description
%{summary}.

%gopkg

%prep
%goprep -Ak # k: keep vendor directory
%setup -T -D -a 1
%autopatch -p1

%build
export BUILDTAGS="exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote"
%gobuild -o %{gobuilddir}/bin/%%{name} %{goipath}

%install
%gopkginstall
install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%files
%license LICENSE
%doc README.md
%{_bindir}/*

%gopkgfiles

%changelog
%autochangelog