Skip to content

Comments

Allow multiple addons per component#203

Merged
ximion merged 2 commits intoximion:masterfrom
davidmhewitt:fix-addon-linking
Oct 7, 2018
Merged

Allow multiple addons per component#203
ximion merged 2 commits intoximion:masterfrom
davidmhewitt:fix-addon-linking

Conversation

@davidmhewitt
Copy link
Contributor

Currently, only a maximum of one addon is associated with a component.

As far as I understand it, a component should be able to have multiple addons. I.e. multiple components can all have an extends field that points to the same component.

In this PR, when looking at the extends field, make sure we add the current component to the addons section of the extended package if the current component isn't in the addons list already, rather than artificially limiting it to 1 addon per component.

@davidmhewitt davidmhewitt changed the title Ensure all addons are linked to a component Allow multiple addons per component Oct 7, 2018
@davidmhewitt
Copy link
Contributor Author

For testing:
appstreamcli get org.gnome.gedit.desktop --details

In master (on Ubuntu 18.04), you get:
Add-ons: gedit-dashboard (gedit)

With this branch:

Add-ons: 
   - gedit-dashboard (gedit)
   - gedit-multiedit (gedit)
   - gedit-terminal (gedit)
   - gedit-synctex (gedit)
   - gedit-textsize (gedit)
   - gedit-bracketcompletion (gedit)
   - gedit-codecomment (gedit)
   - gedit-bookmarks (gedit)
   - gedit-translate (gedit)
   - gedit-commander (gedit)
   - gedit-wordcompletion (gedit)
   - gedit-charmap (gedit)
   - gedit-colorschemer (gedit)
   - gedit-joinlines (gedit)
   - gedit-colorpicker (gedit)
   - gedit-git (gedit)
   - gedit-findinfiles (gedit)
   - gedit-drawspaces (gedit)
   - gedit-smartspaces (gedit)
   - gedit-zeitgeist (gedit)

@ximion
Copy link
Owner

ximion commented Oct 7, 2018

Makes sense to me. This is probably not the most efficient solution to this problem, since g_ptr_array_find isn't very fast, however since most components have very short addon lists it's likely preferable to making a hash map.
I am also planning some rework of the refining process anyway, so we might not need to run _find at all in future.
For the time being, this patch is a good solution.
Thank you for submitting the patch!

@ximion ximion merged commit fd4f9aa into ximion:master Oct 7, 2018
@davidmhewitt davidmhewitt deleted the fix-addon-linking branch October 7, 2018 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants