Bug 13133

Summary: Git submodule fetcher fails if last component of path is different than the URL
Product: [Build System, Metadata & Runtime] BitBake Reporter: Florian Kauer <koalo>
Component: bitbakeAssignee: Mark Hatle <mark.hatle>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: Medium+ CC: koalo, poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 2.8 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Florian Kauer 2019-01-10 14:56:50 UTC
Preconditions/Environment
-------------------------
Poky thud @ 87e3a9739d2c28f7fb9d8991586430c2c9bf149c

Triggering Action/Cause
-----------------------
I use the following recipe for fetching and building the Microsoft Azure C SDK:

DESCRIPTION = "C SDK for Microsoft Azure IoT"
AUTHOR = "Microsoft Corporation"
HOMEPAGE = "https://github.com/Azure/azure-iot-sdk-c"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4283671594edec4c13aeb073c219237a"

SRC_URI = "\
	gitsm://github.com/Azure/azure-iot-sdk-c.git;rev=acff8b1677150cb165a7b111745144cf8fab76cc \
"

PR = "r0"

inherit cmake

DEPENDS = "\
	curl \
	util-linux \
	openssl \
"

RDEPENDS_${PN} = "\
	util-linux-libuuid \
"

S = "${WORKDIR}/git"
B = "${WORKDIR}/build"


Expectation
-----------
The fetch and compilation is successful.

Actual Result
-------------
ERROR: azure-iot-sdk-c-1.2.11-r0 do_unpack: Fetcher failure: Submodule azure-c-shared-utility does not exist in /home/[...]/build/downloads/git2/github.com.Azure.azure-iot-sdk-c.git/modules/c-utility or /home/[...]/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/azure-iot-sdk-c/1.2.11-r0/git/.git/modules/c-utility.
ERROR: azure-iot-sdk-c-1.2.11-r0 do_unpack: Function failed: base_do_unpack
ERROR: Logfile of failure stored in: /home/[...]/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/azure-iot-sdk-c/1.2.11-r0/temp/log.do_unpack.8798
ERROR: Task (/home/[...]/recipes-connectivity/azure-iot-sdk-c/azure-iot-sdk-c_1.2.11.bb:do_unpack) failed with exit code '1'

Reproducibility
---------------
Always.

Details
-------
After the commit https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/bitbake/lib/bb/fetch2/gitsm.py?id=a042179a784bab6a6f4bd5d63db80c1c02624b1c it not longer seems to be possible to fetch git submodules that are named differently than the source repository. For example:

[submodule "azure-c-shared-utility"]
	path = c-utility
	url = https://github.com/Azure/azure-c-shared-utility.git

A short debugging reveals that the fetch would be successful if line 157 of gitsm.py (https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/bitbake/lib/bb/fetch2/gitsm.py?h=thud#n157) would be
modpath = os.path.join(repo_conf, 'modules', module)
as before, but I do not know enough about the system to understand if that is the actual reason for the bug.
Comment 1 Mark Hatle 2019-05-15 11:42:47 UTC
I believe another user report the same thing with slightly different symptoms.  I believe I have a patch for this issue and will be sending it up for review soon.
Comment 2 Mark Hatle 2019-05-17 08:57:01 UTC
Believed to be fixed in master bitbake commit: fd27ab60d33553dba13de39394edaaac04e446b3