summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-04-28 17:07:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-01 17:08:50 +0100
commit4502daefb8f6da31f3fe9f0e8d34d0a5d667640e (patch)
tree28e088544075be718d53f583947cfaed155876cf /scripts/lib/recipetool/create.py
parent266ea28183516646195226c9ac3297a5f45d3834 (diff)
downloadpoky-4502daefb8f6da31f3fe9f0e8d34d0a5d667640e.tar.gz
devtool: add: use the appropriate file naming and versioning for SCM recipes
* Recipes that fetch from git, svn or hg by OpenEmbedded convention should normally be named with this as a suffix, since PV is meant to be set appropriately within the recipe, so follow this. In order to make this work we need to be able to have the version independent from the file name, so add a -V option to recipetool create to allow this to be specified. * If -V is specified on the devtool add command line, ensure at PV gets set to include this version. (From OE-Core rev: 2b997c41c6476a13bf516586d56a9051aceb93ec) 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.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 0c413688c0..cd45998f64 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -187,9 +187,17 @@ def create_recipe(args):
187 pn = recipefn 187 pn = recipefn
188 pv = None 188 pv = None
189 189
190 if args.version:
191 pv = args.version
192
193 if pv and pv not in 'git svn hg'.split():
194 realpv = pv
195 else:
196 realpv = None
197
190 if srcuri: 198 if srcuri:
191 if pv and pv not in 'git svn hg'.split(): 199 if realpv:
192 srcuri = srcuri.replace(pv, '${PV}') 200 srcuri = srcuri.replace(realpv, '${PV}')
193 else: 201 else:
194 lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') 202 lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)')
195 lines_before.append('SRC_URI = "%s"' % srcuri) 203 lines_before.append('SRC_URI = "%s"' % srcuri)
@@ -201,7 +209,7 @@ def create_recipe(args):
201 if srcuri and supports_srcrev(srcuri): 209 if srcuri and supports_srcrev(srcuri):
202 lines_before.append('') 210 lines_before.append('')
203 lines_before.append('# Modify these as desired') 211 lines_before.append('# Modify these as desired')
204 lines_before.append('PV = "1.0+git${SRCPV}"') 212 lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0'))
205 lines_before.append('SRCREV = "${AUTOREV}"') 213 lines_before.append('SRCREV = "${AUTOREV}"')
206 lines_before.append('') 214 lines_before.append('')
207 215
@@ -418,5 +426,6 @@ def register_command(subparsers):
418 parser_create.add_argument('-o', '--outfile', help='Specify filename for recipe to create', required=True) 426 parser_create.add_argument('-o', '--outfile', help='Specify filename for recipe to create', required=True)
419 parser_create.add_argument('-m', '--machine', help='Make recipe machine-specific as opposed to architecture-specific', action='store_true') 427 parser_create.add_argument('-m', '--machine', help='Make recipe machine-specific as opposed to architecture-specific', action='store_true')
420 parser_create.add_argument('-x', '--extract-to', metavar='EXTRACTPATH', help='Assuming source is a URL, fetch it and extract it to the directory specified as %(metavar)s') 428 parser_create.add_argument('-x', '--extract-to', metavar='EXTRACTPATH', help='Assuming source is a URL, fetch it and extract it to the directory specified as %(metavar)s')
429 parser_create.add_argument('-V', '--version', help='Version to use within recipe (PV)')
421 parser_create.set_defaults(func=create_recipe) 430 parser_create.set_defaults(func=create_recipe)
422 431