summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorAlejandro Enedino Hernandez Samaniego <alejandro.enedino.hernandez-samaniego@xilinx.com>2018-04-02 13:08:41 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-03 23:53:20 +0100
commitb9d51eceac50afd77e2d725253c1d9b35b67aeee (patch)
tree86793b0be674cc350d36309ded54984b5724d696 /meta/recipes-devtools
parent4f7e90a0afa9ca685d5c4356255df33f95d915b8 (diff)
downloadpoky-b9d51eceac50afd77e2d725253c1d9b35b67aeee.tar.gz
python3: Improve logging capabilities for do_create_manifest
Adds a couple of prints to get a nicer log, and creates a small summary or report after checking every module, it makes it more feasible for adoption, easier to debug why a module ended at a certain package and see how the manifest was created. (From OE-Core rev: 4c2af72f51a7bf187615fc0b3a229d25c3e191e9) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/python/python3/create_manifest3.py34
1 files changed, 27 insertions, 7 deletions
diff --git a/meta/recipes-devtools/python/python3/create_manifest3.py b/meta/recipes-devtools/python/python3/create_manifest3.py
index 212ddd434a..44f3454582 100644
--- a/meta/recipes-devtools/python/python3/create_manifest3.py
+++ b/meta/recipes-devtools/python/python3/create_manifest3.py
@@ -80,7 +80,7 @@ with open('python3-manifest.json') as manifest:
80 80
81# First pass to get core-package functionality, because we base everything on the fact that core is actually working 81# First pass to get core-package functionality, because we base everything on the fact that core is actually working
82# Not exactly the same so it should not be a function 82# Not exactly the same so it should not be a function
83print ('Getting dependencies for core package:') 83print ('Getting dependencies for package: core')
84 84
85# Special call to check for core package 85# Special call to check for core package
86output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package']).decode('utf8') 86output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package']).decode('utf8')
@@ -128,6 +128,7 @@ for value in old_manifest['core']['files']:
128 # Each module will only import what is necessary for it to work in specific 128 # Each module will only import what is necessary for it to work in specific
129 print ('Getting dependencies for module: %s' % value) 129 print ('Getting dependencies for module: %s' % value)
130 output = subprocess.check_output([sys.executable, 'get_module_deps3.py', '%s' % value]).decode('utf8') 130 output = subprocess.check_output([sys.executable, 'get_module_deps3.py', '%s' % value]).decode('utf8')
131 print ('The following dependencies were found for module %s:\n' % value)
131 print (output) 132 print (output)
132 for item in output.split(): 133 for item in output.split():
133 # We append it so it doesnt hurt what we currently have: 134 # We append it so it doesnt hurt what we currently have:
@@ -170,7 +171,10 @@ for key in old_manifest:
170 171
171 # Handle special cases, we assume that when they were manually added 172 # Handle special cases, we assume that when they were manually added
172 # to the manifest we knew what we were doing. 173 # to the manifest we knew what we were doing.
174 print('\n')
175 print('--------------------------')
173 print ('Handling package %s' % key) 176 print ('Handling package %s' % key)
177 print('--------------------------')
174 special_packages=['misc', 'modules', 'dev'] 178 special_packages=['misc', 'modules', 'dev']
175 if key in special_packages or 'staticdev' in key: 179 if key in special_packages or 'staticdev' in key:
176 print('Passing %s package directly' % key) 180 print('Passing %s package directly' % key)
@@ -219,11 +223,16 @@ for key in old_manifest:
219 223
220 # Launch separate task for each module for deterministic behavior 224 # Launch separate task for each module for deterministic behavior
221 # Each module will only import what is necessary for it to work in specific 225 # Each module will only import what is necessary for it to work in specific
222 print ('Getting dependencies for module: %s' % value) 226 print ('\nGetting dependencies for module: %s' % value)
223 output = subprocess.check_output([sys.executable, 'get_module_deps3.py', '%s' % value]).decode('utf8') 227 output = subprocess.check_output([sys.executable, 'get_module_deps3.py', '%s' % value]).decode('utf8')
224 # We can print dependencies for debugging purposes 228 # We can print dependencies for debugging purposes
229 print ('The following dependencies were found for module %s:\n' % value)
225 print (output) 230 print (output)
226 # Output will have all dependencies 231 # Output will have all dependencies
232
233 reportFILES = []
234 reportRDEPS = []
235
227 for item in output.split(): 236 for item in output.split():
228 237
229 # Warning: This first part is ugly 238 # Warning: This first part is ugly
@@ -255,7 +264,7 @@ for key in old_manifest:
255 #print('Checking folder %s on package %s' % (item,keyfolder)) 264 #print('Checking folder %s on package %s' % (item,keyfolder))
256 for file_folder in old_manifest[keyfolder]['files'] or file_folder in old_manifest[keyfolder]['cached']: 265 for file_folder in old_manifest[keyfolder]['files'] or file_folder in old_manifest[keyfolder]['cached']:
257 if file_folder==folder: 266 if file_folder==folder:
258 print ('%s found in %s' % (folder, keyfolder)) 267 print ('%s folder found in %s' % (folder, keyfolder))
259 folderFound = True 268 folderFound = True
260 if keyfolder not in new_manifest[key]['rdepends'] and keyfolder != key: 269 if keyfolder not in new_manifest[key]['rdepends'] and keyfolder != key:
261 new_manifest[key]['rdepends'].append(keyfolder) 270 new_manifest[key]['rdepends'].append(keyfolder)
@@ -267,6 +276,7 @@ for key in old_manifest:
267 if inFolders: 276 if inFolders:
268 continue 277 continue
269 278
279
270 # We might already have it on the dictionary since it could depend on a (previously checked) module 280 # We might already have it on the dictionary since it could depend on a (previously checked) module
271 if item not in new_manifest[key]['files'] and item not in new_manifest[key]['cached']: 281 if item not in new_manifest[key]['files'] and item not in new_manifest[key]['cached']:
272 # Handle core as a special package, we already did it so we pass it to NEW data structure directly 282 # Handle core as a special package, we already did it so we pass it to NEW data structure directly
@@ -287,6 +297,7 @@ for key in old_manifest:
287 297
288 else: 298 else:
289 299
300
290 # Check if this dependency is already contained on another package, so we add it 301 # Check if this dependency is already contained on another package, so we add it
291 # as an RDEPENDS, or if its not, it means it should be contained on the current 302 # as an RDEPENDS, or if its not, it means it should be contained on the current
292 # package, so we should add it to FILES 303 # package, so we should add it to FILES
@@ -298,19 +309,19 @@ for key in old_manifest:
298 if(newkey!=key): 309 if(newkey!=key):
299 if newkey not in new_manifest[key]['rdepends']: 310 if newkey not in new_manifest[key]['rdepends']:
300 # Add it to the new manifest data struct 311 # Add it to the new manifest data struct
301 # Debug 312 reportRDEPS.append('Adding %s to %s RDEPENDS, because it contains %s\n' % (newkey, key, item))
302 print('Adding %s to %s RDEPENDS, because it contains %s' % (newkey, key, item))
303 new_manifest[key]['rdepends'].append(newkey) 313 new_manifest[key]['rdepends'].append(newkey)
304 break 314 break
305 else: 315 else:
306 # A module shouldn't contain itself (${libdir}/python3/sqlite3 shouldnt be on sqlite3 files) 316 # A module shouldn't contain itself (${libdir}/python3/sqlite3 shouldnt be on sqlite3 files)
307 if os.path.basename(item) != key: 317 if os.path.basename(item) != key:
308 print('Adding %s to %s FILES' % (item, key)) 318 reportFILES.append(('Adding %s to %s FILES\n' % (item, key)))
309 # Since it wasnt found on another package, its not an RDEP, so add it to FILES for this package 319 # Since it wasnt found on another package, its not an RDEP, so add it to FILES for this package
310 if isCached(item): 320 if isCached(item):
311 new_manifest[key]['cached'].append(item) 321 new_manifest[key]['cached'].append(item)
312 else: 322 else:
313 new_manifest[key]['files'].append(item) 323 new_manifest[key]['files'].append(item)
324
314 if item.endswith('*'): 325 if item.endswith('*'):
315 wildcards.append(item) 326 wildcards.append(item)
316 if item not in allfiles: 327 if item not in allfiles:
@@ -318,6 +329,15 @@ for key in old_manifest:
318 else: 329 else:
319 repeated.append(item) 330 repeated.append(item)
320 331
332 print('\n')
333 print('#################################')
334 print('Summary for module %s' % value)
335 print('FILES found for module %s:' % value)
336 print(''.join(reportFILES))
337 print('RDEPENDS found for module %s:' % value)
338 print(''.join(reportRDEPS))
339 print('#################################')
340
321print ('The following files are repeated (contained in more than one package), please check which package should get it:') 341print ('The following files are repeated (contained in more than one package), please check which package should get it:')
322print (repeated) 342print (repeated)
323print('The following files contain wildcards, please check they are necessary') 343print('The following files contain wildcards, please check they are necessary')
@@ -334,4 +354,4 @@ for key in new_manifest:
334# Create the manifest from the data structure that was built 354# Create the manifest from the data structure that was built
335with open('python3-manifest.json.new','w') as outfile: 355with open('python3-manifest.json.new','w') as outfile:
336 json.dump(new_manifest,outfile,sort_keys=True, indent=4) 356 json.dump(new_manifest,outfile,sort_keys=True, indent=4)
337 outfile.write("\n") 357 outfile.write('\n')