New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Allow AppStream to parse recommendations #45
Conversation
9917d7e
to
cf67059
Compare
|
Nice! I'll be a bit busy the next days (KDE AppStore meeting and other things), but I think I can give it a quick review tonight. One obvious thing to resolve would be fixing the test issues ;-) (minor stuff, as far as I can see).
<recommendations>
<recommendation>
<recommended>vim.desktop</recommended>
<because>
<pkg>emacs.desktop</pkg>
</because>You want to define a condition here, right? So, something like "if Vim present, suggest Emacs". The "because" should therefore probably be an "if". Also, I think the whole block is a bit strange... Why not put the recommendation into the component-block of the thing recommending it? So, something like: <component type="desktop">
<id>emacs.desktop</id>
<recommendations>
<recommendation>emacs.desktop</recommendation>
</recommendations>
</component>That would look far more simple to me, and would prevent the need for declaring logic in XML. Aside from that, your I need to read the code this evening to fully understand the concept behind this and give some better feedback though ;-) |
|
No problem. I will look why the build is failing. It is currently presenting this error: gpg: no valid OpenPGP data found.var/lib/app-inf But I will look it up to fix it.
But you are right, the tag names provided by your XML file are way better than the ones I have provided. I will create an XML file with better names and update the code accordingly. |
5f9c0b5
to
65f44e5
Compare
|
Sidenote: I really want a reply function in the GitHub UI! Making replys manually is annoying...
No worries, that was a temporary failure due to the LLVM APT repo not being available. I took that as an argument to make the whole build process happen in a Docker container now, which allows us to be independent of the outdated Travis base system.
Okay, then why have this because information in the first place? Wouldn't simply dropping a list of recommended AppStream-IDs into some directory in |
cf67059
to
754d218
Compare
|
Okay, I have applied the rebase and I will check again if there is another problem during the build process. But about the because tag. Originally, I though that it would be good for an user to know which of his packages generated the one being recommended. It would made the recommendation more trustworthy, since the user would see the reason behind it. Therefore, I thought that the applications that would use this AppStream data could display this extra information for their users. However, maybe on the context of AppStream this extra information is really not necessary or I can make it optional. |
94fcca3
to
96f54e1
Compare
ba89753
to
8e964d2
Compare
|
I have updated some of the XML tag names and also added a method to check if the recommendation object is valid. By valid, I mean that the package referenced by the id variable is a package indexed by AppStream. |
50db210
to
cd36dfc
Compare
|
I have added the "merge" type for a component class. I have also made a verification on the |
| typedef struct | ||
| { | ||
| AsSuggestedKind kind; | ||
| GPtrArray *cpts_id; /* of string */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should rather be cpt_ids of utf8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I also wonder if a GHashTable isn't a better idea here, since that will prevent us from having duplicate entries...
|
I fixed up the first two patches and committed the result to master. Bonus points for adding some validator hints (e.g. having a |
| g_return_if_fail (xdt != NULL); | ||
| g_return_if_fail (cpt != NULL); | ||
|
|
||
| suggested = as_suggested_new (); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are leaking memory here.
|
The contents of this PR are now merged - there is still work to do, mainly support for writing the suggests tag and for the YAML part is completely missing. |
|
Thanks for submitting this PR! |
|
Sorry for that huge amount of memory leaks. I will be more careful on my next merge request. I think I will now allow AppRecommender to write the XML files and look into the YAML part as well. Thanks for the patience on reviewing this feature :) |
|
I already took care of the YAML world (and pretty much all other bits) - the remaining piece is getting the merge logic work for (almost) all fields, see the I hope I can do a new AppStream release ASAP. The libappstream library is capable of writing the necessary XML or YAML files for merge components now. |
This MR add the feature to AppStream to allow it to parse recommendation files. A recommendation file is defined by a XML document in the following format:
Where id is the package being recommended and because is the user packages that generated this recommendation.
Currently, it is already working the construction and parsing of a valid XML recommendation, however there are some necessary improvements to be done:
Therefore, this MR is manly to collect feedback from the AppStream community regarding this feature.