]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
update.py: check whether branch existed when nocheckout rbt/li_recs
authorRobert Yang <liezhi.yang@windriver.com>
Mon, 9 Jul 2018 03:28:38 +0000 (11:28 +0800)
committerRobert Yang <liezhi.yang@windriver.com>
Mon, 9 Jul 2018 04:06:31 +0000 (12:06 +0800)
Fixed:
Assume there is no master branch in hello layer:
$ update.py -l hello -b master
INFO: Skipping update of layer hello - branch master doesn't exist

This is correct since hello layer doesn't have master branch, but when --nocheckout:
$ update.py -l hello -b master  --nocheckout
[snip]
INFO: Sorting layers for branch mater:
WARNING: Cannot find required collections on branch master:
WARNING: hello: LAYERDEPENDS: <snip>

This is incorrect, this patch fixed the problem, now it skips it since the
branch doesn't exists when --nocheckout.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
layerindex/update.py
layerindex/update_layer.py

index 5b5fc43d7338e469534f4f698bd41641f5810404..c0a9f88c9f146c33d04d406fc24fdb4f855319f4 100755 (executable)
@@ -345,10 +345,10 @@ def main():
                     repo = git.Repo(repodir)
                     assert repo.bare == False
                     try:
+                        # Always get origin/branchname, so it raises error when branch doesn't exist when nocheckout
+                        topcommit = repo.commit('origin/%s' % branchname)
                         if options.nocheckout:
                             topcommit = repo.commit('HEAD')
-                        else:
-                            topcommit = repo.commit('origin/%s' % branchname)
                     except:
                         if newbranch:
                             logger.info("Skipping update of layer %s - branch %s doesn't exist" % (layer.name, branchdesc))
index 81b730a80a3016fc3e738bed156f52fa6020f06b..d941ae646f1ad131d5815b0166dcc121ce3e3c78 100644 (file)
@@ -362,10 +362,9 @@ def main():
     # Collect repo info
     repo = git.Repo(repodir)
     assert repo.bare == False
+    topcommit = repo.commit('origin/%s' % branchname)
     if options.nocheckout:
         topcommit = repo.commit('HEAD')
-    else:
-        topcommit = repo.commit('origin/%s' % branchname)
 
     tinfoil = None
     tempdir = None