git: Sync RPM CIs with Fedora's repos (#2349)

Gets RPM builds back in sync with Fedora/EPEL and changes to mock
instead of fedpkg (slight efficiency improvement since fedpkg is a
wrapper around mock).

---------

Co-authored-by: WerWolv <werwolv98@gmail.com>
This commit is contained in:
Jonathan Wright 2025-07-23 16:49:14 -05:00 committed by GitHub
parent 851f7b4b8c
commit 295c751b60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 85 additions and 57 deletions

View File

@ -940,19 +940,15 @@ jobs:
matrix: matrix:
include: include:
- name: Fedora - name: Fedora
mock_release: rawhide
release_num: rawhide release_num: rawhide
mock_config: fedora-rawhide mock_config: fedora-rawhide
- name: Fedora - name: Fedora
mock_release: f42
release_num: 42 release_num: 42
mock_config: fedora-42 mock_config: fedora-42
- name: Fedora - name: Fedora
mock_release: f41
release_num: 41 release_num: 41
mock_config: fedora-41 mock_config: fedora-41
- name: RHEL-AlmaLinux - name: RHEL-AlmaLinux
mock_release: epel9
release_num: 9 release_num: 9
mock_config: "alma+epel-9" mock_config: "alma+epel-9"
@ -960,7 +956,7 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
container: container:
image: "almalinux:9" image: "almalinux:10"
options: --privileged --pid=host --security-opt apparmor=unconfined options: --privileged --pid=host --security-opt apparmor=unconfined
permissions: permissions:
@ -969,10 +965,10 @@ jobs:
steps: steps:
# This, together with the `--pid=host --security-opt apparmor=unconfined` docker options is required to allow # This, together with the `--pid=host --security-opt apparmor=unconfined` docker options is required to allow
# fedpkg to work inside a Docker container running on Ubuntu again. # mock to work inside a Docker container running on Ubuntu again.
# GitHub seems to have enabled AppArmor on their Ubuntu CI runners which limits Docker in ways that cause # GitHub seems to have enabled AppArmor on their Ubuntu CI runners which limits Docker in ways that cause
# programs inside it to fail. # programs inside it to fail.
# Without this, fedpkg will throw the unhelpful error message 'Insufficient Rights' # Without this, mock will throw the unhelpful error message 'Insufficient Rights'
# This step uses nsenter to execute commands on the host that disable AppArmor entirely. # This step uses nsenter to execute commands on the host that disable AppArmor entirely.
- name: 🛡️ Disable AppArmor on Host - name: 🛡️ Disable AppArmor on Host
run: | run: |
@ -995,15 +991,15 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: /var/cache/dnf path: /var/cache/dnf
key: dnf-ccache-${{ matrix.mock_release }}-${{ github.run_id }} key: dnf-ccache-${{ matrix.mock_config }}-${{ github.run_id }}
restore-keys: dnf-ccache-${{ matrix.mock_release }} restore-keys: dnf-ccache-${{ matrix.mock_config }}
- name: ⬇️ Update all packages and install dependencies - name: ⬇️ Update all packages and install dependencies
run: | run: |
set -x set -x
dnf upgrade -y dnf upgrade -y
dnf install -y \ dnf install -y \
fedpkg \ mock \
ccache ccache
- name: ⬇️ Install .NET - name: ⬇️ Install .NET
@ -1014,8 +1010,8 @@ jobs:
- name: 📜 Setup ccache - name: 📜 Setup ccache
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
with: with:
key: ${{ matrix.mock_release }}-rpm-${{ github.run_id }} key: ${{ matrix.mock_config }}-rpm-${{ github.run_id }}
restore-keys: ${{ matrix.mock_release }}-rpm restore-keys: ${{ matrix.mock_config }}-rpm
max-size: 1G max-size: 1G
- name: 📜 Set version variable - name: 📜 Set version variable
@ -1032,11 +1028,11 @@ jobs:
-e 's/IMHEX_OFFLINE_BUILD=ON/IMHEX_OFFLINE_BUILD=OFF/g' \ -e 's/IMHEX_OFFLINE_BUILD=ON/IMHEX_OFFLINE_BUILD=OFF/g' \
-e '/IMHEX_OFFLINE_BUILD=OFF/a -D IMHEX_PATTERNS_PULL_MASTER=ON \\' \ -e '/IMHEX_OFFLINE_BUILD=OFF/a -D IMHEX_PATTERNS_PULL_MASTER=ON \\' \
-e '/BuildRequires: cmake/a BuildRequires: git-core' \ -e '/BuildRequires: cmake/a BuildRequires: git-core' \
-e '/%files/a %{_datadir}/%{name}/' \ -e '/%files/a %{_datadir}/imhex/' \
$GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec
- name: 📜 Fix ccache on EL9 - name: 📜 Fix ccache on EL9
if: matrix.mock_release == 'epel9' if: matrix.mock_config == 'alma+epel-9'
run: sed -i '/\. \/opt\/rh\/gcc-toolset-14\/enable/a PATH=/usr/lib64/ccache:$PATH' $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec run: sed -i '/\. \/opt\/rh\/gcc-toolset-14\/enable/a PATH=/usr/lib64/ccache:$PATH' $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec
- name: 🟩 Copy spec file to build root - name: 🟩 Copy spec file to build root
@ -1055,11 +1051,11 @@ jobs:
# Fedora cmake build (in imhex.spec) # Fedora cmake build (in imhex.spec)
- name: 📦 Build RPM - name: 📦 Build RPM
run: | run: |
fedpkg --path $GITHUB_WORKSPACE --release ${{ matrix.mock_release }} mockbuild --enable-network -N --root $GITHUB_WORKSPACE/mock.cfg extra_args -- -v mock -r ${{ matrix.mock_config }}-x86_64 --enable-network -N -v --spec $GITHUB_WORKSPACE/imhex.spec --sources $GITHUB_WORKSPACE --resultdir $GITHUB_WORKSPACE/results
- name: 🟩 Move and rename finished RPM - name: 🟩 Move and rename finished RPM
run: | run: |
mv $GITHUB_WORKSPACE/results_imhex/${{ env.IMHEX_VERSION }}/*/imhex-${{ env.IMHEX_VERSION }}-0.*.x86_64.rpm \ mv $GITHUB_WORKSPACE/results/imhex-${{ env.IMHEX_VERSION }}-0.*.x86_64.rpm \
$GITHUB_WORKSPACE/imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm $GITHUB_WORKSPACE/imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm
- name: 🗝️ Generate build provenance attestations - name: 🗝️ Generate build provenance attestations

View File

@ -346,10 +346,6 @@ macro(createPackage)
# install AppStream file # install AppStream file
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.ImHex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.ImHex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
# install symlink for the old standard name
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.ImHex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo RENAME net.werwolv.imhex.appdata.xml)
endif() endif()
if (APPLE) if (APPLE)

110
dist/rpm/imhex.spec vendored
View File

@ -6,7 +6,7 @@ Release: 0%{?dist}
Summary: A hex editor for reverse engineers and programmers Summary: A hex editor for reverse engineers and programmers
License: GPL-2.0-only AND Zlib AND MIT AND Apache-2.0 License: GPL-2.0-only AND Zlib AND MIT AND Apache-2.0
# imhex is gplv2. capstone is custom. nativefiledialog is Zlib. # imhex is gplv2. capstone is custom.
# see license dir for full breakdown # see license dir for full breakdown
URL: https://imhex.werwolv.net/ URL: https://imhex.werwolv.net/
# We need the archive with deps bundled # We need the archive with deps bundled
@ -16,7 +16,6 @@ BuildRequires: cmake
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
BuildRequires: dbus-devel BuildRequires: dbus-devel
BuildRequires: file-devel BuildRequires: file-devel
BuildRequires: fontconfig-devel
BuildRequires: freetype-devel BuildRequires: freetype-devel
BuildRequires: fmt-devel BuildRequires: fmt-devel
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -25,33 +24,41 @@ BuildRequires: libglvnd-devel
BuildRequires: glfw-devel BuildRequires: glfw-devel
BuildRequires: json-devel BuildRequires: json-devel
BuildRequires: libcurl-devel BuildRequires: libcurl-devel
BuildRequires: llvm-devel BuildRequires: libarchive-devel
BuildRequires: mbedtls-devel
BuildRequires: yara-devel
BuildRequires: nativefiledialog-extended-devel
BuildRequires: dotnet-sdk-8.0
BuildRequires: libzstd-devel BuildRequires: libzstd-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: bzip2-devel BuildRequires: bzip2-devel
BuildRequires: xz-devel BuildRequires: xz-devel
BuildRequires: llvm-devel
BuildRequires: mbedtls-devel
BuildRequires: yara-devel
BuildRequires: nativefiledialog-extended-devel
BuildRequires: lz4-devel
BuildRequires: libssh2-devel BuildRequires: libssh2-devel
%if 0%{?rhel} %if 0%{?rhel} == 9
BuildRequires: gcc-toolset-14 BuildRequires: gcc-toolset-14
%endif %endif
%if 0%{?fedora} || 0%{?rhel} > 9
BuildRequires: capstone-devel
%endif
BuildRequires: lunasvg-devel
Provides: bundled(gnulib) Provides: bundled(gnulib)
Provides: bundled(capstone) = 5.0-rc2 %if 0%{?rhel} == 10
Provides: bundled(imgui) Provides: bundled(capstone) = 5.0.1
%endif
Provides: bundled(imgui) = 1.90.8
Provides: bundled(libromfs) Provides: bundled(libromfs)
Provides: bundled(microtar) Provides: bundled(microtar)
Provides: bundled(libpl) = %{version}
Provides: bundled(xdgpp) Provides: bundled(xdgpp)
# working on packaging this, bundling for now as to now delay updates
Provides: bundled(miniaudio) = 0.11.11
# ftbfs on these arches. armv7hl might compile when capstone 5.x
# is released upstream and we can build against it
# [7:02 PM] WerWolv: We're not supporting 32 bit anyways soooo # [7:02 PM] WerWolv: We're not supporting 32 bit anyways soooo
# [11:38 AM] WerWolv: Officially supported are x86_64 and aarch64 # [11:38 AM] WerWolv: Officially supported are x86_64 and aarch64
ExclusiveArch: x86_64 %{arm64} ppc64le ExclusiveArch: x86_64 %{arm64}
%description %description
ImHex is a Hex Editor, a tool to display, decode and analyze binary data to ImHex is a Hex Editor, a tool to display, decode and analyze binary data to
@ -65,16 +72,33 @@ displayed, a disassembler, diffing support, bookmarks and much much more. At the
same time ImHex is completely free and open source under the GPLv2 language. same time ImHex is completely free and open source under the GPLv2 language.
%package devel
Summary: Development files for %{name}
License: GPL-2.0-only
%description devel
%{summary}
%prep %prep
%autosetup -n ImHex %autosetup -n ImHex -p1
# remove bundled libs we aren't using # remove bundled libs we aren't using
rm -rf lib/third_party/{fmt,nlohmann_json,yara} rm -rf lib/third_party/{curl,fmt,llvm,nlohmann_json,yara}
%if 0%{?fedora} || 0%{?rhel} > 9
rm -rf lib/third_party/capstone
%endif
# rhel 9 doesn't support all of the new appstream metainfo tags
%if 0%{?rhel} && 0%{?rhel} < 10
sed -i -e '/url type="vcs-browser"/d' \
-e '/url type="contribute"/d' \
dist/net.werwolv.ImHex.metainfo.xml
%endif
%build %build
%if 0%{?rhel} %if 0%{?rhel} == 9
. /opt/rh/gcc-toolset-14/enable . /opt/rh/gcc-toolset-14/enable
%set_build_flags %set_build_flags
CXXFLAGS+=" -std=gnu++23" CXXFLAGS+=" -std=gnu++2b"
%endif %endif
%cmake \ %cmake \
-D CMAKE_BUILD_TYPE=Release \ -D CMAKE_BUILD_TYPE=Release \
@ -82,23 +106,30 @@ CXXFLAGS+=" -std=gnu++23"
-D IMHEX_OFFLINE_BUILD=ON \ -D IMHEX_OFFLINE_BUILD=ON \
-D USE_SYSTEM_NLOHMANN_JSON=ON \ -D USE_SYSTEM_NLOHMANN_JSON=ON \
-D USE_SYSTEM_FMT=ON \ -D USE_SYSTEM_FMT=ON \
-D USE_SYSTEM_CURL=ON \
-D USE_SYSTEM_LLVM=ON \
%if 0%{?fedora} || 0%{?rhel} > 9
-D USE_SYSTEM_CAPSTONE=ON \
%endif
-D USE_SYSTEM_LUNASVG=ON \
-D USE_SYSTEM_YARA=ON \ -D USE_SYSTEM_YARA=ON \
-D USE_SYSTEM_NFD=ON \ -D USE_SYSTEM_NFD=ON \
-D IMHEX_USE_GTK_FILE_PICKER=ON \ -D IMHEX_ENABLE_UNIT_TESTS=ON \
-D IMHEX_BUNDLE_DOTNET=OFF \ %if 0%{?rhel}
# when capstone >= 5.x is released we should be able to build against \ -D IMHEX_BUILD_HARDENING=OFF
# system libs of it \ %endif
# -D USE_SYSTEM_CAPSTONE=ON # disable built-in build hardening because it is already
# done in rhel buildroots. adding the flags again from
# upstream generates build errors
%cmake_build %cmake_build
%check %check
%if 0%{?rhel} # build binaries required for tests
. /opt/rh/gcc-toolset-14/enable %cmake_build --target unit_tests
%set_build_flags %ctest --exclude-regex '(Helpers/StoreAPI|Helpers/TipsAPI|Helpers/ContentAPI)'
CXXFLAGS+=" -std=gnu++23" # Helpers/*API exclude tests that require network access
%endif
%install %install
@ -106,15 +137,16 @@ CXXFLAGS+=" -std=gnu++23"
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
# this is a symlink for the old appdata name that we don't need # this is a symlink for the old appdata name that we don't need
rm -f %{buildroot}%{_metainfodir}/net.werwolv.%{name}.appdata.xml rm -f %{buildroot}%{_metainfodir}/net.werwolv.ImHex.appdata.xml
# AppData # AppData
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/net.werwolv.%{name}.metainfo.xml appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/net.werwolv.ImHex.metainfo.xml
# install licenses # install licenses
cp -a lib/third_party/nativefiledialog/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/nativefiledialog-LICENSE %if 0%{?rhel} == 9
cp -a lib/third_party/capstone/LICENSE.TXT %{buildroot}%{_datadir}/licenses/%{name}/capstone-LICENSE cp -a lib/third_party/capstone/LICENSE.TXT %{buildroot}%{_datadir}/licenses/%{name}/capstone-LICENSE
cp -a lib/third_party/capstone/suite/regress/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/capstone-regress-LICENSE cp -a lib/third_party/capstone/suite/regress/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/capstone-regress-LICENSE
%endif
cp -a lib/third_party/microtar/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/microtar-LICENSE cp -a lib/third_party/microtar/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/microtar-LICENSE
cp -a lib/third_party/xdgpp/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/xdgpp-LICENSE cp -a lib/third_party/xdgpp/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/xdgpp-LICENSE
@ -123,11 +155,15 @@ cp -a lib/third_party/xdgpp/LICENSE %{buildroot
%license %{_datadir}/licenses/%{name}/ %license %{_datadir}/licenses/%{name}/
%doc README.md %doc README.md
%{_bindir}/imhex %{_bindir}/imhex
%{_bindir}/imhex-updater %{_datadir}/pixmaps/%{name}.*
%{_datadir}/pixmaps/%{name}.svg
%{_datadir}/applications/%{name}.desktop %{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml %{_libdir}/libimhex.so.*
%{_libdir}/libimhex.so*
%{_libdir}/%{name}/ %{_libdir}/%{name}/
/usr/lib/debug/%{_libdir}/*.debug %{_metainfodir}/net.werwolv.ImHex.metainfo.xml
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml %exclude %{_bindir}/imhex-updater
%{_datadir}/mime/packages/%{name}.xml
%files devel
%{_libdir}/libimhex.so
%{_datadir}/%{name}/sdk/