* [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone @ 2022-02-10 13:27 Tomasz Dziendzielski 2022-02-10 13:31 ` [bitbake-devel] " Alexander Kanavin 0 siblings, 1 reply; 9+ messages in thread From: Tomasz Dziendzielski @ 2022-02-10 13:27 UTC (permalink / raw) To: bitbake-devel; +Cc: pavel, Tomasz Dziendzielski, Jan Brzezanski If shallow tarball clone is used and if tar unpacking fails for any reason it might end up with empty directory created. Since runfetchcmd does not check any return code we might not detect the issue and we will not clone from git. Then due to missing hash it will replace main repository's git remote with the remote of failing recipe. To fix this behaviour we'll check if clonedir is not empty and if git dir is the same as clonedir. Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> --- lib/bb/fetch2/git.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py index 30da8e95..ed6ecb64 100644 --- a/lib/bb/fetch2/git.py +++ b/lib/bb/fetch2/git.py @@ -356,8 +356,15 @@ class Git(FetchMethod): repourl = self._get_repo_url(ud) - # If the repo still doesn't exist, fallback to cloning it - if not os.path.exists(ud.clonedir): + # Clean repo if git dir is different than ud.clonedir, which means tar unpacking failed + if os.path.exists(ud.clonedir): + if ud.clonedir != runfetchcmd("%s -C %s rev-parse --git-dir" % (ud.basecmd, ud.clonedir), d): + bb.utils.remove(ud.clonedir, recurse=True) + bb.utils.mkdirhier(ud.clonedir) + os.chdir(ud.clonedir) + + # If the repo still doesn't exist or is empty, fallback to cloning it + if not os.path.exists(ud.clonedir) or not os.listdir(ud.clonedir): # We do this since git will use a "-l" option automatically for local urls where possible if repourl.startswith("file://"): repourl = repourl[7:] -- 2.34.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 13:27 [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone Tomasz Dziendzielski @ 2022-02-10 13:31 ` Alexander Kanavin 2022-02-10 13:39 ` Tomasz Dziendzielski 2022-02-10 14:08 ` Pavel Zhukov 0 siblings, 2 replies; 9+ messages in thread From: Alexander Kanavin @ 2022-02-10 13:31 UTC (permalink / raw) To: Tomasz Dziendzielski; +Cc: bitbake-devel, Pavel Zhukov, Jan Brzezanski Wait, doesn't this mask the real issue? Is it ok that the tarball unpacking failed 'for any reason'? Alex On Thu, 10 Feb 2022 at 14:27, Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> wrote: > > If shallow tarball clone is used and if tar unpacking fails for any > reason it might end up with empty directory created. Since runfetchcmd > does not check any return code we might not detect the issue and we will > not clone from git. Then due to missing hash it will replace main > repository's git remote with the remote of failing recipe. > > To fix this behaviour we'll check if clonedir is not empty and if git > dir is the same as clonedir. > > Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> > Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> > --- > lib/bb/fetch2/git.py | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > index 30da8e95..ed6ecb64 100644 > --- a/lib/bb/fetch2/git.py > +++ b/lib/bb/fetch2/git.py > @@ -356,8 +356,15 @@ class Git(FetchMethod): > > repourl = self._get_repo_url(ud) > > - # If the repo still doesn't exist, fallback to cloning it > - if not os.path.exists(ud.clonedir): > + # Clean repo if git dir is different than ud.clonedir, which means tar unpacking failed > + if os.path.exists(ud.clonedir): > + if ud.clonedir != runfetchcmd("%s -C %s rev-parse --git-dir" % (ud.basecmd, ud.clonedir), d): > + bb.utils.remove(ud.clonedir, recurse=True) > + bb.utils.mkdirhier(ud.clonedir) > + os.chdir(ud.clonedir) > + > + # If the repo still doesn't exist or is empty, fallback to cloning it > + if not os.path.exists(ud.clonedir) or not os.listdir(ud.clonedir): > # We do this since git will use a "-l" option automatically for local urls where possible > if repourl.startswith("file://"): > repourl = repourl[7:] > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13328): https://lists.openembedded.org/g/bitbake-devel/message/13328 > Mute This Topic: https://lists.openembedded.org/mt/89045076/1686489 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 13:31 ` [bitbake-devel] " Alexander Kanavin @ 2022-02-10 13:39 ` Tomasz Dziendzielski 2022-02-10 14:08 ` Pavel Zhukov 1 sibling, 0 replies; 9+ messages in thread From: Tomasz Dziendzielski @ 2022-02-10 13:39 UTC (permalink / raw) To: Alexander Kanavin; +Cc: bitbake-devel, Pavel Zhukov, Jan Brzezanski [-- Attachment #1: Type: text/plain, Size: 2978 bytes --] Hi, right now code accepts failing tar and just runs fallback (which is git clone). If there is any tar failure then it also needs to be fixed but even so we don't want bitbake to override our git remote. Best regards, Tomasz Dziendzielski czw., 10 lut 2022 o 14:31 Alexander Kanavin <alex.kanavin@gmail.com> napisał(a): > Wait, doesn't this mask the real issue? Is it ok that the tarball > unpacking failed 'for any reason'? > > Alex > > On Thu, 10 Feb 2022 at 14:27, Tomasz Dziendzielski > <tomasz.dziendzielski@gmail.com> wrote: > > > > If shallow tarball clone is used and if tar unpacking fails for any > > reason it might end up with empty directory created. Since runfetchcmd > > does not check any return code we might not detect the issue and we will > > not clone from git. Then due to missing hash it will replace main > > repository's git remote with the remote of failing recipe. > > > > To fix this behaviour we'll check if clonedir is not empty and if git > > dir is the same as clonedir. > > > > Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> > > Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> > > --- > > lib/bb/fetch2/git.py | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > > index 30da8e95..ed6ecb64 100644 > > --- a/lib/bb/fetch2/git.py > > +++ b/lib/bb/fetch2/git.py > > @@ -356,8 +356,15 @@ class Git(FetchMethod): > > > > repourl = self._get_repo_url(ud) > > > > - # If the repo still doesn't exist, fallback to cloning it > > - if not os.path.exists(ud.clonedir): > > + # Clean repo if git dir is different than ud.clonedir, which > means tar unpacking failed > > + if os.path.exists(ud.clonedir): > > + if ud.clonedir != runfetchcmd("%s -C %s rev-parse > --git-dir" % (ud.basecmd, ud.clonedir), d): > > + bb.utils.remove(ud.clonedir, recurse=True) > > + bb.utils.mkdirhier(ud.clonedir) > > + os.chdir(ud.clonedir) > > + > > + # If the repo still doesn't exist or is empty, fallback to > cloning it > > + if not os.path.exists(ud.clonedir) or not > os.listdir(ud.clonedir): > > # We do this since git will use a "-l" option automatically > for local urls where possible > > if repourl.startswith("file://"): > > repourl = repourl[7:] > > -- > > 2.34.1 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- > > Links: You receive all messages sent to this group. > > View/Reply Online (#13328): > https://lists.openembedded.org/g/bitbake-devel/message/13328 > > Mute This Topic: https://lists.openembedded.org/mt/89045076/1686489 > > Group Owner: bitbake-devel+owner@lists.openembedded.org > > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > alex.kanavin@gmail.com] > > -=-=-=-=-=-=-=-=-=-=-=- > > > [-- Attachment #2: Type: text/html, Size: 4364 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 13:31 ` [bitbake-devel] " Alexander Kanavin 2022-02-10 13:39 ` Tomasz Dziendzielski @ 2022-02-10 14:08 ` Pavel Zhukov 2022-02-10 14:22 ` Tomasz Dziendzielski 1 sibling, 1 reply; 9+ messages in thread From: Pavel Zhukov @ 2022-02-10 14:08 UTC (permalink / raw) To: Alexander Kanavin, Tomasz Dziendzielski; +Cc: bitbake-devel, Jan Brzezanski [-- Attachment #1: Type: text/html, Size: 4010 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 14:08 ` Pavel Zhukov @ 2022-02-10 14:22 ` Tomasz Dziendzielski 2022-02-10 14:40 ` Pavel Zhukov 0 siblings, 1 reply; 9+ messages in thread From: Tomasz Dziendzielski @ 2022-02-10 14:22 UTC (permalink / raw) To: Pavel Zhukov; +Cc: Alexander Kanavin, bitbake-devel, Jan Brzezanski [-- Attachment #1: Type: text/plain, Size: 3205 bytes --] Then the first patch is safer, as it will not break build with tarballs without vcs. Best regards, Tomasz Dziendzielski czw., 10 lut 2022 o 15:08 Pavel Zhukov <pavel@zhukoff.net> napisał(a): > This is good question. > It is possible to provide bitbake with mailformed git repo mirror tarball > (manually created one for example with --exclude-vcs flag set or from wrong > subdirectory) in that case tar will not return any return code but > git.download() will try to replace remote with origin from recipe_url. In > worse case it will replace origin of "upper" git repo (poky?) with recipe's > one. > > > -- > Pavel > > > > 10.02.2022, 14:31, "Alexander Kanavin" <alex.kanavin@gmail.com>: > > Wait, doesn't this mask the real issue? Is it ok that the tarball > unpacking failed 'for any reason'? > > Alex > > On Thu, 10 Feb 2022 at 14:27, Tomasz Dziendzielski > <tomasz.dziendzielski@gmail.com> wrote: > > > If shallow tarball clone is used and if tar unpacking fails for any > reason it might end up with empty directory created. Since runfetchcmd > does not check any return code we might not detect the issue and we will > not clone from git. Then due to missing hash it will replace main > repository's git remote with the remote of failing recipe. > > To fix this behaviour we'll check if clonedir is not empty and if git > dir is the same as clonedir. > > Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> > Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> > --- > lib/bb/fetch2/git.py | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > index 30da8e95..ed6ecb64 100644 > --- a/lib/bb/fetch2/git.py > +++ b/lib/bb/fetch2/git.py > @@ -356,8 +356,15 @@ class Git(FetchMethod): > > repourl = self._get_repo_url(ud) > > - # If the repo still doesn't exist, fallback to cloning it > - if not os.path.exists(ud.clonedir): > + # Clean repo if git dir is different than ud.clonedir, which means tar > unpacking failed > + if os.path.exists(ud.clonedir): > + if ud.clonedir != runfetchcmd("%s -C %s rev-parse --git-dir" % > (ud.basecmd, ud.clonedir), d): > + bb.utils.remove(ud.clonedir, recurse=True) > + bb.utils.mkdirhier(ud.clonedir) > + os.chdir(ud.clonedir) > + > + # If the repo still doesn't exist or is empty, fallback to cloning it > + if not os.path.exists(ud.clonedir) or not os.listdir(ud.clonedir): > # We do this since git will use a "-l" option automatically > for local urls where possible > if repourl.startswith("file://"): > repourl = repourl[7:] > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13328): > https://lists.openembedded.org/g/bitbake-devel/message/13328 > Mute This Topic: https://lists.openembedded.org/mt/89045076/1686489 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > > > [-- Attachment #2: Type: text/html, Size: 4696 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 14:22 ` Tomasz Dziendzielski @ 2022-02-10 14:40 ` Pavel Zhukov 2022-02-10 14:58 ` Tomasz Dziendzielski [not found] ` <16D27480B462D202.11771@lists.openembedded.org> 0 siblings, 2 replies; 9+ messages in thread From: Pavel Zhukov @ 2022-02-10 14:40 UTC (permalink / raw) To: Tomasz Dziendzielski; +Cc: Alexander Kanavin, bitbake-devel, Jan Brzezanski [-- Attachment #1: Type: text/html, Size: 5894 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 14:40 ` Pavel Zhukov @ 2022-02-10 14:58 ` Tomasz Dziendzielski [not found] ` <16D27480B462D202.11771@lists.openembedded.org> 1 sibling, 0 replies; 9+ messages in thread From: Tomasz Dziendzielski @ 2022-02-10 14:58 UTC (permalink / raw) To: Pavel Zhukov; +Cc: Alexander Kanavin, bitbake-devel, Jan Brzezanski [-- Attachment #1: Type: text/plain, Size: 4495 bytes --] Is this bitbake-selftest output? I tried that but got network issues and missing branch tag only. Maybe I'll check it on different machine. Best regards, Tomasz Dziendzielski czw., 10 lut 2022 o 15:40 Pavel Zhukov <pavel@zhukoff.net> napisał(a): > Not really. > it will either complain [1] if there's not git repository in the parent's > dirs or replace git remote with the one from recipe_url and fail with [2] > if build directory is under some git managed directory. > > [1] > Fetcher failure: Fetch command export PSEUDO_DISABLED=1; git -c > core.fsyncobjectfiles=0 -c gc.autoDetach=false remote failed with exit code > 128, output: > fatal: not a git repository (or any parent up to mount point /) > > [2] > bb.fetch2.FetchError: Fetcher failure: Fetch command export > PSEUDO_DISABLED=1; git -c core.fsyncobjectfiles=0 -c gc.autoDetach=false > clone -n -s > /tmp/bitbake-fetch-hyrcqkrw/download/git2/git.openembedded.org.bitbake/ > /tmp/bitbake-fetch-hyrcqkrw/unpacked/git/ failed with exit code 128, output: > fatal: repository > '/tmp/bitbake-fetch-hyrcqkrw/download/git2/git.openembedded.org.bitbake/' > does not exist > > > -- > Pavel > > > > 10.02.2022, 15:19, "Tomasz Dziendzielski" <tomasz.dziendzielski@gmail.com > >: > > Then the first patch is safer, as it will not break build with tarballs > without vcs. > > Best regards, > Tomasz Dziendzielski > > czw., 10 lut 2022 o 15:08 Pavel Zhukov <pavel@zhukoff.net> napisał(a): > > This is good question. > It is possible to provide bitbake with mailformed git repo mirror tarball > (manually created one for example with --exclude-vcs flag set or from wrong > subdirectory) in that case tar will not return any return code but > git.download() will try to replace remote with origin from recipe_url. In > worse case it will replace origin of "upper" git repo (poky?) with recipe's > one. > > > -- > Pavel > > > > 10.02.2022, 14:31, "Alexander Kanavin" <alex.kanavin@gmail.com>: > > Wait, doesn't this mask the real issue? Is it ok that the tarball > unpacking failed 'for any reason'? > > Alex > > On Thu, 10 Feb 2022 at 14:27, Tomasz Dziendzielski > <tomasz.dziendzielski@gmail.com> wrote: > > > If shallow tarball clone is used and if tar unpacking fails for any > reason it might end up with empty directory created. Since runfetchcmd > does not check any return code we might not detect the issue and we will > not clone from git. Then due to missing hash it will replace main > repository's git remote with the remote of failing recipe. > > To fix this behaviour we'll check if clonedir is not empty and if git > dir is the same as clonedir. > > Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> > Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> > --- > lib/bb/fetch2/git.py | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > index 30da8e95..ed6ecb64 100644 > --- a/lib/bb/fetch2/git.py > +++ b/lib/bb/fetch2/git.py > @@ -356,8 +356,15 @@ class Git(FetchMethod): > > repourl = self._get_repo_url(ud) > > - # If the repo still doesn't exist, fallback to cloning it > - if not os.path.exists(ud.clonedir): > + # Clean repo if git dir is different than ud.clonedir, which means tar > unpacking failed > + if os.path.exists(ud.clonedir): > + if ud.clonedir != runfetchcmd("%s -C %s rev-parse --git-dir" % > (ud.basecmd, ud.clonedir), d): > + bb.utils.remove(ud.clonedir, recurse=True) > + bb.utils.mkdirhier(ud.clonedir) > + os.chdir(ud.clonedir) > + > + # If the repo still doesn't exist or is empty, fallback to cloning it > + if not os.path.exists(ud.clonedir) or not os.listdir(ud.clonedir): > # We do this since git will use a "-l" option automatically > for local urls where possible > if repourl.startswith("file://"): > repourl = repourl[7:] > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13328): > https://lists.openembedded.org/g/bitbake-devel/message/13328 > Mute This Topic: https://lists.openembedded.org/mt/89045076/1686489 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > > > [-- Attachment #2: Type: text/html, Size: 6518 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <16D27480B462D202.11771@lists.openembedded.org>]
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone [not found] ` <16D27480B462D202.11771@lists.openembedded.org> @ 2022-02-10 15:24 ` Tomasz Dziendzielski 2022-02-10 17:23 ` Pavel Zhukov 0 siblings, 1 reply; 9+ messages in thread From: Tomasz Dziendzielski @ 2022-02-10 15:24 UTC (permalink / raw) To: Tomasz Dziendzielski Cc: Pavel Zhukov, Alexander Kanavin, bitbake-devel, Jan Brzezanski [-- Attachment #1: Type: text/plain, Size: 5060 bytes --] I just double checked and with the first patch bitbake-selftest is failing with two errors that appear also without my changes, something about missing hash on branch. Where did you take that logs so I could check it and fix the patch? Best regards, Tomasz Dziendzielski czw., 10 lut 2022 o 15:55 Tomasz Dziendzielski via lists.openembedded.org <tomasz.dziendzielski=gmail.com@lists.openembedded.org> napisał(a): > Is this bitbake-selftest output? I tried that but got network issues and > missing branch tag only. > Maybe I'll check it on different machine. > > Best regards, > Tomasz Dziendzielski > > czw., 10 lut 2022 o 15:40 Pavel Zhukov <pavel@zhukoff.net> napisał(a): > >> Not really. >> it will either complain [1] if there's not git repository in the parent's >> dirs or replace git remote with the one from recipe_url and fail with [2] >> if build directory is under some git managed directory. >> >> [1] >> Fetcher failure: Fetch command export PSEUDO_DISABLED=1; git -c >> core.fsyncobjectfiles=0 -c gc.autoDetach=false remote failed with exit code >> 128, output: >> fatal: not a git repository (or any parent up to mount point /) >> >> [2] >> bb.fetch2.FetchError: Fetcher failure: Fetch command export >> PSEUDO_DISABLED=1; git -c core.fsyncobjectfiles=0 -c gc.autoDetach=false >> clone -n -s >> /tmp/bitbake-fetch-hyrcqkrw/download/git2/git.openembedded.org.bitbake/ >> /tmp/bitbake-fetch-hyrcqkrw/unpacked/git/ failed with exit code 128, output: >> fatal: repository >> '/tmp/bitbake-fetch-hyrcqkrw/download/git2/git.openembedded.org.bitbake/' >> does not exist >> >> >> -- >> Pavel >> >> >> >> 10.02.2022, 15:19, "Tomasz Dziendzielski" <tomasz.dziendzielski@gmail.com >> >: >> >> Then the first patch is safer, as it will not break build with tarballs >> without vcs. >> >> Best regards, >> Tomasz Dziendzielski >> >> czw., 10 lut 2022 o 15:08 Pavel Zhukov <pavel@zhukoff.net> napisał(a): >> >> This is good question. >> It is possible to provide bitbake with mailformed git repo mirror tarball >> (manually created one for example with --exclude-vcs flag set or from wrong >> subdirectory) in that case tar will not return any return code but >> git.download() will try to replace remote with origin from recipe_url. In >> worse case it will replace origin of "upper" git repo (poky?) with recipe's >> one. >> >> >> -- >> Pavel >> >> >> >> 10.02.2022, 14:31, "Alexander Kanavin" <alex.kanavin@gmail.com>: >> >> Wait, doesn't this mask the real issue? Is it ok that the tarball >> unpacking failed 'for any reason'? >> >> Alex >> >> On Thu, 10 Feb 2022 at 14:27, Tomasz Dziendzielski >> <tomasz.dziendzielski@gmail.com> wrote: >> >> >> If shallow tarball clone is used and if tar unpacking fails for any >> reason it might end up with empty directory created. Since runfetchcmd >> does not check any return code we might not detect the issue and we will >> not clone from git. Then due to missing hash it will replace main >> repository's git remote with the remote of failing recipe. >> >> To fix this behaviour we'll check if clonedir is not empty and if git >> dir is the same as clonedir. >> >> Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> >> Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> >> --- >> lib/bb/fetch2/git.py | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py >> index 30da8e95..ed6ecb64 100644 >> --- a/lib/bb/fetch2/git.py >> +++ b/lib/bb/fetch2/git.py >> @@ -356,8 +356,15 @@ class Git(FetchMethod): >> >> repourl = self._get_repo_url(ud) >> >> - # If the repo still doesn't exist, fallback to cloning it >> - if not os.path.exists(ud.clonedir): >> + # Clean repo if git dir is different than ud.clonedir, which means tar >> unpacking failed >> + if os.path.exists(ud.clonedir): >> + if ud.clonedir != runfetchcmd("%s -C %s rev-parse --git-dir" % >> (ud.basecmd, ud.clonedir), d): >> + bb.utils.remove(ud.clonedir, recurse=True) >> + bb.utils.mkdirhier(ud.clonedir) >> + os.chdir(ud.clonedir) >> + >> + # If the repo still doesn't exist or is empty, fallback to cloning it >> + if not os.path.exists(ud.clonedir) or not os.listdir(ud.clonedir): >> # We do this since git will use a "-l" option automatically >> for local urls where possible >> if repourl.startswith("file://"): >> repourl = repourl[7:] >> -- >> 2.34.1 >> >> >> >> >> >> > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13335): > https://lists.openembedded.org/g/bitbake-devel/message/13335 > Mute This Topic: https://lists.openembedded.org/mt/89045076/3619514 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > tomasz.dziendzielski@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > > [-- Attachment #2: Type: text/html, Size: 7300 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bitbake-devel] [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone 2022-02-10 15:24 ` Tomasz Dziendzielski @ 2022-02-10 17:23 ` Pavel Zhukov 0 siblings, 0 replies; 9+ messages in thread From: Pavel Zhukov @ 2022-02-10 17:23 UTC (permalink / raw) To: Tomasz Dziendzielski; +Cc: Alexander Kanavin, bitbake-devel, Jan Brzezanski [-- Attachment #1: Type: text/html, Size: 7751 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-02-10 17:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-10 13:27 [PATCH v2] fetch2/git.py: Check if clonedir is correct after shallow tarball clone Tomasz Dziendzielski
2022-02-10 13:31 ` [bitbake-devel] " Alexander Kanavin
2022-02-10 13:39 ` Tomasz Dziendzielski
2022-02-10 14:08 ` Pavel Zhukov
2022-02-10 14:22 ` Tomasz Dziendzielski
2022-02-10 14:40 ` Pavel Zhukov
2022-02-10 14:58 ` Tomasz Dziendzielski
[not found] ` <16D27480B462D202.11771@lists.openembedded.org>
2022-02-10 15:24 ` Tomasz Dziendzielski
2022-02-10 17:23 ` Pavel Zhukov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.