From 9f236b3a1aa39d8b52b06318d2570bf65236c2d8 Mon Sep 17 00:00:00 2001 From: Carlo Baratto Date: Tue, 10 Nov 2026 11:05:38 +0100 Subject: [PATCH] spec: trova il desktop file via %{_sourcedir} (shadow build di Qt Creator) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Con Qt Creator la build e' shadow: %{_builddir} e' la cartella di build e i tre tentativi relativi a '%{_builddir}/..' non trovano rpm/harbour-quill.desktop, per cui %install usciva con 'Bad exit status' — la build da riga di comando dentro il progetto invece funzionava, e il difetto si vedeva solo sul PC dell'utente. %{_sourcedir} punta alla cartella rpm/ dei sorgenti in entrambe le modalita' (verificato con una build diagnostica): si prova quella per prima, i percorsi relativi a %{_builddir} restano come riserva, e l'errore ora elenca cosa ha cercato invece di dire solo 'not found'. --- rpm/harbour-quill.spec | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/rpm/harbour-quill.spec b/rpm/harbour-quill.spec index 9f273d5..c82e632 100644 --- a/rpm/harbour-quill.spec +++ b/rpm/harbour-quill.spec @@ -64,16 +64,30 @@ install -m 0644 %{_builddir}/harbour-quill_it.qm %{buildroot}%{_datadir}/%{name} # the source dir, the tarball is NOT extracted into the build dir, and rpm/ # is NOT copied there either. mkdir -p %{buildroot}/usr/share/applications -if [ -f %{_builddir}/../%{name}-%{version}/rpm/%{name}.desktop ]; then - install -m 0644 %{_builddir}/../%{name}-%{version}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ -elif [ -f %{_builddir}/rpm/%{name}.desktop ]; then - install -m 0644 %{_builddir}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ -elif [ -f %{_builddir}/%{name}-%{version}/rpm/%{name}.desktop ]; then - install -m 0644 %{_builddir}/%{name}-%{version}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ -else - echo "ERROR: %{name}.desktop not found (checked sibling source, build dir, extracted source)" >&2 + +# Il desktop file sta accanto a questa spec, e sfdk imposta %{_sourcedir} +# proprio alla cartella rpm/ dei sorgenti — in ENTRAMBE le modalita': build +# dentro il progetto e shadow build (Qt Creator). E' l'unico percorso che regge +# in tutte e due; i tentativi relativi a %{_builddir} restano come riserva per +# chi compila da un tarball estratto a mano (rpmbuild classico). +DESKTOP="" +for candidate in "%{_sourcedir}/%{name}.desktop" \ + "%{_builddir}/../%{name}-%{version}/rpm/%{name}.desktop" \ + "%{_builddir}/rpm/%{name}.desktop" \ + "%{_builddir}/%{name}-%{version}/rpm/%{name}.desktop"; do + if [ -f "$candidate" ]; then + DESKTOP="$candidate" + break + fi +done +if [ -z "$DESKTOP" ]; then + echo "ERROR: %{name}.desktop not found" >&2 + echo " cercato in %{_sourcedir} e sotto %{_builddir}" >&2 + echo " contenuto di %{_sourcedir}:" >&2 + ls -la %{_sourcedir} >&2 || true exit 1 fi +install -m 0644 "$DESKTOP" %{buildroot}/usr/share/applications/%{name}.desktop %files %defattr(-,root,root,-)