fetch2/gitsm: Fix when repository change submodules
PATCH 1/1 fetch2/gitsm: Fix when repository change submodules
This fix a problem when checking out a commit that changes the submodules previously checkout.
Example:
Recipe uses branch A and then it updates to use branch B, but branch B has different submodules dependencies then what branch A previously had.
--- lib/bb/fetch2/gitsm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/gitsm.py +1 -1
@@ -131,7 +131,7 @@ class GitSM(Git): os.chdir(ud.destdir) submodules = self.uses_submodules(ud, d) if submodules: - runfetchcmd("cp -r " + ud.clonedir + "/modules " + ud.destdir + "/.git/", d) + runfetchcmd(ud.basecmd + " checkout " + ud.revisions[ud.names[0]], d) runfetchcmd(ud.basecmd + " submodule init", d) runfetchcmd(ud.basecmd + " submodule update", d)
Signature · 1 line
2.7.0
Quoted 9 lines · Felipe F. Tonello
This fix a problem when checking out a commit that changes the submodules previously checkout.
Example:
Recipe uses branch A and then it updates to use branch B, but branch B has different submodules dependencies then what branch A previously had.Signed-off-by Felipe F. Tonello <[email protected]>
This completely broke the gitsm fetcher behavior. It no longer uses the previously fetched submodules from DL_DIR at all, instead the submodule update is re-cloning them from upstream in do_unpack, violating our conventions. Git checkout isn’t going to magically copy the existing fetched submodules from DL_DIR.
Signature · 4 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics
Quoted 10 lines · Christopher Larson
Quoted 7 lines · Felipe F. Tonello
This fix a problem when checking out a commit that changes the submodules previously checkout.
Example:
Recipe uses branch A and then it updates to use branch B, but branch B has different submodules dependencies then what branch A previously had.
Quoted 9 lines
Quoted 2 lines
Signed-off-by Felipe F. Tonello <[email protected]>This completely broke the gitsm fetcher behavior. It no longer uses the previously fetched submodules from
DL_DIRat all, instead the submodule update is re-cloning them from upstream indo_unpack, violating our conventions. Git checkout isn’t going to magically copy the existing fetched submodules fromDL_DIR.
Apologies for the harsh tone here, but clearly we should fix this differently. https://bugzilla.yoctoproject.org/show_bug.cgi?id=11830 has been opened for this. It’ll be difficult to add a good unit test to catch this problem without using either a VM or containers to physically cut network connectivity. I’m going to propose a future bitbake enhancement to use namespaces to prevent network connectivity from non-fetch tasks.
Signature · 4 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics