From 089dd7e8116c664f1f45e1b1a584260a7d331b98 Mon Sep 17 00:00:00 2001 From: Trevor Woerner Date: Mon, 9 Jul 2018 12:29:16 -0400 Subject: tpm2 git AUTOREV fix for BB_NO_NETWORK Bitbake will try an ls-remote for any recipe whose SRCREV is AUTOREV, even if that recipe will not ultimately be used for a particular build. Therefore if the user specifies 'BB_NO_NETWORK = "1"', the _git versions of the tpm2 recipes will cause the build to fail even if the _git versions are not going to be built (which they won't be by default on account of their DEFAULT_PREFERENCE being set to "-1"). This fix follows the same pattern as https://github.com/sbabic/meta-swupdate/commit/721fcc89c53debcd6582bd1aa972f75297cf12e9 With this fix, the user can disable networking and successfully build the non-_git versions of the tpm2 recipes. If the user wants to build the _git versions, networking must be enabled. The build is expected to fail if the user asks for the _git versions, but disables networking. Signed-off-by: Trevor Woerner --- meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb | 8 +++++++- meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb | 8 +++++++- meta-tpm2/recipes-tpm/tpm2-tss/tpm2-tss_git.bb | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb b/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb index 22d1d45..ccb655a 100644 --- a/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb +++ b/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb @@ -12,7 +12,13 @@ SRC_URI += " \ file://tpm2-abrmd_git.default \ " -SRCREV = "${AUTOREV}" +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 "cceb6c12ebb335aacb49207ee13d2f2fc833580a" +SRCREV ?= '${@version_git(d)}' S = "${WORKDIR}/${BPN}" diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb index c566526..7661623 100644 --- a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb @@ -9,7 +9,13 @@ PV = "${PVBASE}.${SRCPV}" SRC_URI = "git://github.com/tpm2-software/${BPN}.git;protocol=git;branch=master;name=${BPN};destsuffix=${BPN}" -SRCREV = "${AUTOREV}" +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 "e105149f07c9b944f69599ab67cd8b018ad880d2" +SRCREV ?= '${@version_git(d)}' S = "${WORKDIR}/${BPN}" diff --git a/meta-tpm2/recipes-tpm/tpm2-tss/tpm2-tss_git.bb b/meta-tpm2/recipes-tpm/tpm2-tss/tpm2-tss_git.bb index eaeaec2..75683a4 100644 --- a/meta-tpm2/recipes-tpm/tpm2-tss/tpm2-tss_git.bb +++ b/meta-tpm2/recipes-tpm/tpm2-tss/tpm2-tss_git.bb @@ -13,7 +13,13 @@ PV = "${PVBASE}.${SRCPV}" SRC_URI = "git://github.com/tpm2-software/${BPN}.git;protocol=git;branch=master;name=${BPN};destsuffix=${BPN}" -SRCREV = "${AUTOREV}" +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 "35ab16e1d328f709d6146221a371b7341b84b670" +SRCREV ?= '${@version_git(d)}' S = "${WORKDIR}/${BPN}" -- cgit v1.2.3-54-g00ecf