Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Discover Discover
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 7
    • Issues 7
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PlasmaPlasma
  • DiscoverDiscover
  • Merge requests
  • !149

Draft: appstream: add helper to download metadata from web

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Alexey Min requested to merge alexeymin/discover:appstreamdownloader into master Jul 17, 2021
  • Overview 16
  • Commits 1
  • Pipelines 0
  • Changes 3

Some distros (for example, Alpine Linux) do not provide appstream data as installable package, instead they host it on the internet (at https://appstream.alpinelinux.org) and software center app has to download them on its own.

Those files are not very large (from few kilobytes to couple of megabytes) but we still need them.

URLs to download archives from are read from JSON files in /usr/share/libdiscover/external-appstream-urls/ directory (QStandardPaths::GenericDataLocation/libdiscover/external-appstream-urls from C++/Qt code).

JSON file format:

{
     "urls": [
         "https://url1",
         "https://url2",
         ...
     ]
}

These JSON files should be provided by the linux distribution.

This class can load any amount of those JSON files, fetch URLs from them and download all files pointed by those URLs to discover's cache directory: ~/.cache/discover/external_appstream_data (aka QStandardPaths::CacheLocation). Use getAppStreamCacheDir() to get this path.

If files are already present in cache and not outdated, they are not downloaded again. Default cache expiration time is 2 days and can be tweaked using setCacheExpirePeriodSecs().

P.S. This change is a requirement before sending any future MRs for Alpine Linux APK backend.

Edited Jul 19, 2021 by Alexey Min
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: appstreamdownloader