diff options
Diffstat (limited to 'scripts/lib/recipetool/create.py')
| -rw-r--r-- | scripts/lib/recipetool/create.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 8d59e65a8f..e48e418df5 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
| @@ -423,6 +423,7 @@ def create_recipe(args): | |||
| 423 | srcsubdir = '' | 423 | srcsubdir = '' |
| 424 | srcrev = '${AUTOREV}' | 424 | srcrev = '${AUTOREV}' |
| 425 | srcbranch = '' | 425 | srcbranch = '' |
| 426 | storeTagName = '' | ||
| 426 | 427 | ||
| 427 | if os.path.isfile(source): | 428 | if os.path.isfile(source): |
| 428 | source = 'file://%s' % os.path.abspath(source) | 429 | source = 'file://%s' % os.path.abspath(source) |
| @@ -446,13 +447,21 @@ def create_recipe(args): | |||
| 446 | scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(fetchuri) | 447 | scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(fetchuri) |
| 447 | srcbranch = params.get('branch') | 448 | srcbranch = params.get('branch') |
| 448 | nobranch = params.get('nobranch') | 449 | nobranch = params.get('nobranch') |
| 450 | tag = params.get('tag') | ||
| 449 | if not srcbranch and not nobranch and srcrev != '${AUTOREV}': | 451 | if not srcbranch and not nobranch and srcrev != '${AUTOREV}': |
| 450 | # Append nobranch=1 in the following conditions: | 452 | # Append nobranch=1 in the following conditions: |
| 451 | # 1. User did not set 'branch=' in srcuri, and | 453 | # 1. User did not set 'branch=' in srcuri, and |
| 452 | # 2. User did not set 'nobranch=1' in srcuri, and | 454 | # 2. User did not set 'nobranch=1' in srcuri, and |
| 453 | # 3. Source revision is not '${AUTOREV}' | 455 | # 3. Source revision is not '${AUTOREV}' |
| 454 | params['nobranch'] = '1' | 456 | params['nobranch'] = '1' |
| 455 | fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) | 457 | if tag: |
| 458 | # Keep a copy of tag and append nobranch=1 then remove tag from URL. | ||
| 459 | # Bitbake fetcher unable to fetch when {AUTOREV} and tag is set at the same time. | ||
| 460 | # We will re-introduce tag argument after bitbake fetcher process is complete. | ||
| 461 | storeTagName = params['tag'] | ||
| 462 | params['nobranch'] = '1' | ||
| 463 | del params['tag'] | ||
| 464 | fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) | ||
| 456 | 465 | ||
| 457 | tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR') | 466 | tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR') |
| 458 | bb.utils.mkdirhier(tmpparent) | 467 | bb.utils.mkdirhier(tmpparent) |
| @@ -523,6 +532,18 @@ def create_recipe(args): | |||
| 523 | params['branch'] = srcbranch | 532 | params['branch'] = srcbranch |
| 524 | srcuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) | 533 | srcuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) |
| 525 | 534 | ||
| 535 | if storeTagName: | ||
| 536 | # Re-introduced tag variable from storeTagName | ||
| 537 | # Check srcrev using tag and check validity of the tag | ||
| 538 | cmd = ('git rev-parse --verify %s' % (storeTagName)) | ||
| 539 | try: | ||
| 540 | check_tag, check_tag_err = bb.process.run('%s' % cmd, cwd=srctree) | ||
| 541 | srcrev = check_tag.split()[0] | ||
| 542 | except bb.process.ExecutionError as err: | ||
| 543 | logger.error(str(err)) | ||
| 544 | logger.error("Possibly wrong tag name is provided") | ||
| 545 | sys.exit(1) | ||
| 546 | |||
| 526 | if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'): | 547 | if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'): |
| 527 | srcuri = 'gitsm://' + srcuri[6:] | 548 | srcuri = 'gitsm://' + srcuri[6:] |
| 528 | logger.info('Fetching submodules...') | 549 | logger.info('Fetching submodules...') |
