[meta-swupdate][PATCH] Fix build without network

866 views
Skip to first unread message

Stefano Babic

unread,
Dec 16, 2017, 7:56:05 AM12/16/17
to swup...@googlegroups.com, Jose.Dia...@digi.com, Stefano Babic
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 <sba...@denx.de>
Reported-by: Diaz de Grenu, Jose <Jose.Dia...@digi.com>
---
recipes-support/swupdate/swupdate.inc | 2 --
recipes-support/swupdate/swupdate_git.bb | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 1431d15..7175848 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/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"

diff --git a/recipes-support/swupdate/swupdate_git.bb b/recipes-support/swupdate/swupdate_git.bb
index 6aff30c..4fc15ad 100644
--- a/recipes-support/swupdate/swupdate_git.bb
+++ b/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)}'
--
2.7.4

Diaz de Grenu, Jose

unread,
Dec 18, 2017, 4:33:44 AM12/18/17
to Stefano Babic, swup...@googlegroups.com
Hi Stefano,

Thanks for the patch. I tested it but unfortunately I am getting this error:

WARNING: /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb: Exception during build_dependencies for SRCREV
WARNING: /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb: Error during finalise of /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb
ERROR: ExpansionError during parsing /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable SRCREV, expression was ${@version_git(d)} which triggered exception TypeError: getVar() missing 1 required positional argument: 'expand'

I am using Yocto 2.2 (morty).

Kind regards
+# 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.

Stefano Babic

unread,
Dec 18, 2017, 4:40:50 AM12/18/17
to Diaz de Grenu, Jose, Stefano Babic, swup...@googlegroups.com
Hi Jose,

On 18/12/2017 10:33, Diaz de Grenu, Jose wrote:
> Hi Stefano,
>
> Thanks for the patch. I tested it but unfortunately I am getting this error:
>
> WARNING: /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb: Exception during build_dependencies for SRCREV
> WARNING: /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb: Error during finalise of /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb
> ERROR: ExpansionError during parsing /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb
> Traceback (most recent call last):
> bb.data_smart.ExpansionError: Failure expanding variable SRCREV, expression was ${@version_git(d)} which triggered exception TypeError: getVar() missing 1 required positional argument: 'expand'
>
> I am using Yocto 2.2 (morty).
>

Patch is thought for new development, but I have tested in -pyro, too.
Old releases become unmaintained.

The reason is that getVar() changed and it requires an argument after
-pyro, two before. You can try adding ", true)" as second argument in
the getVar call.

Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Diaz de Grenu, Jose

unread,
Dec 18, 2017, 4:52:50 AM12/18/17
to Stefano Babic, swup...@googlegroups.com
Hi Stefano,

-----Original Message-----
From: Stefano Babic [mailto:sba...@denx.de]

> Patch is thought for new development, but I have tested in -pyro, too.
> Old releases become unmaintained.
>
> The reason is that getVar() changed and it requires an argument after -pyro, two before. You can try adding ", true)" as second argument in the getVar call.

Thanks. With that modification the recipe is parsed, but I am still getting the error:

WARNING: /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb: Exception during build_dependencies for do_configure
WARNING: /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb: Error during finalise of /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb
ERROR: ExpansionError during parsing /home/jdepedro/dey-2.2/sources/meta-swupdate/recipes-support/swupdate/swupdate_git.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable do_configure, expression was cp /home/jdepedro/workspaces-yocto/2.2/ccimx6sbc/tmp/work/cortexa9hf-neon-dey-linux-gnueabi/swupdate/git-r0/defconfig /home/jdepedro/workspaces-yocto/2.2/ccimx6sbc/tmp/work/cortexa9hf-neon-dey-linux-gnueabi/swupdate/git-r0/git//.config
merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
cml1_do_configure
which triggered exception NetworkAccess: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command git -c core.fsyncobjectfiles=0 ls-remote git://github.com/sbabic/swupdate.git (for url None)

Stefano Babic

unread,
Dec 18, 2017, 7:53:31 AM12/18/17
to Diaz de Grenu, Jose, Stefano Babic, swup...@googlegroups.com
Hi Jose,
It looks related to -morty. I have not seen this with -pyro and -rocko.

Best regards,
Stefano Babic
Reply all
Reply to author
Forward
0 new messages