[AppStream] Dependencies on things in AppStream

Matthias Klumpp matthias at tenstral.net
Sun Mar 25 21:16:06 UTC 2018


2018-03-25 22:11 GMT+02:00 Richard Hughes <hughsient at gmail.com>:
> On 25 March 2018 at 20:44, Matthias Klumpp <matthias at tenstral.net> wrote:
>> <requires>
>>   <memory>4GiB</memory>
>
> Eww. Can we not just make this an integer number of bytes/Mb/Gb? The
> number of GB seems like it has the required precision.

Yeah, I was thinking about that - having the unit explicitly written
there is just easy on the eye for a human reader.
Maybe using MB as the default precision is best here, to get some
compromise between precision and readability (while we we will likely
only see GB-sized values here, there might be other applications where
using MB makes more sense (GPU-memory?), and using a different unit
there would be confusing).

>> System resources and interfaces:
>> ```
>> <requires>
>>   <kernel version=">= 4.16">Linux</kernel>
>
> Not valid XML, it'd need to be >=4.16

Right, most persers parse it anyway though ;-)

> -- in appstream-glib I'm just
> using a compare string, e.g. ge, lt, eq etc. Real world example:
>
>     <requires>
>       <firmware compare="eq" version="USB:0x046D">vendor-id</firmware>
>       <id compare="ge" version="0.8.2">org.freedesktop.fwupd</id>
>       <firmware compare="regex" version="BOT03.0[0-1]_*">bootloader</firmware>
>     </requires>

I was looking at the ZeroInstall feed format[1], and they have some
"before"/"not-before" logic...
I actually like your approach a bit better though, it's more flexible
and easier to parse.
I didn't think of allowing regex matching (eww!!!) but if that's
something firmware regularly wants, we could add it as well.

>>  2) People will want to add and/or relations to the items they depend
>> on (like "this hardware or that hardware", "this interface or that
>> interface"), so should we add "and" and "or" tags to wrap the existing
>> tags in, to allow people to reflect those relations? (= do we want
>> that extra complexity?)
>
> Nope, this sounds like a nightmare to reflect in XML...

I am very sure that I have seen that before, and initially thought it
was in ZeroInstall. Turns out though it was in the Freedesktop Menu
spec, which has <And>, <Or>, <Not>, <All>, etc. tags.
The issue of "my software can use $range_of_hardware, either of which
is okay" will come up though, and people will want and and or
relations sooner or later.
So, how do we address that? For the software/interface side, we could
just demand projects agreeing on one common interface name and using
<provides/> to declare that the software can be used with it.
That means we will end up with some kind of
"org.freedesktop.generic_component.SQLDatabase" pseudo-ID at some
point though.
For hardware I have no idea, except for allowing complex regex
matching in a modalias tag (which we shouldn't do...).

Cheers,
    Matthias

[1]: http://0install.net/interface-spec.html#dependencies


More information about the AppStream mailing list