diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/devtool/standard.py | 14 | ||||
| -rw-r--r-- | scripts/lib/recipetool/create.py | 15 |
2 files changed, 25 insertions, 4 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 06b184bca5..cb4b57be92 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -65,11 +65,21 @@ def add(args, config, basepath, workspace): | |||
| 65 | 65 | ||
| 66 | recipedir = os.path.join(config.workspace_path, 'recipes', args.recipename) | 66 | recipedir = os.path.join(config.workspace_path, 'recipes', args.recipename) |
| 67 | bb.utils.mkdirhier(recipedir) | 67 | bb.utils.mkdirhier(recipedir) |
| 68 | rfv = None | ||
| 68 | if args.version: | 69 | if args.version: |
| 69 | if '_' in args.version or ' ' in args.version: | 70 | if '_' in args.version or ' ' in args.version: |
| 70 | logger.error('Invalid version string "%s"' % args.version) | 71 | logger.error('Invalid version string "%s"' % args.version) |
| 71 | return -1 | 72 | return -1 |
| 72 | bp = "%s_%s" % (args.recipename, args.version) | 73 | rfv = args.version |
| 74 | if args.fetch: | ||
| 75 | if args.fetch.startswith('git://'): | ||
| 76 | rfv = 'git' | ||
| 77 | elif args.fetch.startswith('svn://'): | ||
| 78 | rfv = 'svn' | ||
| 79 | elif args.fetch.startswith('hg://'): | ||
| 80 | rfv = 'hg' | ||
| 81 | if rfv: | ||
| 82 | bp = "%s_%s" % (args.recipename, rfv) | ||
| 73 | else: | 83 | else: |
| 74 | bp = args.recipename | 84 | bp = args.recipename |
| 75 | recipefile = os.path.join(recipedir, "%s.bb" % bp) | 85 | recipefile = os.path.join(recipedir, "%s.bb" % bp) |
| @@ -83,6 +93,8 @@ def add(args, config, basepath, workspace): | |||
| 83 | extracmdopts = '-x %s' % srctree | 93 | extracmdopts = '-x %s' % srctree |
| 84 | else: | 94 | else: |
| 85 | source = srctree | 95 | source = srctree |
| 96 | if args.version: | ||
| 97 | extracmdopts += ' -V %s' % args.version | ||
| 86 | stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts)) | 98 | stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts)) |
| 87 | logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) | 99 | logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) |
| 88 | 100 | ||
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 | ||
