Bug 2171887

Summary: “appstreamcli validate “ shows a confusing error message when only a translated screenshot exists but no screenshot for the default locale
Product: [Fedora] Fedora Reporter: Mike FABIAN <mfabian>
Component: appstreamAssignee: Rex Dieter <rdieter>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: kde-sig, mfabian, rdieter, tdawson, yselkowi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike FABIAN 2023-02-20 18:10:03 UTC
https://download.copr.fedorainfracloud.org/results/mfabian/ibus-typing-booster/fedora-rawhide-x86_64/05549617-ibus-typing-booster/build.log.gz

fails with 

+ appstreamcli validate --pedantic --no-net /builddir/build/BUILDROOT/ibus-typing-booster-2.21.4-1.fc39.x86_64//usr/share/metainfo/emoji-picker.appdata.xml /builddir/build/BUILDROOT/ibus-typing-booster-2.21.4-1.fc39.x86_64//usr/share/metainfo/typing-booster.appdata.xml
emoji-picker.appdata.xml
  E: org.freedesktop.ibus.engine.typing_booster.emoji_picker:18: screenshot-image-source-missing
emoji-picker.appdata.xml
  E: org.freedesktop.ibus.engine.typing_booster.emoji_picker:18: screenshot-image-source-missing
typing-booster.appdata.xml
  E: org.freedesktop.ibus.engine.typing_booster:22: screenshot-image-source-missing
✘ Validation failed: errors: 3
error: Bad exit status from /var/tmp/rpm-tmp.edFYrs (%check)
    Bad exit status from /var/tmp/rpm-tmp.edFYrs (%check)

But the files `appstreamcli validate --pedantic --no-net` complains about **do** have screenshot sources:

https://github.com/mike-fabian/ibus-typing-booster/blob/main/emoji-picker.appdata.xml

contains:

```xml
  <screenshots>
    <screenshot type="default">
      <image type="source" xml:lang="en">
        https://mike-fabian.github.io/ibus-typing-booster/images/emoji-picker.png
      </image>
      <caption>Emoji Picker screenshot</caption>
    </screenshot>
  </screenshots>
```

https://github.com/mike-fabian/ibus-typing-booster/blob/main/typing-booster.appdata.xml

contains:

```xml
  <screenshots>
    <screenshot type="default">
      <image type="source" width="956" height="233" xml:lang="en">
      https://mike-fabian.github.io/ibus-typing-booster/images/typing-emoji-and-context-sensitive-completion.png
      </image>
      <caption>Typing Booster screenshot</caption>
    </screenshot>
    <screenshot>
      <video container="webm" codec="vp9" xml:lang="en">
        https://mike-fabian.github.io/ibus-typing-booster/videos/overview-demo-setup-use-typing-booster-emoji-picker.webm
      </video>
      <caption>Typing booster demo video</caption>
    </screenshot>
  </screenshots>
```

These screenshots are given as URLs, and they point to existing files.

But I think because of the `--no-net` option `appstreamcli validate` should not try to validate these at all.

Comment 1 Yaakov Selkowitz 2023-02-21 00:00:50 UTC
FWIW the packaging guidelines mandate the use of appstream-util (from libappstream-glib) rather than appstreamcli, and it doesn't have this problem.

Comment 2 Mike FABIAN 2023-04-17 08:44:52 UTC
(In reply to Yaakov Selkowitz from comment #1)
> FWIW the packaging guidelines mandate the use of appstream-util (from
> libappstream-glib) rather than appstreamcli, and it doesn't have this
> problem.

https://blogs.gnome.org/uraeus/2022/06/10/how-to-get-your-application-to-show-up-in-gnome-software/#comment-26956

says:

* Use `appstreamcli` not `appstream-util`. The latter is unmaintained.

Comment 3 Yaakov Selkowitz 2023-04-17 16:18:07 UTC
The Fedora packaging guidelines take precedence:

https://docs.fedoraproject.org/en-US/packaging-guidelines/AppData/#_app_data_validate_usage

Comment 4 Mike FABIAN 2023-04-19 14:54:18 UTC
(In reply to Yaakov Selkowitz from comment #3)
> The Fedora packaging guidelines take precedence:
> 
> https://docs.fedoraproject.org/en-US/packaging-guidelines/AppData/
> #_app_data_validate_usage

If the upstream developers of appstream say `appstream-util` is unmaintained and one should use `appstreamcli`, then I think the Fedora guidelines need to change.

Comment 5 Yaakov Selkowitz 2023-04-19 15:31:49 UTC
(In reply to Mike FABIAN from comment #4)
> If the upstream developers of appstream say `appstream-util` is unmaintained
> and one should use `appstreamcli`, then I think the Fedora guidelines need
> to change.

Perhaps, but there is a procedure that would need to be followed.  One step in that process should be to try modifying and rebuilding everything which currently uses libappstream-glib/appstream-util with appstream/appstreamcli in a COPR.  If you are interested in taking a lead on this effort, I suggest being in touch with FPC.

In the meantime, please follow the existing guidelines so that the package in question can be built.

Comment 6 Mike FABIAN 2023-04-25 08:25:07 UTC
I reported the appstreamcli problem upstream: https://github.com/ximion/appstream/issues/494

and got a response which made me realize that I had just misunderstood the error message `screenshot-image-source-missing`. It does not mean that https://mike-fabian.github.io/ibus-typing-booster/images/emoji-picker.png does not exist, this error message was there because of the `xml:lang="en"`. To appstreamcli this looked like there was only a translated screenshot and no screenshot for the default locale. The error message is very confusing.

After removing xml:lang="en" both appstream-util and appstreamcli find no errors in the files.

Comment 7 Fedora Release Engineering 2023-08-16 07:10:01 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.