Bladeren bron

Fix build without network

bitbake runs git ls-remote if a recipe contains AUTOREV as SRCREV.
This forbids to build SWUpdate without network (setting BB_NO_NETWORK),
because the git version uses the last commit via AUTOREV.

Add a function to provide SRCREV for swupdate_git. This returns a fix
commit if the git version is not chosen, or AUTOREV if swupdate_git is selected.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
Stefano Babic 8 jaren geleden
bovenliggende
commit
0c7dc974e7
2 gewijzigde bestanden met toevoegingen van 16 en 2 verwijderingen
  1. 0 2
      recipes-support/swupdate/swupdate.inc
  2. 16 0
      recipes-support/swupdate/swupdate_git.bb

+ 0 - 2
recipes-support/swupdate/swupdate.inc

@@ -16,8 +16,6 @@ SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=https \
      file://swupdate-progress.service \
      "
 
-SRCREV = "${AUTOREV}"
-
 INSANE_SKIP_${PN} = "ldflags"
 PACKAGES =+ "${PN}-www"
 

+ 16 - 0
recipes-support/swupdate/swupdate_git.bb

@@ -2,3 +2,19 @@ require swupdate.inc
 require swupdate_tools.inc
 
 DEFAULT_PREFERENCE = "-1"
+
+# If a recipe sets SRCREV to ${AUTOREV}, bitbake tries
+# a git ls-remote. This breaks when a mirror is built
+# and BB_NO_NETWORK is set.
+# To work-around the issue, sets the revision for the git
+# version to a fix commit (not relevant)
+# In casethe _git version is chosen, sets the revision
+# to TOT to test with last commit-id.
+def version_git(d):
+    version = d.getVar("PREFERRED_VERSION_%s" % d.getVar('PN'))
+    if version is not None and "git" in version:
+        return d.getVar("AUTOREV")
+    else:
+        return "c0fec16b3fc82b0db12d8ac58be7055ed1b8d439"
+
+SRCREV ?= '${@version_git(d)}'