ximion / appstream-generator

A fast AppStream metadata generator
GNU Lesser General Public License v3.0
43 stars 29 forks source link

Unclear documentation #104

Closed xsuchy closed 2 years ago

xsuchy commented 2 years ago

Spinning off the discussion from https://github.com/rpm-software-management/createrepo_c/issues/75#issuecomment-1194156067

I am investigating whether we can use appstream-generator for Copr instead of appstream-builder. But even after reading all the documentation and man pages and output of --help I still do not know how to use appstream-generator.

My questions are:

  1. What will generate the asgen config? Because I cannot write it for every project in Copr.
  2. What I need to run on the first run in the directory?
  3. What I need to run on every consecutive run in the directory? Should I keep some files/dirs to improve the performance?
ximion commented 2 years ago

What will generate the asgen config? Because I cannot write it for every project in Copr.

The configuration file is supposed to be crafted manually by the user according to their needs (see https://github.com/ximion/appstream-generator/blob/master/docs/asgen-config.md ). You could of course have it generated from an external tool as well (and I do know people who do that), it's really up to you :-) These files can probably quite easily be autogenerated from a master template for things like Copr.

What I need to run on the first run in the directory?

Run appstream-generator run <suite> where suite is the suite label, e.g. "22" or "rawhide". The run command also supports a --workspace directory to set the cache/database locations, as well as a --config flag to set the JSON config file and an --export-dir flag, all of which you may find useful.

What I need to run on every consecutive run in the directory? Should I keep some files/dirs to improve the performance?

Yes - ideally you keep the whole workspace directory intact, but at the very least for incremental data generation the db and media directories must exist. The former holds the actual caches, and the latter contains extracted and rendered icons and screenshots, which are usually served on a webserver anyway. Every other data is regenerated from the caches or fresh packages, I think :-)

xsuchy commented 2 years ago

You could of course have it generated from an external tool as well (and I do know people who do that), it's really up to you.

Can you point me to tools that are able to generate this file?

ximion commented 2 years ago

You could of course have it generated from an external tool as well (and I do know people who do that), it's really up to you.

Can you point me to tools that are able to generate this file?

Oh, I don't have those, this stuff is used internally in systems for some vendors. But I assume it's basically a "fetch all values from a database or other sensible location, and then feed that info into a dict that gets serialized by Python's json module" kind of deal. I think there was a prototype for Launchpad even at some point, but I can't seem to find that work... (maybe it was a private repo) In any case, it's not hard, writing JSON is easy from almost all languages :)