Skip to content

worker.sh: read AppStream metainfo under its current name (*.metainfo.xml) too - #3874

Open
budbrain-software wants to merge 1 commit into
AppImage:masterfrom
budbrain-software:worker-read-metainfo-xml
Open

worker.sh: read AppStream metainfo under its current name (*.metainfo.xml) too#3874
budbrain-software wants to merge 1 commit into
AppImage:masterfrom
budbrain-software:worker-read-metainfo-xml

Conversation

@budbrain-software

Copy link
Copy Markdown
Contributor

Problem

code/worker.sh copies in both AppStream file names (lines 385-391):

if [ -e $APPDIR/usr/share/metainfo/*.appdata.xml ] ; then ... fi
if [ -e $APPDIR/usr/share/metainfo/*.metainfo.xml ] ; then ... fi

but it only ever reads *appdata.xml:

if [ -f database/$INPUTBASENAME/*appdata.xml ] ; then      # description
if [ -f database/$INPUTBASENAME/*appdata.xml ] ; then      # screenshot

*.metainfo.xml is the name the AppStream specification asks for today, so any
application using it silently falls back to the .desktop Comment= for the
description and to the automatically taken screenshot — even though its metainfo
file was shipped, copied in, and is perfectly readable.

That it is readable is easy to show: the license block right between those two
ifs already handles both names via *.{appdata,metainfo}.xml, and the license
from such a file does end up in the catalogue entry. Only description and
screenshot are lost.

Change

One variable, used by both blocks, preferring *.appdata.xml when an
application ships both:

AS_XML=$(ls database/$INPUTBASENAME/*.appdata.xml database/$INPUTBASENAME/*.metainfo.xml 2>/dev/null | head -n 1)

As a side effect this also removes two [ -f <glob> ] tests, which fail with
"too many arguments" when an AppDir ships more than one matching file.

Tested

files present before after
only *.metainfo.xml not detected detected
only *.appdata.xml detected detected (unchanged)
both detected detected, appdata.xml preferred (unchanged)
neither falls back falls back (unchanged)

With a real AppImage shipping only de.budbrain.jsPicPuzzler.metainfo.xml, the
two XPath expressions now return
Jigsaw puzzles from forty photographs, in six sizes and the screenshot URL from
the metainfo, instead of nothing.

Both *.appdata.xml and *.metainfo.xml are copied in, but only
*appdata.xml was ever read, so applications shipping the current
name lost their description and screenshot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant