Skip to content

Commit

Permalink
Packit: initial enablement
Browse files Browse the repository at this point in the history
This commit will run Copr builds on every PR against all active
releases of Fedora, thus allowing buildability checks before the
PR merges.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
  • Loading branch information
lsm5 committed Jul 7, 2023
1 parent 56d9d9a commit 1624a29
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 43 deletions.
43 changes: 43 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# See the documentation for more information:
# https://packit.dev/docs/configuration/

# Build targets can be found at:
# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/packit-builds/

specfile_path: rpm/crun.spec

jobs:
- &copr
job: copr_build
trigger: pull_request
owner: rhcontainerbot
project: packit-builds
enable_net: true
srpm_build_deps:
- make
actions:
post-upstream-clone:
- bash -c "git submodule update --init --recursive"

- <<: *copr
# Run on commit to main branch
trigger: commit
branch: main
project: podman-next

- job: propose_downstream
trigger: release
update_release: false
dist_git_branches:
- fedora-all

- 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 configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ AM_CONDITIONAL([LUA_BINDINGS], [test "x$with_lua_bindings" = "xyes"])
AM_CONDITIONAL([CRIU_SUPPORT], [test "x$have_criu" = "xyes"])
AM_CONDITIONAL([SHARED_LIBCRUN], [test "x$enable_shared" = "xyes"])

AC_CONFIG_FILES([Makefile rpm/crun.spec])
AC_CONFIG_FILES([Makefile])

AC_CONFIG_SUBDIRS([libocispec])
AC_OUTPUT
97 changes: 55 additions & 42 deletions rpm/crun.spec.in → rpm/crun.spec
Original file line number Diff line number Diff line change
@@ -1,64 +1,66 @@
%global krun_opts %{nil}
%global wasmedge_opts %{nil}
%global wasmtime_opts %{nil}
%global wasm_support disabled

%if 0%{?fedora} >= 37
# krun and wasm[edge,time] support only on aarch64 and x86_64
%ifarch aarch64 || x86_64
%global krun_support enabled
%global krun_opts --with-libkrun
%endif
%endif
%global wasm_support 1

%ifarch aarch64 || x86_64
%global wasm_support enabled
%global wasmedge_support enabled
# wasmedge only found on Fedora and environments with epel enabled
%if %{defined fedora} || (%{defined copr_project} && "%{copr_project}" == "podman-next")
%global wasmedge_support 1
%global wasmedge_opts --with-wasmedge
%endif

# FIXME: wasmtime builds for rhel are currently broken on copr probably
# because of an older rust compiler.
%if 0%{?fedora}
%ifnarch %{ix86} || ppc64le
%global wasm_support enabled
%global wasmtime_support enabled
# krun only exists on fedora
%if %{defined fedora}
%global krun_support 1
%global krun_opts --with-libkrun
%endif

# wasmtime exists only on podman-next copr for now
%if %{defined copr_project} && "%{?copr_project}" == "podman-next"
%global wasmtime_support 1
%global wasmtime_opts --with-wasmtime
%endif

%endif

Summary: OCI runtime written in C
Name: crun
Epoch: 101
#FIXME: copr build env replaces this with a strange version number
Epoch: 102
#Version: @RPM_VERSION@
Version: 0.0
%define build_timestamp %{lua: print(os.date("%Y%m%d%H%M%S"))}
Release: %{build_timestamp}.@GIT_COMMIT_ID@%{?dist}
# `make tarball-prep` will generate this from HEAD commit in the repo root dir
Source0: %{name}-HEAD.tar.gz
License: GPLv2+
Version: 0
Release: %autorelease
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.xz
License: GPL-2.0-only
URL: https://github.com/containers/%{name}
%if %{defined golang_arches_future}
ExclusiveArch: %{golang_arches_future}
%else
ExclusiveArch: aarch64 ppc64le s390x x86_64
%endif
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: git-core
BuildRequires: libcap-devel
%if "%{krun_support}" == "enabled"
%if %{defined krun_support}
BuildRequires: libkrun-devel
%endif
BuildRequires: systemd-devel
BuildRequires: yajl-devel
BuildRequires: libseccomp-devel
BuildRequires: python3-libmount
BuildRequires: libtool
BuildRequires: go-md2man
%if "%{wasmedge_support}" == "enabled"
BuildRequires: %{_bindir}/go-md2man
%if %{defined wasmedge_support}
BuildRequires: wasmedge-devel
%endif
%if "%{wasmtime_support}" == "enabled"
%if %{defined wasmtime_support}
BuildRequires: wasmtime-c-api-devel
%endif
%if 0%{?rhel} == 8
%if %{defined rhel} && 0%{?rhel} == 8
BuildRequires: python3
%else
BuildRequires: python
Expand All @@ -68,7 +70,7 @@ Provides: oci-runtime
%description
%{name} is a OCI runtime

%if "%{krun_support}" == "enabled"
%if %{defined krun_support}
%package krun
Summary: %{name} with libkrun support
Requires: libkrun
Expand All @@ -79,7 +81,7 @@ Provides: krun = %{epoch}:%{version}-%{release}
krun is a symlink to the %{name} binary, with libkrun as an additional dependency.
%endif

%if "%{wasm_support}" == "enabled"
%if %{defined wasm_support}
%package wasm
Summary: %{name} with wasm support
Requires: %{name} = %{epoch}:%{version}-%{release}
Expand All @@ -91,7 +93,7 @@ Recommends: wasmedge
%endif

%prep
%autosetup -Sgit -n %{name}-HEAD
%autosetup -Sgit -n %{name}-%{version}

%build
./autogen.sh
Expand All @@ -101,18 +103,18 @@ Recommends: wasmedge
%install
# FIXME: make_install no longer finds files as expected,
# so need to run install steps explicitly
#%%make_install
install -dp %{buildroot}%{_bindir}
install -Dp -m0755 %{name} %{buildroot}%{_bindir}
install -dp %{buildroot}%{_mandir}/man1
install -Dp -m0644 %{name}.1 %{buildroot}%{_mandir}/man1
rm -rf %{buildroot}%{_usr}/lib*

%if "%{krun_support}" == "enabled"
%make_install
#install -dp %%{buildroot}%%{_bindir}
#install -Dp -m0755 %%{name} %%{buildroot}%{_bindir}
#install -dp %%{buildroot}%%{_mandir}/man1
#install -Dp -m0644 %%{name}.1 %%{buildroot}%%{_mandir}/man1
#rm -rf %%{buildroot}%%{_usr}/lib*

%if %{defined krun_support}
ln -s %{_bindir}/%{name} %{buildroot}%{_bindir}/krun
%endif

%if "%{wasm_support}" == "enabled"
%if %{defined wasm_support}
ln -s %{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-wasm
%endif

Expand All @@ -121,14 +123,25 @@ ln -s %{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-wasm
%{_bindir}/%{name}
%{_mandir}/man1/*

%if "%{krun_support}" == "enabled"
%if %{defined krun_support}
%files krun
%license COPYING
%{_bindir}/krun
%endif

%if "%{wasm_support}" == "enabled"
%if %{defined wasm_support}
%files wasm
%license COPYING
%{_bindir}/%{name}-wasm
%endif

%changelog
%if %{defined autochangelog}
%autochangelog
%else
# NOTE: This changelog will be visible on CentOS 8 Stream builds
# Other envs are capable of handling autochangelog
* Tue Jun 13 2023 RH Container Bot <rhcontainerbot@fedoraproject.org>
- Placeholder changelog for envs that are not autochangelog-ready.
- Contact upstream if you need to report an issue with the build.
%endif

0 comments on commit 1624a29

Please sign in to comment.