From 89ec7cf7a89834a425a0e2600a78edc6e476b59d Mon Sep 17 00:00:00 2001 From: Sam Day Date: Tue, 28 Apr 2026 09:22:59 +1000 Subject: [PATCH] fedora: pre-bake vendor tarball for offline mock builds `packit build in-mock` ran `cargo vendor --locked` live during %prep, which fails because mock builds have no network. Generate the vendor tarball during Packit's SRPM source preparation, ship it as Source1, and extract it in %prep so default vendor builds work fully offline. Remote Packit source builders do not include cargo by default, so request it via srpm_build_deps and run `cargo vendor` directly instead of compiling an xtask wrapper. Use pax tar output to avoid arbitrary OpenShift UID issues. Also force gettext-sys to use the system libintl (its bundled fallback breaks on Fedora 43+) and pull in gettext-devel. Co-Authored-By: Claude Opus 4.7 (1M context) Signed-off-by: Sam Day --- .gitignore | 4 +++- .packit.yaml | 20 ++++++++++++++++---- phrog.spec | 16 ++++++++++++++-- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 15718f04..68d9157c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,7 @@ debian/phrog/ debian/phrog.substvars debian/tmp_home/ target/ +vendor/ *.tar.gz -*.src.rpm +*.rpm +*.log diff --git a/.packit.yaml b/.packit.yaml index b5a52074..6ff7d8a3 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -5,8 +5,20 @@ files_to_sync: - .packit.yaml upstream_package_name: phrog downstream_package_name: phrog +srpm_build_deps: + - cargo + +# Pre-bake the vendor tarball alongside the spec so SRPMs are self-contained +# and `mock` builds work fully offline. Used by the default (vendored) build +# path; the non-vendor path ignores Source1. +actions: + post-upstream-clone: + - cargo vendor --locked --versioned-dirs vendor + - tar -H pax --create --gzip --sort=name --owner=0 --group=0 --numeric-owner --file phrog-vendor.tar.gz vendor + jobs: - # Build PRs + # Build PRs against the non-vendor path, leaning on the gtk3-rs RPMs + # resurrected in samcday/phrog-nightly. - job: copr_build manual_trigger: true trigger: pull_request @@ -21,7 +33,8 @@ jobs: fedora-rawhide-aarch64: *opts fedora-rawhide-x86_64: *opts - # Build main commits in samcday/phrog-nightly COPR + # Build main commits in samcday/phrog-nightly COPR via the vendor path, + # mirroring what ships in Fedora dist-git. - job: copr_build trigger: commit branch: main @@ -30,9 +43,8 @@ jobs: additional_repos: - copr://samcday/phosh-nightly - # Build tagged releases in samcday/phrog COPR + # Build tagged releases in samcday/phrog COPR via the vendor path. - job: copr_build trigger: release - enable_net: true owner: samcday project: phrog diff --git a/phrog.spec b/phrog.spec index 516e4852..b02d10c3 100644 --- a/phrog.spec +++ b/phrog.spec @@ -5,13 +5,21 @@ %global _cargo_generate_buildrequires 0 %endif +# gettext-sys's build.rs falls back to compiling its bundled gettext when +# this is unset, and that bundled build is broken on Fedora 43+. Force the +# system libintl path; gettext-devel provides the headers. +%global gettext_sys_env export GETTEXT_SYSTEM=1 + Name: phrog Version: 0.53.0_rc7 Release: %autorelease Summary: Mobile-friendly greeter for greetd License: GPL-3.0-only URL: https://github.com/samcday/phrog -Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +%if %{with vendor} +Source1: %{name}-vendor.tar.gz +%endif ExcludeArch: %{ix86} @@ -32,6 +40,7 @@ BuildRequires: pkgconfig(gdk-pixbuf-2.0) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(libhandy-1) BuildRequires: pkgconfig(libphosh-0.45) +BuildRequires: gettext-devel %endif Requires: accountsservice @@ -51,7 +60,7 @@ mkdir -p /tmp/runtime-dir chmod 0700 /tmp/runtime-dir %if %{with vendor} -%{__cargo} vendor --locked --versioned-dirs vendor +tar -xf %{SOURCE1} %cargo_prep -v vendor %else %cargo_prep @@ -60,6 +69,7 @@ chmod 0700 /tmp/runtime-dir %endif %build +%{gettext_sys_env} %cargo_build %cargo_vendor_manifest %{cargo_license_summary} @@ -77,6 +87,7 @@ chmod 0700 /tmp/runtime-dir %{__install} -Dpm 0755 data/phrog-greetd-session -t %{buildroot}%{_libexecdir}/ %{__install} -d %{buildroot}%{_datadir}/phrog/autostart %{__install} -d %{buildroot}%{_sysconfdir}/phrog/autostart +%{gettext_sys_env} %cargo_install %if %{with check} @@ -85,6 +96,7 @@ export G_MESSAGES_DEBUG=all export XDG_RUNTIME_DIR=/tmp/runtime-dir cat > test.sh <