[bitbake-devel] [PATCH] fetch2: probe for branches on version check

Konrad Weihmann kweihmann at phoenixcontact.com
Mon Jan 14 10:09:21 UTC 2019


>From 26811e557b963c87ffbcb3448401561ab87751d3 Mon Sep 17 00:00:00 2001
From: Konrad Weihmann <kweihmann at phoenixcontact.com>
Date: Mon, 14 Jan 2019 09:53:16 +0100
Subject: [PATCH] fetch2: probe for branches on version check

If a repository isn't using tags but versioned branches,
bb.fetch2.git.latest_version will fail.
To get at least some kind of information probe for git-tags first and
then for git-branches before giving up.
---
 bitbake/lib/bb/fetch2/git.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 15858a6241..5cc1fce531 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -611,11 +611,19 @@ class Git(FetchMethod):
         versions and returning the highest match.
         """
         pupver = ('', '')
+        output = None

         tagregex = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or "(?P<pver>([0-9][\.|_]?)+)")
-        try:
-            output = self._lsremote(ud, d, "refs/tags/*")
-        except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e:
+        for needle in ["refs/tags/*", "refs/*"]:
+            try:
+                output = self._lsremote(ud, d, needle)
+                break
+            except (bb.fetch2.NetworkAccess) as e:
+                bb.note("Could not list remote: %s" % str(e))
+                return pupver
+            except (bb.fetch2.FetchError) as e:
+                pass
+        if not output:
             bb.note("Could not list remote: %s" % str(e))
             return pupver

--
2.14.2




..................................................................
Phoenix Contact GmbH & Co. KG

Sitz der Gesellschaft / registered office of the company: 32825 Blomberg
USt-Id-Nr.: DE124613250
Pers. haftende Gesellschafterin / personally liable partner: Phoenix Contact Verwaltungs GmbH
Amtsgericht Lemgo HRB 5273 / district court Lemgo HRB 5273
Kom. Ges. Amtsgericht Lemgo HRA 3746 / limited commercial partnership district court Lemgo HRA 3746 
Geschäftsführer / Executive Board: Frank Stührenberg (Vorsitzender / Chief Executive Officer), Roland Bent, Prof. Dr. Gunther Olesch, Axel Wachholz 
___________________________________________________________________
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren, jegliche anderweitige Verwendung sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
----------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
___________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20190114/9e0b89ed/attachment-0001.html>


More information about the bitbake-devel mailing list