summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2012-03-29 20:01:19 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-29 21:25:54 +0100
commit1c3ff8623f03a4995fc07fb9fa4a914e02b3b048 (patch)
tree7c55df5c32bc72d34336457b8427dc93a41d4e6c /bitbake
parentf5fd769f5aa72089b3d10bddc6f38141e6b431c5 (diff)
downloadpoky-1c3ff8623f03a4995fc07fb9fa4a914e02b3b048.tar.gz
Hob: Fix the setting hash calculation
Sometimes even setting are not changed, the hash values differs due to variable order issue. This commit fixes the issue. (Bitbake rev: 1fe0996f89952af72cbdc46ca7c6495868d27a56) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index a21c6106a4..9adb28117a 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -337,19 +337,30 @@ class AdvancedSettingDialog (CrumbsDialog):
337 self.setting_store = None 337 self.setting_store = None
338 self.image_types_checkbuttons = {} 338 self.image_types_checkbuttons = {}
339 339
340 self.variables = {} 340 self.md5 = self.config_md5()
341 self.variables["PACKAGE_FORMAT"] = self.configuration.curr_package_format
342 self.variables["INCOMPATIBLE_LICENSE"] = self.configuration.incompat_license
343 self.variables["IMAGE_FSTYPES"] = self.configuration.image_fstypes
344 for key in self.configuration.extra_setting.keys():
345 self.variables[key] = self.configuration.extra_setting[key]
346 self.md5 = hashlib.md5(str(sorted(self.variables.items()))).hexdigest()
347 self.settings_changed = False 341 self.settings_changed = False
348 342
349 # create visual elements on the dialog 343 # create visual elements on the dialog
350 self.create_visual_elements() 344 self.create_visual_elements()
351 self.connect("response", self.response_cb) 345 self.connect("response", self.response_cb)
352 346
347 def _get_sorted_value(self, var):
348 return " ".join(sorted(str(var).split())) + "\n"
349
350 def config_md5(self):
351 data = ""
352 data += ("PACKAGE_CLASSES: " + self.configuration.curr_package_format + '\n')
353 data += ("DISTRO: " + self._get_sorted_value(self.configuration.curr_distro))
354 data += ("IMAGE_ROOTFS_SIZE: " + self._get_sorted_value(self.configuration.image_rootfs_size))
355 data += ("IMAGE_EXTRA_SIZE: " + self._get_sorted_value(self.configuration.image_extra_size))
356 data += ("INCOMPATIBLE_LICENSE: " + self._get_sorted_value(self.configuration.incompat_license))
357 data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine))
358 data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build))
359 data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes))
360 for key in self.configuration.extra_setting.keys():
361 data += (key + ": " + self._get_sorted_value(self.configuration.extra_setting[key]))
362 return hashlib.md5(data).hexdigest()
363
353 def create_visual_elements(self): 364 def create_visual_elements(self):
354 self.nb = gtk.Notebook() 365 self.nb = gtk.Notebook()
355 self.nb.set_show_tabs(True) 366 self.nb.set_show_tabs(True)
@@ -589,15 +600,12 @@ class AdvancedSettingDialog (CrumbsDialog):
589 self.cvs_proxy_text.set_sensitive(self.enable_proxy) 600 self.cvs_proxy_text.set_sensitive(self.enable_proxy)
590 601
591 def response_cb(self, dialog, response_id): 602 def response_cb(self, dialog, response_id):
592 self.variables = {}
593
594 package_format = [] 603 package_format = []
595 package_format.append(self.rootfs_combo.get_active_text()) 604 package_format.append(self.rootfs_combo.get_active_text())
596 for child in self.check_hbox: 605 for child in self.check_hbox:
597 if isinstance(child, gtk.CheckButton) and child.get_active(): 606 if isinstance(child, gtk.CheckButton) and child.get_active():
598 package_format.append(child.get_label()) 607 package_format.append(child.get_label())
599 self.configuration.curr_package_format = " ".join(package_format) 608 self.configuration.curr_package_format = " ".join(package_format)
600 self.variables["PACKAGE_FORMAT"] = self.configuration.curr_package_format
601 609
602 self.configuration.curr_distro = self.distro_combo.get_active_text() 610 self.configuration.curr_distro = self.distro_combo.get_active_text()
603 self.configuration.dldir = self.dldir_text.get_text() 611 self.configuration.dldir = self.dldir_text.get_text()
@@ -613,7 +621,6 @@ class AdvancedSettingDialog (CrumbsDialog):
613 if self.image_types_checkbuttons[image_type].get_active(): 621 if self.image_types_checkbuttons[image_type].get_active():
614 self.configuration.image_fstypes += (" " + image_type) 622 self.configuration.image_fstypes += (" " + image_type)
615 self.configuration.image_fstypes.strip() 623 self.configuration.image_fstypes.strip()
616 self.variables["IMAGE_FSTYPES"] = self.configuration.image_fstypes
617 624
618 if self.gplv3_checkbox.get_active(): 625 if self.gplv3_checkbox.get_active():
619 if "GPLv3" not in self.configuration.incompat_license.split(): 626 if "GPLv3" not in self.configuration.incompat_license.split():
@@ -623,7 +630,6 @@ class AdvancedSettingDialog (CrumbsDialog):
623 self.configuration.incompat_license = self.configuration.incompat_license.split().remove("GPLv3") 630 self.configuration.incompat_license = self.configuration.incompat_license.split().remove("GPLv3")
624 self.configuration.incompat_license = " ".join(self.configuration.incompat_license or []) 631 self.configuration.incompat_license = " ".join(self.configuration.incompat_license or [])
625 self.configuration.incompat_license = self.configuration.incompat_license.strip() 632 self.configuration.incompat_license = self.configuration.incompat_license.strip()
626 self.variables["INCOMPATIBLE_LICENSE"] = self.configuration.incompat_license
627 633
628 self.configuration.toolchain_build = self.toolchain_checkbox.get_active() 634 self.configuration.toolchain_build = self.toolchain_checkbox.get_active()
629 635
@@ -633,7 +639,6 @@ class AdvancedSettingDialog (CrumbsDialog):
633 key = self.setting_store.get_value(it, 0) 639 key = self.setting_store.get_value(it, 0)
634 value = self.setting_store.get_value(it, 1) 640 value = self.setting_store.get_value(it, 1)
635 self.configuration.extra_setting[key] = value 641 self.configuration.extra_setting[key] = value
636 self.variables[key] = value
637 it = self.setting_store.iter_next(it) 642 it = self.setting_store.iter_next(it)
638 643
639 self.configuration.all_proxy = self.all_proxy_text.get_text() 644 self.configuration.all_proxy = self.all_proxy_text.get_text()
@@ -643,7 +648,7 @@ class AdvancedSettingDialog (CrumbsDialog):
643 self.configuration.git_proxy_host, self.configuration.git_proxy_port = self.git_proxy_text.get_text().split(':') 648 self.configuration.git_proxy_host, self.configuration.git_proxy_port = self.git_proxy_text.get_text().split(':')
644 self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port = self.cvs_proxy_text.get_text().split(':') 649 self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port = self.cvs_proxy_text.get_text().split(':')
645 650
646 md5 = hashlib.md5(str(sorted(self.variables.items()))).hexdigest() 651 md5 = self.config_md5()
647 self.settings_changed = (self.md5 != md5) 652 self.settings_changed = (self.md5 != md5)
648 653
649# 654#