summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-11-14 17:07:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-21 11:49:23 +0000
commit0b6859cdf3a4b66bb8b94361681a5b6b362f93ae (patch)
tree37bf5c650e99b023bd0e0605b63a53cc0ebd0b72 /bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
parent5b0616ad7d7c3734f1818a56b631a2d254271678 (diff)
downloadpoky-0b6859cdf3a4b66bb8b94361681a5b6b362f93ae.tar.gz
bitbake: toastergui: layer name correlation
This patch modifies how layers are identified and matched. Layers were primarely organized by the source of layer information, and Releases were separated by both layer git branches and originating source of layer information. This setup prevented mixing layers from different sources for a certain release, which didn't match the way people use Yocto Project / bitbake. This patch brings name-based indentification, where layers with the same name are assumed to be equivalent, in the sense of being able to substitute one another. To facilitate this identification to humans, layers are differentiated by GIT URI instead of layer sources, which was a rather arbitrary abstraction. Additional changes include modification to models in order accomodate for the new data structure, and to config file loading to match the new toasterconf.json layout. (Bitbake rev: 4357200aed522ad56cfd84917f877645b83b6a70) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py47
1 files changed, 35 insertions, 12 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
index 56e4e1bf0c..cd604eba7e 100644
--- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
+++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py
@@ -34,6 +34,22 @@ class Command(NoArgsCommand):
34 return ret 34 return ret
35 return None 35 return None
36 36
37 def _recursive_list_directories(self, startdirectory, level = 0):
38 if level < 0:
39 return []
40 dirs = []
41 try:
42 for i in os.listdir(startdirectory):
43 j = os.path.join(startdirectory, i)
44 if os.path.isdir(j):
45 dirs.append(j)
46 except OSError:
47 pass
48 for j in dirs:
49 dirs = dirs + self._recursive_list_directories(j, level - 1)
50 return dirs
51
52
37 def _get_suggested_sourcedir(self, be): 53 def _get_suggested_sourcedir(self, be):
38 if be.betype != BuildEnvironment.TYPE_LOCAL: 54 if be.betype != BuildEnvironment.TYPE_LOCAL:
39 return "" 55 return ""
@@ -67,7 +83,6 @@ class Command(NoArgsCommand):
67 print("Verifying the Build Environment type %s id %d." % (be.get_betype_display(), be.pk)) 83 print("Verifying the Build Environment type %s id %d." % (be.get_betype_display(), be.pk))
68 if len(be.sourcedir) == 0: 84 if len(be.sourcedir) == 0:
69 suggesteddir = self._get_suggested_sourcedir(be) 85 suggesteddir = self._get_suggested_sourcedir(be)
70 homesourcedir = suggesteddir
71 be.sourcedir = raw_input(" -- Layer sources checkout directory may not be empty [guessed \"%s\"]:" % suggesteddir) 86 be.sourcedir = raw_input(" -- Layer sources checkout directory may not be empty [guessed \"%s\"]:" % suggesteddir)
72 if len(be.sourcedir) == 0 and len(suggesteddir) > 0: 87 if len(be.sourcedir) == 0 and len(suggesteddir) > 0:
73 be.sourcedir = suggesteddir 88 be.sourcedir = suggesteddir
@@ -94,17 +109,25 @@ class Command(NoArgsCommand):
94 be.save() 109 be.save()
95 110
96 if is_changed and be.betype == BuildEnvironment.TYPE_LOCAL: 111 if is_changed and be.betype == BuildEnvironment.TYPE_LOCAL:
97 baselayerdir = DN(DN(self._find_first_path_for_file(homesourcedir, "toasterconf.json", 3))) 112 for dirname in self._recursive_list_directories(be.sourcedir,2):
98 if baselayerdir: 113 if os.path.exists(os.path.join(dirname, ".templateconf")):
99 i = raw_input(" -- Do you want to import basic layer configuration from \"%s\" ? (y/N):" % baselayerdir) 114 import subprocess
100 if len(i) and i.upper()[0] == 'Y': 115 conffilepath, error = subprocess.Popen('bash -c ". '+os.path.join(dirname, ".templateconf")+'; echo \"\$TEMPLATECONF\""', shell=True, stdout=subprocess.PIPE).communicate()
101 from loadconf import Command as LoadConfigCommand 116 conffilepath = os.path.join(conffilepath.strip(), "toasterconf.json")
102 LoadConfigCommand()._import_layer_config(os.path.join(baselayerdir, "meta/conf/toasterconf.json")) 117 candidatefilepath = os.path.join(dirname, conffilepath)
103 # we run lsupdates after config update 118 if os.path.exists(candidatefilepath):
104 print "Updating information from the layer source, please wait." 119 i = raw_input(" -- Do you want to import basic layer configuration from \"%s\" ? (y/N):" % candidatefilepath)
105 from django.core.management import call_command 120 if len(i) and i.upper()[0] == 'Y':
106 call_command("lsupdates") 121 from loadconf import Command as LoadConfigCommand
107 pass 122
123 LoadConfigCommand()._import_layer_config(candidatefilepath)
124 # we run lsupdates after config update
125 print "Layer configuration imported. Updating information from the layer source, please wait."
126 from django.core.management import call_command
127 call_command("lsupdates")
128
129 # we don't look for any other config files
130 return is_changed
108 131
109 return is_changed 132 return is_changed
110 133