我在将
AppStream upstream metadata
添加到我的项目的 AppImage 时遇到困难。
以下是我的AppImage的文件结构的相关部分:
something.AppDir
|__AppRun
|__io.github.accountname.repositoryname.desktop
|__icon.png
|__usr
|__share
|__metainfo
|__io.github.accountname.repositoryname.appdata.xml
在其文件
usr/share/metainfo/io.github.account.project.appdata.xml
中,存在以下与.desktop
相关的语句:
<launchable type="desktop-id">io.github.accountname.repositoryname.desktop</launchable>
但是,发出命令后:
$ ./appimagetool-x86_64.AppImage something.AppDir
出现这些消息:
appimagetool, continuous build (commit 5735cc5), build <local dev build> built on 2023-03-08 22:52:04 UTC
Using architecture x86_64
/home/user/projects/something.AppDir should be packaged as something-x86_64.AppImage
AppStream upstream metadata found in usr/share/metainfo/io.github.accountname.repositoryname.appdata.xml
Trying to validate AppStream information with the appstreamcli tool
In case of issues, please refer to https://github.com/ximion/appstream
io.github.accountname.repositoryname.appdata.xml
I: io.github.accountname.repositoryname:~: content-rating-missing
W: io.github.accountname.repositoryname:~: desktop-file-not-found
✘ Validation failed: warnings: 1, infos: 1, pedantic: 4
run_external: subprocess exited with status 3Failed to validate AppStream information with appstreamcli
当
appstreamcli validate
成功时,我如何解决这些问题:
$ appstreamcli validate --pedantic something.AppDir/usr/share/metainfo/io.github.accountname.repositoryname.appdata.xml
P: io.github.accountname.repositoryname:22: screenshot-no-caption
P: io.github.accountname.repositoryname:~: releases-info-missing
I: io.github.accountname.repositoryname:~: content-rating-missing
P: io.github.accountname.repositoryname:19: screenshot-no-caption
✔ Validation was successful: infos: 1, pedantic: 3
io.github.account.project.appdata.xml
文件是使用推荐的在线工具创建的
appimagetool-x86_64.AppImage
来自这里。
我发现需要对我的问题中提到的文件结构进行以下更改:
something.AppDir
|__AppRun
|__io.github.accountname.repositoryname.desktop
|__icon.png
|__usr
|__share
|__metainfo
|__io.github.accountname.repositoryname.appdata.xml
|__applications
|__io.github.accountname.repositoryname.desktop
本质上,
io.github.accountname.repositoryname.desktop
的副本必须放置在新文件夹something.AppDir/usr/share/applications
中。将此文件在 something.AppDir
中软链接到新的 applications
文件夹将不起作用。他的文件也无法从something.AppDir
中删除。看起来很奇怪,这样的重复必须存在,但这是我发现的工作appimagetool-x86_64.AppImage
。