diff options
author | Joshua Lock <josh@linux.intel.com> | 2011-07-27 16:10:39 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-08-01 16:49:09 +0100 |
commit | 42fe3c613153c8abfa9cba4307919a69778fe739 (patch) | |
tree | 8266a632fa3120957887418ba2b5c693105f2346 | |
parent | a10fb4f72a3a072baf8d50f5a9c1dff93320a5ed (diff) | |
download | ast2050-yocto-poky-42fe3c613153c8abfa9cba4307919a69778fe739.zip ast2050-yocto-poky-42fe3c613153c8abfa9cba4307919a69778fe739.tar.gz |
hob: more reliable disabling of GPLv3 packages
1. reflect GPLv3's presence in INCOMPATIBLE_LICENSE value in the UI
The hob UI currently only supports GPLv3 as a value for
INCOMPATIBLE_LICENSE but doesn't properly reflect whether the value is
already set. This patch rectifies this.
2. don't stomp over other INCOMPATIBLE_LICENSE values when disabling GPLv3
In case the user has other values set for INCOMPATIBLE_LICENSE we don't
want to overwrite the value, we want to modify it.
Fixes [#1286]
(Bitbake rev: 68b992922bc7148d657a1c706c6acc67812a87c0)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/configurator.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobprefs.py | 24 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/hob.py | 8 |
4 files changed, 41 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/configurator.py b/bitbake/lib/bb/ui/crumbs/configurator.py index ec48a4f..587a6ff 100644 --- a/bitbake/lib/bb/ui/crumbs/configurator.py +++ b/bitbake/lib/bb/ui/crumbs/configurator.py @@ -84,9 +84,6 @@ class Configurator(gobject.GObject): pmake = getString('PARALLEL_MAKE') if pmake and pmake != self.config.get('PARALLEL_MAKE', ''): self.config['PARALLEL_MAKE'] = pmake - incompat = getString('INCOMPATIBLE_LICENSE') - if incompat and incompat != self.config.get('INCOMPATIBLE_LICENSE', ''): - self.config['INCOMPATIBLE_LICENSE'] = incompat pclass = getString('PACKAGE_CLASSES') if pclass and pclass != self.config.get('PACKAGE_CLASSES', ''): self.config['PACKAGE_CLASSES'] = pclass @@ -94,11 +91,25 @@ class Configurator(gobject.GObject): if fstypes and fstypes != self.config.get('IMAGE_FSTYPES', ''): self.config['IMAGE_FSTYPES'] = fstypes + # Values which aren't always set in the conf must be explicitly + # loaded as empty values for save to work + incompat = getString('INCOMPATIBLE_LICENSE') + if incompat and incompat != self.config.get('INCOMPATIBLE_LICENSE', ''): + self.config['INCOMPATIBLE_LICENSE'] = incompat + else: + self.config['INCOMPATIBLE_LICENSE'] = "" + self.orig_config = copy.deepcopy(self.config) def setLocalConfVar(self, var, val): self.config[var] = val + def getLocalConfVar(self, var): + if var in self.config: + return self.config[var] + else: + return "" + def _loadLayerConf(self, path): self.bblayers = path self.enabled_layers = {} diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index 4897bcc..c6ac7d5 100644 --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py @@ -65,7 +65,6 @@ class HobHandler(gobject.GObject): self.current_command = None self.building = None - self.gplv3_excluded = False self.build_toolchain = False self.build_toolchain_headers = False self.generating = False @@ -269,13 +268,8 @@ class HobHandler(gobject.GObject): # leave the workdir in a usable state self.server.runCommand(["stateShutdown"]) - def toggle_gplv3(self, excluded): - if self.gplv3_excluded != excluded: - self.gplv3_excluded = excluded - if excluded: - self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", "GPLv3"]) - else: - self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", ""]) + def set_incompatible_license(self, incompatible): + self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", incompatible]) def toggle_toolchain(self, enabled): if self.build_toolchain != enabled: diff --git a/bitbake/lib/bb/ui/crumbs/hobprefs.py b/bitbake/lib/bb/ui/crumbs/hobprefs.py index 0f9bda2..be094e7 100644 --- a/bitbake/lib/bb/ui/crumbs/hobprefs.py +++ b/bitbake/lib/bb/ui/crumbs/hobprefs.py @@ -113,12 +113,20 @@ class HobPrefs(gtk.Dialog): def include_gplv3_cb(self, toggle): excluded = toggle.get_active() - self.handler.toggle_gplv3(excluded) + orig_incompatible = self.configurator.getLocalConfVar('INCOMPATIBLE_LICENSE') + new_incompatible = "" if excluded: - self.configurator.setLocalConfVar('INCOMPATIBLE_LICENSE', 'GPLv3') + if not orig_incompatible: + new_incompatible = "GPLv3" + elif not orig_incompatible.find('GPLv3'): + new_incompatible = "%s GPLv3" % orig_incompatible else: - self.configurator.setLocalConfVar('INCOMPATIBLE_LICENSE', '') - self.reload_required = True + new_incompatible = orig_incompatible.replace('GPLv3', '') + + if new_incompatible != orig_incompatible: + self.handler.set_incompatible_license(new_incompatible) + self.configurator.setLocalConfVar('INCOMPATIBLE_LICENSE', new_incompatible) + self.reload_required = True def change_bb_threads_cb(self, spinner): val = spinner.get_value_as_int() @@ -149,7 +157,8 @@ class HobPrefs(gtk.Dialog): glib.idle_add(self.handler.reload_data) def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass, - cpu_cnt, pmake, bbthread, selected_image_types, all_image_types): + cpu_cnt, pmake, bbthread, selected_image_types, all_image_types, + gplv3disabled): """ """ gtk.Dialog.__init__(self, "Preferences", None, @@ -170,11 +179,13 @@ class HobPrefs(gtk.Dialog): self.cpu_cnt = cpu_cnt self.pmake = pmake self.bbthread = bbthread + self.selected_image_types = selected_image_types.split(" ") + self.gplv3disabled = gplv3disabled + self.reload_required = False self.distro_handler_id = None self.sdk_machine_handler_id = None self.package_handler_id = None - self.selected_image_types = selected_image_types.split(" ") left = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) right = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) @@ -205,6 +216,7 @@ class HobPrefs(gtk.Dialog): check = gtk.CheckButton("Exclude GPLv3 packages") check.set_tooltip_text("Check this box to prevent GPLv3 packages from being included in your image") check.show() + check.set_active(self.gplv3disabled) check.connect("toggled", self.include_gplv3_cb) hbox.pack_start(check, expand=False, fill=False, padding=6) hbox = gtk.HBox(False, 12) diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py index 90d5c5a..a5a2960 100644 --- a/bitbake/lib/bb/ui/hob.py +++ b/bitbake/lib/bb/ui/hob.py @@ -932,8 +932,14 @@ def main (server, eventHandler): # PACKAGE_CLASSES and that's the package manager used for the rootfs pkg, sep, pclass = pclasses[0].rpartition("_") + incompatible = server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) + gplv3disabled = False + if incompatible and incompatible.lower().find("gplv3"): + gplv3disabled = True + prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, cpu_cnt, - pmake, bbthread, selected_image_types, all_image_types) + pmake, bbthread, selected_image_types, all_image_types, + gplv3disabled) layers = LayerEditor(configurator, None) window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach) prefs.set_parent_window(window) |