Bug 13167

Summary: build failure when SRC_URI has usehead param in multiple git repo
Product: [Build System, Metadata & Runtime] BitBake Reporter: jean-christophe.gillet
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 3.4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
patch file for rocko-18.0.3 none

Description jean-christophe.gillet 2019-02-04 13:54:27 UTC
Created attachment 4429 [details]
patch file for rocko-18.0.3

usehead works fine with a single git repo and without name parameter.
In case of multiple git repos, name option is used in SRC_URI and error is
raised. For instance when you have a recipe like that,

PV = "1.0+git${SRCPV}"

SRCREV_FORMAT = "fooa_foob"

SRCREV_fooa = "${AUTOREV}"
SRCREV_foob = "${AUTOREV}"

SRC_URI = "\
  git:///fooa_dir/;protocol=file;usehead=1;name=fooa;destsuffix=git/fooa \
  git:///foob_dir/;protocol=file;usehead=1;name=foob;destsuffix=git/foob \
"

build fail with error message

bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression
was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError:
Fetcher failure: Unable to resolve 'master' in upstream git repository
in git ls-remote output for //fooa_dir/

because fetch operation is applied to wrong git reference, not 'HEAD'

It is related to dictionary ud.unresolvedrev that is always using 'default' key instead of ud.name[0] when ud.usehead==1.

I attach a patch file but I don't really know how to proceed. Do I really have to mail a patch to bitbake mailing list in this case. Only one line modified in one file. I found this bug in rocko version but it looks like it exists in later versions
Comment 1 Richard Purdie 2021-04-19 11:28:40 UTC
I believe this was fixed with http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=10c69538c0cb8708c7eff9e8dc05ca7c669cb61c