Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix externalsrc harder #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

peterhurley
Copy link

Add fixes for submodule handling in srctree_hash_files() after upstream broken fixes when git submodule-helper list was deprecated.

oe-core commit 6d9364e "externalsrc: git submodule--helper list
unsupported" caused build errors and does the wrong thing because it:
1. checks for .gitmodules in bitbake's cwd which could be anywhere and
   unrelated to the srcdir/EXTERNALSRC
2. enumerates inactive submodules which won't have initialized repos

oe-core commit 66ff3d1 "externalsrc: fix lookup for .gitmodules"
fixed 1 but not 2.

Instead, still attempt to use list subcommand to enumerate active
submodules, and if unsuccessful (because list is unsupported) [1],
enumerate active submodule paths via the more modern "foreach"
subcommand [2]. Avoiding the git submodule porcelain is still
necessary for the reasons detailed in oe-core commit
2055718 "Revert "externalsrc: Detect code changes in submodules".

Both subcommands output the submodule path relative to the immediate
superproject; parse last column of either output [3][4] as submodule
path.

[1] 31955475d1c2 "submodule--helper: remove unused "list" helper"
[2] foreach subcommand added to git submodule--helper in git v2.19.0
    fc1b9243cd5d submodule: port submodule subcommand 'foreach' from shell to C
    and --quiet option fixed in git v2.22.0
    a282f5a90613 submodule foreach: fix "<command> --quiet" not being respected
[3] example output of 'git submodule--helper list'
    $ git submodule--helper list
    160000 48de465976bffb76853b2e17c1c9b65bada30d2a 0       path/to/submodule_A
    160000 4c34ba86f96944153b6c6566a1bceaeace25aa07 0       deeper/path/to/submodule_B
[4] example output of "git submodule--helper foreach 'echo $path'"
    path/to/submodule_A
    deeper/path/to/submodule_B

Change-Id: I67915f54df7c802d1659b8f132426df60e24480f
Signed-off-by: Peter Hurley <peter@meraki.com>
Submodule paths output by git submodule--helper subcommands are
relative to the containing superproject top-level directory, whereas
scrdir/EXTERNALSRC may be a subdirectory _within_ a superproject and
not necessarily equivalent to the top-level directory.

Form submodule paths from top-level directory [1] and only process
submodules where srcdir/EXTERNALSRC is a parent path of the submodule
path [2].

[1] which may not be equivalent to git_dir in a git worktree
[2] uses os.path.commonpath() available since python 3.5

Change-Id: I94d40074586469242228a63ef66089f9f97d1159
Signed-off-by: Peter Hurley <peter@meraki.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants