diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-08-21 17:39:48 +1200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-23 08:47:02 +0100 |
| commit | a7baa47c876c7895499909731aaa451c6009610a (patch) | |
| tree | 2bf28609749dd90cc223ea2c9719d91519551240 /scripts/lib/recipetool/create.py | |
| parent | e798b4e9808c9297ee7de01ebb381ca649777501 (diff) | |
| download | poky-a7baa47c876c7895499909731aaa451c6009610a.tar.gz | |
recipetool: allow plugins to set PN / PV more easily
Previously if we were able to auto-determine the name from the URL, that
took precedence over any name that might be set in extravalues by a
plugin. Some plugins might be able to get a better idea of the name and
thus we should move defaulting of the name further down after the
plugins have had a chance to set it.
(From OE-Core rev: 3bb979c13463705c4db6c59034661c4cd8100756)
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.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 3abdad0fbc..40bd3c820b 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
| @@ -656,13 +656,6 @@ def create_recipe(args): | |||
| 656 | else: | 656 | else: |
| 657 | realpv = None | 657 | realpv = None |
| 658 | 658 | ||
| 659 | if srcuri and not realpv or not pn: | ||
| 660 | name_pn, name_pv = determine_from_url(srcuri) | ||
| 661 | if name_pn and not pn: | ||
| 662 | pn = name_pn | ||
| 663 | if name_pv and not realpv: | ||
| 664 | realpv = name_pv | ||
| 665 | |||
| 666 | if not srcuri: | 659 | if not srcuri: |
| 667 | lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') | 660 | lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') |
| 668 | lines_before.append('SRC_URI = "%s"' % srcuri) | 661 | lines_before.append('SRC_URI = "%s"' % srcuri) |
| @@ -671,6 +664,7 @@ def create_recipe(args): | |||
| 671 | if srcuri and supports_srcrev(srcuri): | 664 | if srcuri and supports_srcrev(srcuri): |
| 672 | lines_before.append('') | 665 | lines_before.append('') |
| 673 | lines_before.append('# Modify these as desired') | 666 | lines_before.append('# Modify these as desired') |
| 667 | # Note: we have code to replace realpv further down if it gets set to some other value | ||
| 674 | lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0')) | 668 | lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0')) |
| 675 | pv_srcpv = True | 669 | pv_srcpv = True |
| 676 | if not args.autorev and srcrev == '${AUTOREV}': | 670 | if not args.autorev and srcrev == '${AUTOREV}': |
| @@ -750,6 +744,13 @@ def create_recipe(args): | |||
| 750 | if '_' in pn: | 744 | if '_' in pn: |
| 751 | pn = pn.replace('_', '-') | 745 | pn = pn.replace('_', '-') |
| 752 | 746 | ||
| 747 | if srcuri and not realpv or not pn: | ||
| 748 | name_pn, name_pv = determine_from_url(srcuri) | ||
| 749 | if name_pn and not pn: | ||
| 750 | pn = name_pn | ||
| 751 | if name_pv and not realpv: | ||
| 752 | realpv = name_pv | ||
| 753 | |||
| 753 | if not outfile: | 754 | if not outfile: |
| 754 | if not pn: | 755 | if not pn: |
| 755 | log_error_cond('Unable to determine short program name from source tree - please specify name with -N/--name or output file name with -o/--outfile', args.devtool) | 756 | log_error_cond('Unable to determine short program name from source tree - please specify name with -N/--name or output file name with -o/--outfile', args.devtool) |
| @@ -803,6 +804,7 @@ def create_recipe(args): | |||
| 803 | line = line.replace(realpv, '${PV}') | 804 | line = line.replace(realpv, '${PV}') |
| 804 | elif line.startswith('PV = '): | 805 | elif line.startswith('PV = '): |
| 805 | if realpv: | 806 | if realpv: |
| 807 | # Replace the first part of the PV value | ||
| 806 | line = re.sub('"[^+]*\+', '"%s+' % realpv, line) | 808 | line = re.sub('"[^+]*\+', '"%s+' % realpv, line) |
| 807 | lines_before.append(line) | 809 | lines_before.append(line) |
| 808 | 810 | ||
