diff options
Diffstat (limited to 'scripts/lib/recipetool/create.py')
| -rw-r--r-- | scripts/lib/recipetool/create.py | 49 |
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): |
