#!/usr/bin/env bash # # Render the RPM .spec for the Fedora COPR `geolibre` package. # # Like the AUR package, this is a binary repackage: it does not build from # source, it unpacks the official Tauri-built RPM attached to the GitHub release # and re-emits it, plus an AppStream metainfo file and an app-id-named .desktop # entry with proper categories. COPR builds the resulting SRPM in mock. # # Usage: # VERSION=1.5.0 DATE=2026-06-20 scripts/render-copr-spec.sh > geolibre.spec # # DATE is the release date (YYYY-MM-DD); it feeds the %changelog entry. Both # variables are required. REPO defaults to opengeos/GeoLibre. set -euo pipefail : "${VERSION:?Set VERSION to the release version, e.g. 1.5.0}" : "${DATE:?Set DATE to the release date, e.g. 2026-06-20}" [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "VERSION does not look like a semver string" >&2; exit 1; } [[ "$DATE" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] || { echo "DATE must be YYYY-MM-DD" >&2; exit 1; } # Reject syntactically valid but impossible dates (e.g. 2026-13-40). `date -d` # is GNU coreutils; these scripts run on Linux/CI (on macOS, use coreutils). date -u -d "$DATE" +%F >/dev/null 2>&1 || { echo "DATE is not a valid calendar date" >&2; exit 1; } REPO="${REPO:-opengeos/GeoLibre}" # RPM %changelog wants "Wdy Mon D YYYY" with a space-padded day (%e, not %d), so # single-digit days read "Jun 7" rather than "Jun 07" (what rpmlint expects). CHANGELOG_DATE="$(date -u -d "$DATE" +"%a %b %e %Y")" # Shell-expanded: ${VERSION}, ${DATE}, ${REPO}, ${CHANGELOG_DATE}. Everything # escaped with \$ or \%{...} stays literal for rpmbuild. cat <&2; exit 1; } _desktop_src="\$(find "\$_desktop_dir" -name '*.desktop')" mv "\$_desktop_src" "%{buildroot}%{_datadir}/applications/%{appid}.desktop" desktop-file-edit \\ --set-key=Categories --set-value="Science;Geoscience;Geography;" \\ --set-key=Comment --set-value="Lightweight, cloud-native GIS platform" \\ "%{buildroot}%{_datadir}/applications/%{appid}.desktop" # Install the AppStream metainfo. install -Dm0644 %{SOURCE1} "%{buildroot}%{_metainfodir}/%{appid}.metainfo.xml" # Ship the license text (the upstream bundle omits it). install -Dm0644 %{SOURCE2} "%{buildroot}%{_licensedir}/%{name}/LICENSE" %check desktop-file-validate "%{buildroot}%{_datadir}/applications/%{appid}.desktop" appstreamcli validate --no-net "%{buildroot}%{_metainfodir}/%{appid}.metainfo.xml" %files %license %{_licensedir}/%{name}/LICENSE %{_bindir}/geolibre-desktop # The Tauri bundle hardcodes the /usr/lib path (lib, not lib64); quote it # because of the space in the directory name. "/usr/lib/GeoLibre Desktop/" %{_datadir}/applications/%{appid}.desktop %{_datadir}/icons/hicolor/*/apps/geolibre-desktop.png %{_metainfodir}/%{appid}.metainfo.xml %changelog * ${CHANGELOG_DATE} Qiusheng Wu - ${VERSION}-1 - Automated release of GeoLibre ${VERSION} (repackaged from the upstream RPM). SPEC