diff options
author | David Reyna <David.Reyna@windriver.com> | 2017-06-27 13:44:30 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-28 16:02:15 +0100 |
commit | 4f2baebf362d71351db044c0646f9bc6e8a39c49 (patch) | |
tree | bcbb07afbe24816f35d0c9d616ac5ea1fcca7f17 /bitbake/lib/toaster/toastergui/typeaheads.py | |
parent | 43aaa802c35ecc9d972f3b9adcd060033de1d9de (diff) | |
download | poky-4f2baebf362d71351db044c0646f9bc6e8a39c49.tar.gz |
bitbake: toaster: Add distro selection support
Add the ability to select a distro in the project page,
based on values from the Layer Index. Add a distro selection
page with the add layer feature, based on the add machine
page.
[YOCTO #10632]
(Bitbake rev: a156a4eff67cdc3943494f5be72b96e3db656250)
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/typeaheads.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/typeaheads.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/typeaheads.py b/bitbake/lib/toaster/toastergui/typeaheads.py index 58c650f8fc..5aa0f8d889 100644 --- a/bitbake/lib/toaster/toastergui/typeaheads.py +++ b/bitbake/lib/toaster/toastergui/typeaheads.py | |||
@@ -100,6 +100,36 @@ class MachinesTypeAhead(ToasterTypeAhead): | |||
100 | return results | 100 | return results |
101 | 101 | ||
102 | 102 | ||
103 | class DistrosTypeAhead(ToasterTypeAhead): | ||
104 | """ Typeahead for all the distros available in the current project's | ||
105 | configuration """ | ||
106 | def __init__(self): | ||
107 | super(DistrosTypeAhead, self).__init__() | ||
108 | |||
109 | def apply_search(self, search_term, prj, request): | ||
110 | distros = prj.get_available_distros() | ||
111 | distros = distros.order_by("name") | ||
112 | |||
113 | primary_results = distros.filter(name__istartswith=search_term) | ||
114 | secondary_results = distros.filter(name__icontains=search_term).exclude(pk__in=primary_results) | ||
115 | tertiary_results = distros.filter(layer_version__layer__name__icontains=search_term).exclude(pk__in=primary_results).exclude(pk__in=secondary_results) | ||
116 | |||
117 | results = [] | ||
118 | |||
119 | for distro in list(primary_results) + list(secondary_results) + list(tertiary_results): | ||
120 | |||
121 | detail = "[ %s ]" % (distro.layer_version.layer.name) | ||
122 | needed_fields = { | ||
123 | 'id' : distro.pk, | ||
124 | 'name' : distro.name, | ||
125 | 'detail' : detail, | ||
126 | } | ||
127 | |||
128 | results.append(needed_fields) | ||
129 | |||
130 | return results | ||
131 | |||
132 | |||
103 | class RecipesTypeAhead(ToasterTypeAhead): | 133 | class RecipesTypeAhead(ToasterTypeAhead): |
104 | """ Typeahead for all the recipes available in the current project's | 134 | """ Typeahead for all the recipes available in the current project's |
105 | configuration """ | 135 | configuration """ |