notary: Define SRCREV_FORMAT to make it work with archiver.bbclass
PATCH 1/1 notary: Define SRCREV_FORMAT to make it work with archiver.bbclass
Fixed:
INHERIT += "archiver"
$ bitbake notary -car_original
bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure: The SRCREV_FORMAT variable must be set when multiple SCMs are used. The SCMs are:git://github.com/docker/notary.git;destsuffix=git/src/github.com/docker/notarygit://github.com/docker/notary.git
Another solution is define SRCREV_FORMAT in archiver.bbclass, but that doesn't work since it is too late to define it there.
--- recipes-devtools/go/notary_git.bb | 5 +++++ 1 file changed, 5 insertions(+)
recipes-devtools/go/notary_git.bb +5 -0
@@ -9,6 +9,11 @@ SRCNAME = "notary" PKG_NAME = "github.com/docker/${SRCNAME}" SRC_URI = "git://${PKG_NAME}.git;destsuffix=git/src/${PKG_NAME}" +# The archiver.bbclass will append a uri to SRC_URI when it contains +# destsuffix, then the SRC_URI would contain multilib SCMs, and bitbake's +# fetcher requires a SRCREV_FORMAT for multiple SCMs. +SRCREV_FORMAT = "${SRCNAME}" + SRCREV = "d6e1431feb32348e0650bf7551ac5cffd01d857b" PV = "0.6.1+git${SRCPV}"
Signature · 1 line
2.17.1
Hi Bruce,
Please ignore this patch, I found more recipes in meta-virt have this issue, we need fix all of them or find a better solutions.
// Robert
Quoted 4 lines · Robert Yang
Hi Bruce,
Please ignore this patch, I found more recipes in meta-virt have this issue, we need fix all of them or find a better solutions.
I think the issue should probably be logged against the archiver itself in the Yocto bugzilla. If the archiver is changing SRC_URI it should handle any consequences, not require recipes to adapt for it.
Signature · 2 lines
Paul Barker Konsulko Group
Quoted 9 lines · Paul Barker
Quoted 4 lines · Robert Yang
Hi Bruce,
Please ignore this patch, I found more recipes in meta-virt have this issue, we need fix all of them or find a better solutions.
I think the issue should probably be logged against the archiver itself in the Yocto bugzilla. If the archiver is changing
SRC_URIit should handle any consequences, not require recipes to adapt for it.
Yes, indeed, I'm working on that.
// Robert
Quoted 4 lines
Hi Paul,
Quoted 9 lines · Paul Barker
Quoted 4 lines · Robert Yang
Hi Bruce,
Please ignore this patch, I found more recipes in meta-virt have this issue, we need fix all of them or find a better solutions.
I think the issue should probably be logged against the archiver itself in the Yocto bugzilla. If the archiver is changing
SRC_URIit should handle any consequences, not require recipes to adapt for it.
Seems that I've figured the problem, do_ar_original has copy SRC_URI into the variable urls, then when call fetch = bb.fetch2.Fetch(urls, d), there would be duplicated urls as the error reported:
git://github.com/docker/notary.git;destsuffix=git/src/github.com/docker/notary
git://github.com/docker/notary.git
The first one is from original SRC_URI, the second one is from the variable 'urls', so cleanup SRC_URI before call bb.fetch2.Fetch() can fix the problem.
Here is the patch, I appreciate it if you can help to review before I send it to oe-core mailing list.
meta/classes/archiver.bbclass +7 -1
@@ -193,7 +193,13 @@ python do_ar_original() { del decoded[5][param] encoded = bb.fetch2.encodeurl(decoded) urls[i] = encoded - fetch = bb.fetch2.Fetch(urls, d) + + # Cleanup SRC_URI before call bb.fetch2.Fetch() since now SRC_URI is in the + # variable "urls", otherwise there might be errors like: + # The SRCREV_FORMAT variable must be set when multiple SCMs are used + ld = bb.data.createCopy(d) + ld.setVar('SRC_URI', '') + fetch = bb.fetch2.Fetch(urls, ld) tarball_suffix = {} for url in fetch.urls: local = fetch.localpath(url).rstrip("/");
// Robert