Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.5 backport][CI:BUILD] Packit: add jobs for downstream Fedora package builds #18675

Merged
merged 3 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 0 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ alt_build_task:
ALT_NAME: 'Windows Cross'
- env:
ALT_NAME: 'Build Without CGO'
- env:
ALT_NAME: 'Test build podman-next Copr RPM'
- env:
ALT_NAME: 'Alt Arch. Cross'
- env:
Expand Down
25 changes: 17 additions & 8 deletions .packit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 23 additions & 3 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Build targets can be found at:
# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/packit-builds/

specfile_path: podman.spec
specfile_path: rpm/podman.spec
upstream_tag_template: v{version}

jobs:
- &copr
Expand All @@ -18,8 +19,6 @@ jobs:
- make
- rpkg
actions:
post-upstream-clone:
- "rpkg spec --outdir ./"
fix-spec-file:
- "bash .packit.sh"

Expand All @@ -30,3 +29,24 @@ jobs:
trigger: commit
branch: v4.5
project: qm

- job: propose_downstream
trigger: release
update_release: false
dist_git_branches:
- fedora-all
#TODO use the right action to update the goimports
# For whatever reason, none of the actions seem to work
#actions:
# create-patches:
# - "cd rpm && bash update-spec-provides.sh"

- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all

- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched # rawhide updates are created automatically
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ win-gvproxy: test/version/version

.PHONY: package
package: ## Build rpm packages
rpkg local
$(MAKE) -C rpm

###
### Installation targets
Expand Down
260 changes: 0 additions & 260 deletions podman.spec.rpkg

This file was deleted.

10 changes: 10 additions & 0 deletions rpm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rpm:
lsm5 marked this conversation as resolved.
Show resolved Hide resolved
$(shell /usr/bin/bash ./update-spec-version.sh)
spectool -g podman.spec
sudo dnf -y builddep podman.spec
lsm5 marked this conversation as resolved.
Show resolved Hide resolved
rpmbuild -ba \
--define '_sourcedir $(shell pwd)' \
--define '_rpmdir %{_sourcedir}/RPMS' \
--define '_srcrpmdir %{_sourcedir}/SRPMS' \
--define '_builddir %{_sourcedir}/BUILD' \
podman.spec
Loading