mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
recipetool: create: handle git URLs specifying only a tag
If a git URL is passed to recipetool create with a tag=, recipetool should handle it assuming that the tag is valid. [YOCTO #11393] (From OE-Core rev: 3afdcbdc9a3e65bc925ec61717784ffec67d529d) Signed-off-by: Stanley Phoong <stanley.cheong.kwan.phoong@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
62d5035ffc
commit
fe62cedd4b
@@ -423,6 +423,7 @@ def create_recipe(args):
|
|||||||
srcsubdir = ''
|
srcsubdir = ''
|
||||||
srcrev = '${AUTOREV}'
|
srcrev = '${AUTOREV}'
|
||||||
srcbranch = ''
|
srcbranch = ''
|
||||||
|
storeTagName = ''
|
||||||
|
|
||||||
if os.path.isfile(source):
|
if os.path.isfile(source):
|
||||||
source = 'file://%s' % os.path.abspath(source)
|
source = 'file://%s' % os.path.abspath(source)
|
||||||
@@ -446,13 +447,21 @@ def create_recipe(args):
|
|||||||
scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(fetchuri)
|
scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(fetchuri)
|
||||||
srcbranch = params.get('branch')
|
srcbranch = params.get('branch')
|
||||||
nobranch = params.get('nobranch')
|
nobranch = params.get('nobranch')
|
||||||
|
tag = params.get('tag')
|
||||||
if not srcbranch and not nobranch and srcrev != '${AUTOREV}':
|
if not srcbranch and not nobranch and srcrev != '${AUTOREV}':
|
||||||
# Append nobranch=1 in the following conditions:
|
# Append nobranch=1 in the following conditions:
|
||||||
# 1. User did not set 'branch=' in srcuri, and
|
# 1. User did not set 'branch=' in srcuri, and
|
||||||
# 2. User did not set 'nobranch=1' in srcuri, and
|
# 2. User did not set 'nobranch=1' in srcuri, and
|
||||||
# 3. Source revision is not '${AUTOREV}'
|
# 3. Source revision is not '${AUTOREV}'
|
||||||
params['nobranch'] = '1'
|
params['nobranch'] = '1'
|
||||||
fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))
|
if tag:
|
||||||
|
# Keep a copy of tag and append nobranch=1 then remove tag from URL.
|
||||||
|
# Bitbake fetcher unable to fetch when {AUTOREV} and tag is set at the same time.
|
||||||
|
# We will re-introduce tag argument after bitbake fetcher process is complete.
|
||||||
|
storeTagName = params['tag']
|
||||||
|
params['nobranch'] = '1'
|
||||||
|
del params['tag']
|
||||||
|
fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))
|
||||||
|
|
||||||
tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR')
|
tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR')
|
||||||
bb.utils.mkdirhier(tmpparent)
|
bb.utils.mkdirhier(tmpparent)
|
||||||
@@ -523,6 +532,18 @@ def create_recipe(args):
|
|||||||
params['branch'] = srcbranch
|
params['branch'] = srcbranch
|
||||||
srcuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))
|
srcuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))
|
||||||
|
|
||||||
|
if storeTagName:
|
||||||
|
# Re-introduced tag variable from storeTagName
|
||||||
|
# Check srcrev using tag and check validity of the tag
|
||||||
|
cmd = ('git rev-parse --verify %s' % (storeTagName))
|
||||||
|
try:
|
||||||
|
check_tag, check_tag_err = bb.process.run('%s' % cmd, cwd=srctree)
|
||||||
|
srcrev = check_tag.split()[0]
|
||||||
|
except bb.process.ExecutionError as err:
|
||||||
|
logger.error(str(err))
|
||||||
|
logger.error("Possibly wrong tag name is provided")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'):
|
if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'):
|
||||||
srcuri = 'gitsm://' + srcuri[6:]
|
srcuri = 'gitsm://' + srcuri[6:]
|
||||||
logger.info('Fetching submodules...')
|
logger.info('Fetching submodules...')
|
||||||
|
|||||||
Reference in New Issue
Block a user