Skip to content

Commit 8bb17f7

Browse files
authored
Migrate from rpkg to packit as rpkg is not available on CentOS Stream 9 (#1120)
* use %{python3_sitelib}/ because listing individual files inside fails on CentOS/Fedora differences * build RPM on CentOS Stream 9 (build on CentOS 8 fails) * add openssl RPM dependency for running tests
1 parent 66e5d57 commit 8bb17f7

File tree

3 files changed

+73
-34
lines changed

3 files changed

+73
-34
lines changed

.github/workflows/build.yaml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ jobs:
834834
matrix:
835835
os: [ 'ubuntu-22.04' ]
836836
container: [ 'centos' ]
837-
containerTag: [ 'stream8' ]
837+
containerTag: [ 'stream9' ]
838838

839839
container:
840840
image: 'quay.io/${{ matrix.container }}/${{ matrix.container }}:${{ matrix.containerTag }}'
@@ -845,31 +845,40 @@ jobs:
845845
DNF: ${{github.workspace}}/build
846846

847847
steps:
848-
- name: Install build dependencies (1/2)
848+
849+
- name: Enable additional package repositories for CentOS 8
850+
if: ${{ matrix.container == 'centos' && matrix.containerTag == 'stream8' }}
849851
run: |
850-
dnf install -y 'dnf-command(config-manager)'
852+
dnf -y install epel-release 'dnf-command(config-manager)'
851853
dnf config-manager --set-enabled powertools
852-
dnf install --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y epel-release 'dnf-command(copr)' 'dnf-command(builddep)'
853-
dnf copr enable -y clime/rpkg-util
854-
dnf install --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y git rpkg libunwind-devel
854+
855+
- name: Enable additional package repositories for CentOS 9
856+
if: ${{ matrix.container == 'centos' && matrix.containerTag == 'stream9' }}
857+
run: |
858+
dnf -y install epel-release 'dnf-command(config-manager)'
859+
dnf config-manager --set-enabled crb
860+
861+
- name: Install packit
862+
run: |
863+
dnf install --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y epel-release
864+
dnf install --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y git packit
855865
856866
- uses: actions/checkout@v3
857867

858868
- name: Take ownership of the checkout directory (Git CVE-2022-24765)
859869
run: chown --recursive --reference=/ .
860870

861-
- name: Deploy the spec.rpkg file to /
862-
run: ln -s packaging/skupper-router.spec.rpkg ./
863-
864-
- name: Install build dependencies (2/2)
871+
- name: Install srpm build dependencies
865872
run: |
866-
rpkg spec --outdir /tmp/rpkg
867-
dnf builddep --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y /tmp/rpkg/skupper-router.spec
873+
dnf install --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y 'dnf-command(builddep)'
874+
dnf builddep --setopt=tsflags=nodocs --setopt=install_weak_deps=False -y packaging/skupper-router.spec
868875
869-
- name: Build packages
876+
- name: Build skupper-router src.rpm and the rpm packages
870877
run: |
871878
mkdir /tmp/skupper-rpms
872-
rpkg local --nocheck --outdir /tmp/skupper-rpms
879+
880+
packit srpm
881+
rpmbuild --rebuild skupper-router*.src.rpm --nocheck --define '_rpmdir /tmp/skupper-rpms' --define 'debug_package %{nil}'
873882
874883
- name: Install built packages
875884
run: |

.packit.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# See the documentation for more information:
19+
# https://packit.dev/docs/configuration/
20+
21+
# https://packit.dev/docs/configuration/#top-level-keys
22+
upstream_project_url: https://github.com/skupperproject/skupper-router
23+
issue_repository: https://github.com/skupperproject/skupper-router
24+
25+
specfile_path: packaging/skupper-router.spec
26+
27+
# add or remove files that should be synced
28+
files_to_sync:
29+
- .packit.yaml
30+
31+
# name in upstream package repository/registry (e.g. in PyPI)
32+
upstream_package_name: skupper-router
33+
# downstream (Fedora) RPM package name
34+
downstream_package_name: skupper-router

packaging/skupper-router.spec.rpkg renamed to packaging/skupper-router.spec

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919

2020
# Tutorial for .spec files is available at https://rpm-packaging-guide.github.io
2121

22-
# This .spec file uses `rpkg` (https://pagure.io/rpkg-util) to provide
22+
# This .spec file uses `packit` (https://packit.dev/docs/cli/srpm/) to provide
2323
# pleasant user experience to developers.
24-
# rpkg-util v3 is required, v2 will fail to recognize some macros in this file.
2524
#
26-
# Command Description
27-
# `rpkg srpm` Creates a *.src.rpm file in /tmp/rpkg (exact path is printed)
28-
# `rpkg local --nocheck` Builds a *.rpm for your system in /tmp/rpkg (exact path is printed)
25+
# Command Description
26+
# `packit srpm` Creates a *.src.rpm file in the local directory (exact path is printed)
27+
# `packit build locally` Builds a *.rpm for your system in the local directory (exact path is printed)
2928
#
30-
# See `man rpkg` for more commands. See `man rpkg-macros` for explanation of the triple-{ macros.
29+
# See `man packit` for more commands. See https://packit.dev/docs/actions/#fix-spec-file for explanation of "actions".
3130

3231
# not undefine, that would break COPR, https://pagure.io/rpkg-util/issue/44
3332
%define _disable_source_fetch 0
@@ -45,12 +44,11 @@
4544
%global libunwind_minimum_version 1.3.1
4645

4746
Name: skupper-router
48-
Version: {{{ git_dir_version }}}
49-
Release: 2.0.0%{?dist}
47+
Version: 2.x.y
48+
Release: 1%{?dist}
5049
Summary: The skrouterd router daemon for Skupper.io
5150
License: ASL 2.0
5251
URL: https://skupper.io
53-
VCS: {{{ git_dir_vcs }}}
5452

5553
Requires: python3
5654
Requires: skupper-router-common == %{version}
@@ -75,21 +73,22 @@ BuildRequires: asciidoc
7573
BuildRequires: python3-qpid-proton >= %{proton_minimum_version}
7674
# check ctest
7775
BuildRequires: cyrus-sasl-plain
76+
BuildRequires: openssl
7877

7978
# proton-c requirements
8079
BuildRequires: openssl-devel
8180
BuildRequires: cyrus-sasl-devel
8281

8382
# skupper-router sources
84-
Source0: {{{ git_dir_pack }}}
83+
Source0: packit-placeholder-value.tar.gz
8584
# vendored qpid-proton
8685
Source1: https://www.apache.org/dist/qpid/proton/%{proton_vendored_version}/qpid-proton-%{proton_vendored_version}.tar.gz
8786

8887
%description
8988
A lightweight message router, written in C and built on Qpid Proton, that provides flexible and scalable interconnect backend for Skupper.io Level 7 Virtual Application Network.
9089

9190
%prep
92-
{{{ git_dir_setup_macro }}}
91+
%setup -T -b 0 -q -n skupper-router
9392
%setup -q -D -b 1 -n qpid-proton-%{proton_vendored_version}
9493

9594
%build
@@ -103,12 +102,12 @@ cd %{_builddir}/qpid-proton-%{proton_vendored_version}
103102
-DBUILD_BINDINGS=OFF \
104103
-DBUILD_TLS=ON -DSSL_IMPL=openssl \
105104
-DBUILD_STATIC_LIBS=ON \
106-
-DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
105+
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
107106
-DCMAKE_INSTALL_PREFIX=%{proton_install_prefix}
108107
%__cmake --build "%{__cmake_builddir}" %{?_smp_mflags} --verbose
109108
%__cmake --install "%{__cmake_builddir}"
110109

111-
cd %{_builddir}/skupper-router
110+
cd %{_builddir}/skupper-router-%{version}
112111
%cmake \
113112
-DVERSION="%{version}" \
114113
-DPython_EXECUTABLE=%{python3} \
@@ -118,11 +117,11 @@ cd %{_builddir}/skupper-router
118117
%cmake_build --target all --target man
119118

120119
%install
121-
cd %{_builddir}/skupper-router
120+
cd %{_builddir}/skupper-router-%{version}
122121
%cmake_install
123122

124123
%check
125-
cd %{_builddir}/skupper-router
124+
cd %{_builddir}/skupper-router-%{version}
126125
%ctest
127126

128127
%files
@@ -131,10 +130,7 @@ cd %{_builddir}/skupper-router
131130
%config /etc/skupper-router/skrouterd.conf
132131
%config /etc/sasl2/skrouterd.conf
133132

134-
%{python3_sitelib}/skupper_router/
135-
%{python3_sitelib}/skupper_router_site.py
136-
%{python3_sitelib}/__pycache__/skupper_router_site.*.pyc
137-
%{python3_sitelib}/skupper_router-*.egg-info
133+
%{python3_sitelib}/
138134

139135
/usr/share/man/man5/skrouterd.conf.5.gz
140136
/usr/share/man/man8/skrouterd.8.gz
@@ -200,4 +196,4 @@ BuildArch: noarch
200196
%license /usr/share/doc/skupper-router/LICENSE
201197

202198
%changelog
203-
{{{ git_dir_changelog }}}
199+
%autochangelog

0 commit comments

Comments
 (0)