Skip to content

Fixes #1013: Add Packit integration to GitHub project for Fedora CI #1014

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
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
16 changes: 16 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,19 @@ files_to_sync:
upstream_package_name: skupper-router
# downstream (Fedora) RPM package name
downstream_package_name: skupper-router

jobs:

# run build/tests on some interesting architectures
- job: copr_build
trigger: pull_request
targets:
- epel-9-x86_64
- epel-9-aarch64
#- epel-9-s390x
- fedora-latest-stable-x86_64
- fedora-latest-stable-aarch64
#- fedora-latest-stable-s390x
- fedora-rawhide-x86_64
- fedora-rawhide-aarch64
#- fedora-rawhide-s390x
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ find_package(libwebsockets 4.0.1 REQUIRED)
## Optional dependencies
##

find_library(dw_lib dw DOC "libdw used to symbolize QD_MEMORY_DEBUG backtraces")
find_library(dw_lib dwxxx DOC "libdw used to symbolize QD_MEMORY_DEBUG backtraces")
find_package(libunwind)

# google benchmark tests are disabled by default
Expand Down
54 changes: 47 additions & 7 deletions packaging/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,60 @@ under the License

= Packaging

== rpm
== rpm with Packit

The `rpkg` tool expects to have a `spec.rpkg` file at the source root.
In order to build, first link the spec file to the expected location.
Install Packit CLI tool from https://packit.dev/docs/cli/#installation

https://copr.fedorainfracloud.org/[COPR] builds can use the following script,
and configure `git rpkg` in the Build dependencies field.
[source,shell script]
----
packit srpm
rpmbuild --rebuild <path to generated srpm>
----

The `packit` tool edits the `packaging/skupper-router.srpm` file.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `packit` tool edits the `packaging/skupper-router.srpm` file.
The `packit` tool edits the `packaging/skupper-router.spec` file.

There is probably some rhyme and reason to what it does, but so far it is beyond the ken of this paragraph's author.
When building, beware of accidentally committing the changes it introduces.

Packit can initiate a local RPM build.

https://copr.fedorainfracloud.org/[COPR] builds can be initiated with `packit` CLI, or using the following script in COPR Web UI.

=== Packit CLI (local build)

[source, shell script]
----
packit build
----

=== Packit CLI (remote build in copr)

NOTE: If the Packit CLI procedure fails with ERROR, try the COPR Web UI

Refer to docs for https://packit.dev/docs/cli/build/copr/[packit build in-copr] command.

1. Create `~/.config/copr` as instructed.
2. Authenticate with `fkinit` https://fedoraproject.org/wiki/Infrastructure/Kerberos#How_to_use_kerberos_auth_with_Fedora_Infrastructure[according to instructions].

Now, initiate the build

[source, shell script]
----
packit build in-copr --owner $USER --project skupper-router
----

=== COPR Web UI

* Select the `Custom` source type.
* Paste the script below in the _Script_ field.
* Specify `git packit` in the _Build dependencies_ field.
* Enter `skupper-router/prepare_sources_result` into _Result directory_ field.

[source,shell script]
----
#!/bin/bash
set -Exeuo pipefail

git clone --branch main https://github.com/skupperproject/skupper-router.git
ln -s ${PWD}/skupper-router/packaging/skupper-router.spec.rpkg ./skupper-router/
rpkg srpm --outdir ./ --spec ./skupper-router
cd skupper-router
packit prepare-sources
----
15 changes: 13 additions & 2 deletions packaging/skupper-router.spec
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ Requires: libwebsockets >= %{libwebsockets_minimum_version}
Requires: libnghttp2 >= %{libnghttp2_minimum_version}
Requires: cyrus-sasl-plain
Requires: cyrus-sasl-gssapi
%ifnarch aarch64
Requires: libunwind >= %{libunwind_minimum_version}
%endif

BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: gdb

# skupper-router requirements
BuildRequires: python3-devel >= %{python_minimum_version}
Expand All @@ -71,7 +74,6 @@ BuildRequires: python3-pip
BuildRequires: python3-rpm-macros
BuildRequires: libwebsockets-devel >= %{libwebsockets_minimum_version}
BuildRequires: libnghttp2-devel >= %{libnghttp2_minimum_version}
BuildRequires: libunwind-devel >= %{libunwind_minimum_version}
# man pages --help
BuildRequires: asciidoc
BuildRequires: python3-qpid-proton >= %{proton_minimum_version}
Expand All @@ -91,16 +93,23 @@ BuildRequires: cyrus-sasl-devel
Source0: packit-placeholder-value.tar.gz
# vendored qpid-proton
Source1: https://www.apache.org/dist/qpid/proton/%{proton_vendored_version}/qpid-proton-%{proton_vendored_version}.tar.gz
Source2: https://github.com/libunwind/libunwind/releases/download/v1.7.2/libunwind-1.7.2.tar.gz

%description
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.

%prep
%setup -T -b 0 -q -n skupper-router
%setup -q -D -b 1 -n qpid-proton-%{proton_vendored_version}
%setup -q -D -b 2 -n libunwind-1.7.2

%build
%set_build_flags

cd %{_builddir}/libunwind-1.7.2
./configure --prefix=%{_builddir}/libunwind-install CFLAGS="-O2" LDFLAGS="-latomic"
make install

cd %{_builddir}/qpid-proton-%{proton_vendored_version}
%__cmake . -B "%{__cmake_builddir}" \
-DBUILD_TOOLS=OFF \
Expand Down Expand Up @@ -136,7 +145,9 @@ cd %{_builddir}/skupper-router-%{version}
# Python 3.12 considers emtpy test suite a failure, and the following suites skip all tests due to missing reqs:
# test_stopping_broker_while_websocket_is_connected_does_not_crash (system_tests_websockets.WebsocketsConsoleTest.test_stopping_broker_while_websocket_is_connected_does_not_crash) ... skipped 'python test requirement package `websockets` is missing'
# test_grpc_01_unary (system_tests_grpc.GrpcServiceMethodsTest.test_grpc_01_unary) ... skipped 'grpcio is needed to run grpc tests'
%ctest --exclude-regex '^(system_tests_grpc|system_tests_websockets)$'
# -R cpp_unit
#gdb -quiet -iex 'set pagination off' -iex 'set debuginfod enabled on' -ex run -ex 'thread apply all bt' -ex 'quit $_exitcode' --batch --args %{__cmake_builddir}/tests/cpp/cpp_unit/cpp_unit
LD_PRELOAD=%{_builddir}/libunwind-install/lib/libunwind.so %{__cmake_builddir}/tests/cpp/cpp_unit/cpp_unit

%files
/usr/sbin/skrouterd
Expand Down