Add support for managing appstream catalogs as part of the index #192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Why
We want up-to-date appstream catalog information as some applications contain changelog information in their appstream metadata. This changelog information is then shown in front-ends such as gnome-software. As is it currently, appstream-catalog is downloaded as part of a separate package, this then means that gnome-software will show out of date changelog information for packages. e.g. an update to gnome-clocks 49.0 exists and the changelog for this release is included an update for appstream-catalog. However, as the latest appstream-catalog is not yet installed gnome-software will either show out of date changelog information or simply fall back to the generic summary message used for the update. By updating the appstream-catalog as part of the eopkg index we can then ensure we always have the most up-to-date changelog information for available updates.
Example
Before up-to-date appstream catalog is installed:

After up-to-date appstream catalog is installed:

How
A supplemental index file can be provided (
appstream.xml) that is picked up similarly in nature to other supplemental files e.g.components.xml,groups.xml.An example of an appstream.xml file is:
Multiple appstream catalogs can be specified.
When the repository is indexed the
</AppstreamCatalog>tag(s) is included in theeopkg-index.xmlfile.The origin should match the origin in the
Components-x86_64.xml.gzfile.When an
</AppstreamCatalog>is included in the eopkg index, eopkg will then download the appstream catalog and it's icons to/var/lib/swcatalog/xml/if the catalog is not installed. If the catalog is installed then eopkg will check against the Last-Modified header to see if newer tarballs exist on the remote then download and install them if necessary.For the example
appstream.xmlfile above, eopkg will install to the following paths:/var/lib/swcatalog/xml/solus-unstable-main.xml.gz/var/lib/swcatalog/xml/solus-unstable-main.xml.gz.eopkg/var/lib/swcatalog/icons/solus-unstable-main/128x128//var/lib/swcatalog/icons/solus-unstable-main/64x64//var/lib/swcatalog/icons/solus-unstable-main/64x64@2/Eopkg will place a tag on the catalog so it knows that appstream catalog is managed by itself (in this case
/var/lib/swcatalog/xml/solus-unstable-main.xml.gz.eopkg) . If the index no longer contains an appstream catalog matching the tag, eopkg will then nuke those paths as an obsolete catalog when the index is updated.Test Plan
appstream.xmlto local repo</AppstreamCatalog>exists in theeopkg.index.xmlfileappstream.xmlfrom local repo</AppstreamCatalog>no longer exists ineopkg-index.xmlfileTODO: been a while since i've looked at this code but i think i wasn't particularly happy with how obsolete catalogs were managed