spec: trova il desktop file via %{_sourcedir} (shadow build di Qt Creator)

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'.
This commit is contained in:
kaneda committed 2026-11-10 11:05:38 +01:00
1 parent b12ad4257f
commit 9f236b3a1a
1 file changed
+22 -8
+22 -8
View File
@@ -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/ # the source dir, the tarball is NOT extracted into the build dir, and rpm/
# is NOT copied there either. # is NOT copied there either.
mkdir -p %{buildroot}/usr/share/applications 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/ # Il desktop file sta accanto a questa spec, e sfdk imposta %{_sourcedir}
elif [ -f %{_builddir}/rpm/%{name}.desktop ]; then # proprio alla cartella rpm/ dei sorgenti — in ENTRAMBE le modalita': build
install -m 0644 %{_builddir}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ # dentro il progetto e shadow build (Qt Creator). E' l'unico percorso che regge
elif [ -f %{_builddir}/%{name}-%{version}/rpm/%{name}.desktop ]; then # in tutte e due; i tentativi relativi a %{_builddir} restano come riserva per
install -m 0644 %{_builddir}/%{name}-%{version}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ # chi compila da un tarball estratto a mano (rpmbuild classico).
else DESKTOP=""
echo "ERROR: %{name}.desktop not found (checked sibling source, build dir, extracted source)" >&2 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 exit 1
fi fi
install -m 0644 "$DESKTOP" %{buildroot}/usr/share/applications/%{name}.desktop
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)