mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
a10fb4f72a
commit
42fe3c6131
@@ -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 = {}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user