summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-05-30 10:21:02 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-01 12:38:41 +0100
commit49557a5e9d93665e2409e4b12850dc325dee19dd (patch)
treeeff75c2751073587d22bb1dcf2aaac6b2d587880 /scripts
parent0a7c699b3337806c63b745bf1e9736d296b8e42f (diff)
downloadpoky-49557a5e9d93665e2409e4b12850dc325dee19dd.tar.gz
recipetool / devtool: set a fixed SRCREV by default when fetching from git
If fetching source from a git repository, typically within OpenEmbedded we encourage setting SRCREV to a fixed revision, so change to do that by default and add a -a/--autorev option to use "${AUTOREV}" instead. (From OE-Core rev: 000480c42797dd2f03ebc3bc6d1dabfc6a7b75f5) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/standard.py3
-rw-r--r--scripts/lib/recipetool/create.py5
2 files changed, 8 insertions, 0 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 77a82d5590..3be32147ab 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -144,6 +144,8 @@ def add(args, config, basepath, workspace):
144 extracmdopts += ' --also-native' 144 extracmdopts += ' --also-native'
145 if args.src_subdir: 145 if args.src_subdir:
146 extracmdopts += ' --src-subdir "%s"' % args.src_subdir 146 extracmdopts += ' --src-subdir "%s"' % args.src_subdir
147 if args.autorev:
148 extracmdopts += ' -a'
147 149
148 tempdir = tempfile.mkdtemp(prefix='devtool') 150 tempdir = tempfile.mkdtemp(prefix='devtool')
149 try: 151 try:
@@ -1390,6 +1392,7 @@ def register_commands(subparsers, context):
1390 parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)', metavar='URI') 1392 parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)', metavar='URI')
1391 parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') 1393 parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)')
1392 parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") 1394 parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true")
1395 parser_add.add_argument('--autorev', '-a', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true")
1393 parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.', action='store_true') 1396 parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.', action='store_true')
1394 parser_add.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') 1397 parser_add.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true')
1395 parser_add.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') 1398 parser_add.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR')
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 1899a0dcd8..4a59363eea 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -563,6 +563,10 @@ def create_recipe(args):
563 lines_before.append('') 563 lines_before.append('')
564 lines_before.append('# Modify these as desired') 564 lines_before.append('# Modify these as desired')
565 lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0')) 565 lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0'))
566 if not args.autorev and srcrev == '${AUTOREV}':
567 if os.path.exists(os.path.join(srctree, '.git')):
568 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
569 srcrev = stdout.rstrip()
566 lines_before.append('SRCREV = "%s"' % srcrev) 570 lines_before.append('SRCREV = "%s"' % srcrev)
567 lines_before.append('') 571 lines_before.append('')
568 572
@@ -1049,5 +1053,6 @@ def register_commands(subparsers):
1049 parser_create.add_argument('-b', '--binary', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure)', action='store_true') 1053 parser_create.add_argument('-b', '--binary', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure)', action='store_true')
1050 parser_create.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') 1054 parser_create.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true')
1051 parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') 1055 parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR')
1056 parser_create.add_argument('-a', '--autorev', help='When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed', action="store_true")
1052 parser_create.set_defaults(func=create_recipe) 1057 parser_create.set_defaults(func=create_recipe)
1053 1058