<div dir="ltr">rev-parse is a better bet than rev-list for ref validation, IMO.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 15, 2017 at 1:24 AM, Chang Rebecca Swee Fun <span dir="ltr"><<a href="mailto:rebecca.swee.fun.chang@intel.com" target="_blank">rebecca.swee.fun.chang@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Stanley Phoong <<a href="mailto:stanley.cheong.kwan.phoong@intel.com">stanley.cheong.kwan.phoong@<wbr>intel.com</a>><br>
<br>
If a git URL is passed to recipetool create with a tag=, recipetool<br>
should handle it assuming that the tag is valid.<br>
<br>
[YOCTO #11393]<br>
<br>
Signed-off-by: Stanley Phoong <<a href="mailto:stanley.cheong.kwan.phoong@intel.com">stanley.cheong.kwan.phoong@<wbr>intel.com</a>><br>
---<br>
scripts/lib/recipetool/create.<wbr>py | 23 ++++++++++++++++++++++-<br>
1 file changed, 22 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/scripts/lib/recipetool/<wbr>create.py b/scripts/lib/recipetool/<wbr>create.py<br>
index d2e6fc0..52c10e5 100644<br>
--- a/scripts/lib/recipetool/<wbr>create.py<br>
+++ b/scripts/lib/recipetool/<wbr>create.py<br>
@@ -423,6 +423,7 @@ def create_recipe(args):<br>
srcsubdir = ''<br>
srcrev = '${AUTOREV}'<br>
srcbranch = ''<br>
+ storeTagName = ''<br>
<br>
if os.path.isfile(source):<br>
source = 'file://%s' % os.path.abspath(source)<br>
@@ -446,13 +447,21 @@ def create_recipe(args):<br>
scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(fetchuri)<br>
srcbranch = params.get('branch')<br>
nobranch = params.get('nobranch')<br>
+ tag = params.get('tag')<br>
if not srcbranch and not nobranch and srcrev != '${AUTOREV}':<br>
# Append nobranch=1 in the following conditions:<br>
# 1. User did not set 'branch=' in srcuri, and<br>
# 2. User did not set 'nobranch=1' in srcuri, and<br>
# 3. Source revision is not '${AUTOREV}'<br>
params['nobranch'] = '1'<br>
- fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))<br>
+ if tag:<br>
+ # Keep a copy of tag and append nobranch=1 then remove tag from URL.<br>
+ # Bitbake fetcher unable to fetch when {AUTOREV} and tag is set at the same time.<br>
+ # We will re-introduce tag argument after bitbake fetcher process is complete.<br>
+ storeTagName = params['tag']<br>
+ params['nobranch'] = '1'<br>
+ del params['tag']<br>
+ fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))<br>
<br>
tmpparent = tinfoil.config_data.getVar('<wbr>BASE_WORKDIR')<br>
bb.utils.mkdirhier(tmpparent)<br>
@@ -523,6 +532,18 @@ def create_recipe(args):<br>
params['branch'] = srcbranch<br>
srcuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))<br>
<br>
+ if storeTagName:<br>
+ # Re-introduced tag variable from storeTagName<br>
+ # Check srcrev using tag and check validity of the tag<br>
+ try:<br>
+ cmd = ('git rev-list -n 1 %s' % (storeTagName))<br>
+ check_tag, check_tag_err = bb.process.run('%s' % cmd, cwd=srctree)<br>
+ srcrev = check_tag.split()[0]<br>
+ except bb.process.ExecutionError as err:<br>
+ logger.error(str(err))<br>
+ logger.error("Possibly wrong tag name is provided")<br>
+ sys.exit(1)<br>
+<br>
if os.path.exists(os.path.join(<wbr>srctree, '.gitmodules')) and srcuri.startswith('git://'):<br>
srcuri = 'gitsm://' + srcuri[6:]<br>
<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>('Fetching submodules...')<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Senior Software Engineer, Mentor Graphics</div></div></div></div>
</div>