spec: fallback for version variables

In certain environments (Packit for example), shell expansions are
disabled for safety reasons. Hence, a fallback is necessary.
This commit is contained in:
Rahul Rajesh 2026-05-29 13:57:40 -04:00
parent cb71852c20
commit a7825e7c16

View file

@ -21,8 +21,18 @@ Release: __RELEASE_VERSION__%{?dist}
%global wpa_supplicant_version 1:1.1
%global ppp_version %(pkg-config --modversion pppd 2>/dev/null || sed -n 's/^#define\\s*VERSION\\s*"\\([^\\s]*\\)"$/\\1/p' %{_includedir}/pppd/patchlevel.h 2>/dev/null | grep . || echo bad)
# Certain environments (e.g Packit) disable shell expansion, so we need a fallback
%if "%{?ppp_version}" == ""
%global ppp_version 2.5.2
%endif
%global glib2_version %(pkg-config --modversion glib-2.0 2>/dev/null || echo bad)
%if "%{?glib2_version}" == ""
%global glib2_version 2.80.0
%endif
%global bcond_default_debug __BCOND_DEFAULT_DEBUG__
%global bcond_default_lto __BCOND_DEFAULT_LTO__
%global bcond_default_test __BCOND_DEFAULT_TEST__