diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2024-09-14 22:14:17 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-09-16 13:52:27 +0100 |
commit | 1e6e8cb896934cf52e850ddd04be379ad5ad8a81 (patch) | |
tree | c6013bb24b233897f3022b46b2ca9ba4216dc130 /bitbake | |
parent | 7004840f3dc12e76822cee7b48902c08a553a118 (diff) | |
download | poky-1e6e8cb896934cf52e850ddd04be379ad5ad8a81.tar.gz |
bitbake: Revert "fetch2/gitsm: use configparser to parse .gitmodules"
This reverts commit a4f42e396e2942fde94b8b4944487c1c45f7a295.
Unfortunately configparser is a bit more strict and fails to parse e.g.:
https://github.com/espressif/esp-idf/blob/e104dd7f27d2e73ab0e9b614dd7b9295099069bf/.gitmodules
[submodule "components/bt/controller/lib_esp32"]
path = components/bt/controller/lib_esp32
url = ../../espressif/esp32-bt-lib.git
The url is using 8 spaces while path 1 tab causing:
Exception: configparser.NoOptionError: No option 'url' in section: 'submodule "components/bt/controller/lib_esp32"'
It was fixed in:
https://github.com/espressif/esp-idf/commit/62ca8e2fb478a1cdc0e47003025265cd0d840395#diff-fe7afb5c9c916e521401d3fcfb4277d5071798c3baf83baf11d6071742823584
but mcuboot is using a bit older esp-idf revision in:
https://github.com/ATmobica/mcuboot/blame/main/.gitmodules
and mcuboot is then used as submodule in:
https://github.com/project-chip/connectedhomeip/blob/master/.gitmodules
so it might take a while for the fix to be propagated everywhere.
Not sure how common these issues are, but configparser parses
"url = ../../espressif/esp32-bt-lib.git" as 2nd line of "path"
value (because it's indented differently) while git submodule
and old gitsm implementation parses it as separate path and
url keys.
(Bitbake rev: d9eb2650256292a524a0c0bb1c0562d87bedcbc4)
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index f193ae3c9b..f7f3af7212 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py | |||
@@ -47,20 +47,18 @@ class GitSM(Git): | |||
47 | subrevision = {} | 47 | subrevision = {} |
48 | 48 | ||
49 | def parse_gitmodules(gitmodules): | 49 | def parse_gitmodules(gitmodules): |
50 | """ | ||
51 | Parse .gitmodules and return a dictionary of submodule paths to dictionaries with path and url members. | ||
52 | """ | ||
53 | import configparser | ||
54 | cp = configparser.ConfigParser() | ||
55 | cp.read_string(gitmodules) | ||
56 | |||
57 | modules = {} | 50 | modules = {} |
58 | for section in [s for s in cp.sections() if s.startswith("submodule ")]: | 51 | module = "" |
59 | module = section.split('"')[1] | 52 | for line in gitmodules.splitlines(): |
60 | modules[module] = { | 53 | if line.startswith('[submodule'): |
61 | 'path': cp.get(section, 'path'), | 54 | module = line.split('"')[1] |
62 | 'url': cp.get(section, 'url') | 55 | modules[module] = {} |
63 | } | 56 | elif module and line.strip().startswith('path'): |
57 | path = line.split('=')[1].strip() | ||
58 | modules[module]['path'] = path | ||
59 | elif module and line.strip().startswith('url'): | ||
60 | url = line.split('=')[1].strip() | ||
61 | modules[module]['url'] = url | ||
64 | return modules | 62 | return modules |
65 | 63 | ||
66 | # Collect the defined submodules, and their attributes | 64 | # Collect the defined submodules, and their attributes |