aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-04-28 14:23:31 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-05-30 10:18:24 +1200
commitafcecfbd2c40cc6fde80c5218db94902dd50866a (patch)
tree8891dd060086d15b99e44c7d4fe42439a9b1857b /scripts/lib/recipetool/create.py
parentbc34623687dfbf932402c899e044d867113b7138 (diff)
downloadopenembedded-core-contrib-paule/recipetool-fixes2-oe.tar.gz
openembedded-core-contrib-paule/recipetool-fixes2-oe.tar.bz2
openembedded-core-contrib-paule/recipetool-fixes2-oe.zip
recipetool / devtool: set a fixed SRCREV by default when fetching from gitpaule/recipetool-fixes2-oe
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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 1899a0dcd83..4a59363eeac 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -563,6 +563,10 @@ def create_recipe(args):
lines_before.append('')
lines_before.append('# Modify these as desired')
lines_before.append('PV = "%s+git${SRCPV}"' % (realpv or '1.0'))
+ if not args.autorev and srcrev == '${AUTOREV}':
+ if os.path.exists(os.path.join(srctree, '.git')):
+ (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
+ srcrev = stdout.rstrip()
lines_before.append('SRCREV = "%s"' % srcrev)
lines_before.append('')
@@ -1049,5 +1053,6 @@ def register_commands(subparsers):
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')
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')
parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR')
+ 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")
parser_create.set_defaults(func=create_recipe)