Message ID | 20240127121536.2849664-2-pavel@zhukoff.net |
---|---|
State | Accepted, archived |
Commit | 69588e2a5c7c200e47b02b2391498dcb72388bd2 |
Headers | show |
Series | [1/2] fetch2/git.py: Fetch mirror into HEAD | expand |
On 1/27/24 20:15, Pavel Zhukov wrote: > Fix the issue with using of (pre)mirror in case if clonedir exists but > outdated. If I understand it right, the error only appears when BB_FETCH_PREMIRRORONLY is set, right? If so, could you please update the commit message to include this information? Regards, Qi > Previous version of the code fetched new mirror content into FETCH_HEAD > instead of branch which caused refetch from the upstream. Add new remote > add fetch from it instead so the ref can be found by "_contains_ref" > > Fixes [Yocto #15369] > > Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> > --- > bitbake/lib/bb/fetch2/git.py | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py > index 0deeb5cee1..b4497911f1 100644 > --- a/bitbake/lib/bb/fetch2/git.py > +++ b/bitbake/lib/bb/fetch2/git.py > @@ -375,7 +375,11 @@ class Git(FetchMethod): > else: > tmpdir = tempfile.mkdtemp(dir=d.getVar('DL_DIR')) > runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=tmpdir) > - fetch_cmd = "LANG=C %s fetch -f --progress %s " % (ud.basecmd, shlex.quote(tmpdir)) > + output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir) > + if 'mirror' in output: > + runfetchcmd("%s remote rm mirror" % ud.basecmd, d, workdir=ud.clonedir) > + runfetchcmd("%s remote add --mirror=fetch mirror %s" % (ud.basecmd, tmpdir), d, workdir=ud.clonedir) > + fetch_cmd = "LANG=C %s fetch -f --update-head-ok --progress mirror " % (ud.basecmd) > runfetchcmd(fetch_cmd, d, workdir=ud.clonedir) > repourl = self._get_repo_url(ud) > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#15800): https://lists.openembedded.org/g/bitbake-devel/message/15800 > Mute This Topic: https://lists.openembedded.org/mt/103994536/7304865 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [Qi.Chen@eng.windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
BB_FETCH_PREMIRRORONLY is not hard requirement here. any usage of PREMIRRORS causes failure on second fetch but it's hidden by fetching from upstream iif available n most cases.
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 0deeb5cee1..b4497911f1 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -375,7 +375,11 @@ class Git(FetchMethod): else: tmpdir = tempfile.mkdtemp(dir=d.getVar('DL_DIR')) runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=tmpdir) - fetch_cmd = "LANG=C %s fetch -f --progress %s " % (ud.basecmd, shlex.quote(tmpdir)) + output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir) + if 'mirror' in output: + runfetchcmd("%s remote rm mirror" % ud.basecmd, d, workdir=ud.clonedir) + runfetchcmd("%s remote add --mirror=fetch mirror %s" % (ud.basecmd, tmpdir), d, workdir=ud.clonedir) + fetch_cmd = "LANG=C %s fetch -f --update-head-ok --progress mirror " % (ud.basecmd) runfetchcmd(fetch_cmd, d, workdir=ud.clonedir) repourl = self._get_repo_url(ud)
Fix the issue with using of (pre)mirror in case if clonedir exists but outdated. Previous version of the code fetched new mirror content into FETCH_HEAD instead of branch which caused refetch from the upstream. Add new remote add fetch from it instead so the ref can be found by "_contains_ref" Fixes [Yocto #15369] Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> --- bitbake/lib/bb/fetch2/git.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)