summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-05-30 10:20:59 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-01 12:38:41 +0100
commit2b510f5e018fed5f0e679d887656a501a6a38aaa (patch)
tree8cbe6c7f640defa9137229edd0feb3b1ee644f49 /scripts/lib/recipetool/create.py
parentc056dad62cdc4d4043e8ac91ff103d234005660f (diff)
downloadpoky-2b510f5e018fed5f0e679d887656a501a6a38aaa.tar.gz
recipetool: create: support extracting SUMMARY and HOMEPAGE
Allow plugins to set any variable value through the extravalues dict, and use this to support extracting SUMMARY and HOMEPAGE values from spec files included with the source; additionally translate "License:" to a comment next to the LICENSE field (we have our own logic for setting LICENSE, but it will often be useful to see what the spec file says if one is present). Also use the same mechanism for setting the same variables for node.js modules; this was already supported but wasn't inserting the settings in the appropriate place in the file which this will now do. (From OE-Core rev: 91fc35ff5e89aa6d4c4ad945e45406fb4f71018e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py49
1 files changed, 27 insertions, 22 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index aade40b5a8..66c881a17a 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -331,6 +331,7 @@ def create_recipe(args):
331 import bb.process 331 import bb.process
332 import tempfile 332 import tempfile
333 import shutil 333 import shutil
334 import oe.recipeutils
334 335
335 pkgarch = "" 336 pkgarch = ""
336 if args.machine: 337 if args.machine:
@@ -429,7 +430,8 @@ def create_recipe(args):
429 lines_before.append('# Recipe created by %s' % os.path.basename(sys.argv[0])) 430 lines_before.append('# Recipe created by %s' % os.path.basename(sys.argv[0]))
430 lines_before.append('# This is the basis of a recipe and may need further editing in order to be fully functional.') 431 lines_before.append('# This is the basis of a recipe and may need further editing in order to be fully functional.')
431 lines_before.append('# (Feel free to remove these comments when editing.)') 432 lines_before.append('# (Feel free to remove these comments when editing.)')
432 lines_before.append('#') 433 # We need a blank line here so that patch_recipe_lines can rewind before the LICENSE comments
434 lines_before.append('')
433 435
434 licvalues = guess_license(srctree_use) 436 licvalues = guess_license(srctree_use)
435 lic_files_chksum = [] 437 lic_files_chksum = []
@@ -561,28 +563,28 @@ def create_recipe(args):
561 handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues) 563 handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues)
562 564
563 extrafiles = extravalues.pop('extrafiles', {}) 565 extrafiles = extravalues.pop('extrafiles', {})
566 extra_pn = extravalues.pop('PN', None)
567 extra_pv = extravalues.pop('PV', None)
564 568
565 if not realpv: 569 if extra_pv and not realpv:
566 realpv = extravalues.get('PV', None) 570 realpv = extra_pv
567 if realpv: 571 if not validate_pv(realpv):
568 if not validate_pv(realpv): 572 realpv = None
569 realpv = None 573 else:
570 else: 574 realpv = realpv.lower().split()[0]
571 realpv = realpv.lower().split()[0] 575 if '_' in realpv:
572 if '_' in realpv: 576 realpv = realpv.replace('_', '-')
573 realpv = realpv.replace('_', '-') 577 if extra_pn and not pn:
574 if not pn: 578 pn = extra_pn
575 pn = extravalues.get('PN', None) 579 if pn.startswith('GNU '):
576 if pn: 580 pn = pn[4:]
577 if pn.startswith('GNU '): 581 if ' ' in pn:
578 pn = pn[4:] 582 # Probably a descriptive identifier rather than a proper name
579 if ' ' in pn: 583 pn = None
580 # Probably a descriptive identifier rather than a proper name 584 else:
581 pn = None 585 pn = pn.lower()
582 else: 586 if '_' in pn:
583 pn = pn.lower() 587 pn = pn.replace('_', '-')
584 if '_' in pn:
585 pn = pn.replace('_', '-')
586 588
587 if not outfile: 589 if not outfile:
588 if not pn: 590 if not pn:
@@ -662,6 +664,9 @@ def create_recipe(args):
662 outlines.append('') 664 outlines.append('')
663 outlines.extend(lines_after) 665 outlines.extend(lines_after)
664 666
667 if extravalues:
668 _, outlines = oe.recipeutils.patch_recipe_lines(outlines, extravalues, trailing_newline=False)
669
665 if args.extract_to: 670 if args.extract_to:
666 scriptutils.git_convert_standalone_clone(srctree) 671 scriptutils.git_convert_standalone_clone(srctree)
667 if os.path.isdir(args.extract_to): 672 if os.path.isdir(args.extract_to):