diff options
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 6 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 3 | ||||
-rw-r--r-- | scripts/lib/recipetool/create.py | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 132a73d0ec..b64f9b3e76 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
@@ -207,12 +207,14 @@ class DevtoolTests(DevtoolBase): | |||
207 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 207 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
208 | self.track_for_cleanup(tempdir) | 208 | self.track_for_cleanup(tempdir) |
209 | pn = 'dbus-wait' | 209 | pn = 'dbus-wait' |
210 | srcrev = '6cc6077a36fe2648a5f993fe7c16c9632f946517' | ||
210 | # We choose an https:// git URL here to check rewriting the URL works | 211 | # We choose an https:// git URL here to check rewriting the URL works |
211 | url = 'https://git.yoctoproject.org/git/dbus-wait' | 212 | url = 'https://git.yoctoproject.org/git/dbus-wait' |
212 | # Force fetching to "noname" subdir so we verify we're picking up the name from autoconf | 213 | # Force fetching to "noname" subdir so we verify we're picking up the name from autoconf |
213 | # instead of the directory name | 214 | # instead of the directory name |
214 | result = runCmd('git clone %s noname' % url, cwd=tempdir) | 215 | result = runCmd('git clone %s noname' % url, cwd=tempdir) |
215 | srcdir = os.path.join(tempdir, 'noname') | 216 | srcdir = os.path.join(tempdir, 'noname') |
217 | result = runCmd('git reset --hard %s' % srcrev, cwd=srcdir) | ||
216 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure script in source directory') | 218 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure script in source directory') |
217 | # Test devtool add | 219 | # Test devtool add |
218 | self.track_for_cleanup(self.workspacedir) | 220 | self.track_for_cleanup(self.workspacedir) |
@@ -235,7 +237,7 @@ class DevtoolTests(DevtoolBase): | |||
235 | checkvars['S'] = '${WORKDIR}/git' | 237 | checkvars['S'] = '${WORKDIR}/git' |
236 | checkvars['PV'] = '0.1+git${SRCPV}' | 238 | checkvars['PV'] = '0.1+git${SRCPV}' |
237 | checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/dbus-wait;protocol=https' | 239 | checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/dbus-wait;protocol=https' |
238 | checkvars['SRCREV'] = '${AUTOREV}' | 240 | checkvars['SRCREV'] = srcrev |
239 | checkvars['DEPENDS'] = set(['dbus']) | 241 | checkvars['DEPENDS'] = set(['dbus']) |
240 | self._test_recipe_contents(recipefile, checkvars, []) | 242 | self._test_recipe_contents(recipefile, checkvars, []) |
241 | 243 | ||
@@ -345,7 +347,7 @@ class DevtoolTests(DevtoolBase): | |||
345 | self.track_for_cleanup(self.workspacedir) | 347 | self.track_for_cleanup(self.workspacedir) |
346 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) | 348 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) |
347 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 349 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
348 | result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url)) | 350 | result = runCmd('devtool add %s %s -a -f %s' % (testrecipe, srcdir, url)) |
349 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created: %s' % result.output) | 351 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created: %s' % result.output) |
350 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure.ac in source directory') | 352 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure.ac in source directory') |
351 | # Test devtool status | 353 | # Test devtool status |
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 | ||