Skip to contentSkip to conversation

bitbake: fetch2: git: revert path checks

PATCH In review Mikko Rapeli 4 participants 9 messages Sep 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: fetch2: git: revert path checks

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +1 -13
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True
Signature · 1 line
2.34.1
#1 lore raw
Quoted 31 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +0 -7
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 10 lines
bitbake/lib/bb/fetch2/git.py +1 -6
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Cheers,

Richard

#2 lore raw

Hi,

Quoted 37 lines · Richard Purdie
Quoted 36 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +0 -12
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
Quoted 8 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 5 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Yes, but this has not been a problem for me. Re-cloning existing fully cached repositories is the effect I see.

I think the git commit id and branch should decide if fetch or re-clone steps are needed. The path of the repository should not matter. The git remotes also not. Both of those can and do change.

Cheers,

-Mikko

#3 lore raw
Quoted 49 lines · Mikko Rapeli

Hi,

Quoted 37 lines · Richard Purdie
Quoted 36 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +0 -12
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
Quoted 8 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 5 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Quoted 6 lines

Yes, but this has not been a problem for me. Re-cloning existing fully cached repositories is the effect I see.

I think the git commit id and branch should decide if fetch or re-clone steps are needed. The path of the repository should not matter. The git remotes also not. Both of those can and do change.

In that case you're effectively sending a revert and we should probably be clear about that...

We really need to find a way to resolve things for everyone.

Cheers,

Richard

#4 lore raw

FWIW: I'm also seeing warnings like:

WARNING: Top level directory '/data001/work/downloads/git2/git.libssh.org.projects.libssh.git' doesn't match expected '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'. Re-cloning

Where /mnt/mirror-write/downloads/ is configured DL_DIR and /data001/work/downloads/ was probably the DL_DIR of the jenkins jobs which originally fetched the libssh and created the tarball with it for premirror.

Cheers,

Quoted 95 lines · Richard Purdie
Quoted 15 lines · Mikko Rapeli

Hi,

Quoted 12 lines · Richard Purdie
Quoted 11 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

Quoted 6 lines
Quoted 6 lines

Review

Quoted 6 lines
---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
(quoted diff) +0 -0

b/bitbake/lib/bb/fetch2/git.py

Quoted 5 lines
Quoted 5 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 371

Quoted 5 lines

index e11271b757..0c547ea303 100644

bitbake/lib/bb/fetch2/git.py +0 -0
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of

a bare git

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 372

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -0
             # repository in which case it needs to be deleted and

re-cloned.

Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 374

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +0 -1
             try:
-                # Since clones can be bare, use --absolute-git-dir

instead of --show-toplevel

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 375

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                output = runfetchcmd("LANG=C %s rev-parse

--absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)

Quoted 3 lines
Quoted 3 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod):

Quoted 3 lines
bitbake/lib/bb/fetch2/git.py +0 -3
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir =

os.path.abspath(ud.clonedir).rstrip('/')

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 379

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # The top level Git directory must either be the

clone directory

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 380

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # or a child of the clone directory. Any ancestor

directory of

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 381

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # the clone directory is not valid as the Git

directory (and

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 382

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # probably belongs to some other unrelated

repository), so a

Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 384

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +0 -2
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel])

!= abs_clonedir:

Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 385

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                    logger.warning("Top level directory '%s'

doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)

Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 374

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse

--absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)

Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 376

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +0 -0
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not

a git directory?): %s", ud.clonedir, e)

Quoted 6 lines
Quoted 4 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -0
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Yes, but this has not been a problem for me. Re-cloning existing fully

cached

Quoted 3 lines

repositories is the effect I see.

I think the git commit id and branch should decide if fetch or re-clone

steps are needed.

Quoted 1 line

The path of the repository should not matter. The git remotes also not.

Both of those can

Quoted 1 line

and do change.

In that case you're effectively sending a revert and we should probably be clear about that...

We really need to find a way to resolve things for everyone.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15045):
https://lists.openembedded.org/g/bitbake-devel/message/15045
Mute This Topic: https://lists.openembedded.org/mt/101333074/3617156
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/bitbake-devel/leave/8021546/3617156/1661570722/xyzzy
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
Quoted 6 lines · Martin Jansa

FWIW: I'm also seeing warnings like:

WARNING: Top level directory '/data001/work/downloads/git2/git.libssh.org.projects.libssh.git' doesn't match expected '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'. Re-cloning

Where /mnt/mirror-write/downloads/ is configured DL_DIR and /data001/work/downloads/ was probably the DL_DIR of the jenkins jobs which originally fetched the libssh and created the tarball with it for premirror.

That's strange.... I'll take a look real quick and see whats going on

Quoted 79 lines

Cheers,

Quoted 75 lines · Richard Purdie
Quoted 49 lines · Mikko Rapeli

Hi,

Quoted 37 lines · Richard Purdie
Quoted 36 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +0 -12
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
Quoted 8 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 5 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Quoted 6 lines

Yes, but this has not been a problem for me. Re-cloning existing fully cached repositories is the effect I see.

I think the git commit id and branch should decide if fetch or re-clone steps are needed. The path of the repository should not matter. The git remotes also not. Both of those can and do change.

In that case you're effectively sending a revert and we should probably be clear about that...

We really need to find a way to resolve things for everyone.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15045): https://lists.openembedded.org/g/bitbake-devel/message/15045
Mute This Topic: https://lists.openembedded.org/mt/101333074/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/leave/8021546/3617156/1661570722/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw
In reply to Martin Jansa
Quoted 6 lines · Martin Jansa

FWIW: I'm also seeing warnings like:

WARNING: Top level directory '/data001/work/downloads/git2/git.libssh.org.projects.libssh.git' doesn't match expected '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'. Re-cloning

Where /mnt/mirror-write/downloads/ is configured DL_DIR and /data001/work/downloads/ was probably the DL_DIR of the jenkins jobs which originally fetched the libssh and created the tarball with it for premirror.

Ya, that /data001 path is _really_ weird. That path comes from running git rev-parse --absolute-git-dir in the extracted directory (ud.clonedir, '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'). The should be no absolute paths encoded in the mirror tarballs, so
this seems like it's some sort of misconfiguration(?), and not related to Mikkos problem.

I think I have a fix for Mikkos symlink problem though

Quoted 79 lines

Cheers,

Quoted 75 lines · Richard Purdie
Quoted 49 lines · Mikko Rapeli

Hi,

Quoted 37 lines · Richard Purdie
Quoted 36 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +0 -12
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
Quoted 8 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 5 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Quoted 6 lines

Yes, but this has not been a problem for me. Re-cloning existing fully cached repositories is the effect I see.

I think the git commit id and branch should decide if fetch or re-clone steps are needed. The path of the repository should not matter. The git remotes also not. Both of those can and do change.

In that case you're effectively sending a revert and we should probably be clear about that...

We really need to find a way to resolve things for everyone.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15045): https://lists.openembedded.org/g/bitbake-devel/message/15045
Mute This Topic: https://lists.openembedded.org/mt/101333074/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/leave/8021546/3617156/1661570722/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw
Quoted 2 lines

not related to Mikkos problem.
I think I have a fix for Mikkos symlink problem though

Maybe it is related in the end, to my surprise /mnt/mirror-write/downloads is on some servers a symlink to /data001/work/downloads and then this /mnt/mirror-write/download
is used as DL_DIR there (not /data001/work/downloads directly).

Quoted 128 lines · Joshua Watt
Quoted 4 lines · Martin Jansa

FWIW: I'm also seeing warnings like:

WARNING: Top level directory

'/data001/work/downloads/git2/git.libssh.org.projects.libssh.git' doesn't match expected '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'. Re-cloning

Quoted 2 lines

Where /mnt/mirror-write/downloads/ is configured DL_DIR and

/data001/work/downloads/ was probably the DL_DIR of the jenkins jobs which originally fetched the libssh and created the tarball with it for premirror.

Ya, that /data001 path is _really_ weird. That path comes from running git rev-parse --absolute-git-dir in the extracted directory (ud.clonedir, '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'). The should be no absolute paths encoded in the mirror tarballs, so this seems like it's some sort of misconfiguration(?), and not related to Mikkos problem.

I think I have a fix for Mikkos symlink problem though

Quoted 4 lines

Cheers,

On Wed, Sep 13, 2023 at 11:22 AM Richard Purdie <

Quoted 17 lines · [email protected]> wrote:
Quoted 17 lines · Mikko Rapeli
Quoted 15 lines

Hi,

Quoted 12 lines · Richard Purdie
Quoted 11 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 6 lines
---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
(quoted diff) +0 -0

b/bitbake/lib/bb/fetch2/git.py

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 371

Quoted 5 lines

index e11271b757..0c547ea303 100644

bitbake/lib/bb/fetch2/git.py +0 -0
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level

of a bare git

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 372

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -0
             # repository in which case it needs to be deleted

and re-cloned.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 374

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +0 -1
             try:
-                # Since clones can be bare, use

--absolute-git-dir instead of --show-toplevel

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 375

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                output = runfetchcmd("LANG=C %s rev-parse

--absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod):

Quoted 3 lines
bitbake/lib/bb/fetch2/git.py +0 -3
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir =

os.path.abspath(ud.clonedir).rstrip('/')

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 379

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # The top level Git directory must either be the

clone directory

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 380

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # or a child of the clone directory. Any

ancestor directory of

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 381

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # the clone directory is not valid as the Git

directory (and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 382

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                # probably belongs to some other unrelated

repository), so a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 384

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +0 -2
-                # clone is required
-                if os.path.commonprefix([abs_clonedir,

toplevel]) != abs_clonedir:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 385

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -1
-                    logger.warning("Top level directory '%s'

doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 374

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse

--absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 376

Quoted 2 lines
bitbake/lib/bb/fetch2/git.py +0 -0
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s

(not a git directory?): %s", ud.clonedir, e)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 1 line
bitbake/lib/bb/fetch2/git.py +0 -0
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could

find a

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

parent git repo instead of the one being cloned)?

Yes, but this has not been a problem for me. Re-cloning existing

fully cached

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

repositories is the effect I see.

I think the git commit id and branch should decide if fetch or

re-clone steps are needed.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The path of the repository should not matter. The git remotes also

not. Both of those can

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

and do change.

In that case you're effectively sending a revert and we should probably be clear about that...

We really need to find a way to resolve things for everyone.

Quoted 7 lines
Quoted 7 lines

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15045):

https://lists.openembedded.org/g/bitbake-devel/message/15045

Quoted 3 lines
Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/101333074/3617156
Group Owner: [email protected] Unsubscribe:

https://lists.openembedded.org/g/bitbake-devel/leave/8021546/3617156/1661570722/xyzzy
[[email protected]]

Quoted 2 lines
Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#8 lore raw
Quoted 5 lines · Martin Jansa
Quoted 3 lines

not related to Mikkos problem.
I think I have a fix for Mikkos symlink problem though

Maybe it is related in the end, to my surprise /mnt/mirror-write/downloads is on some servers a symlink to /data001/work/downloads and then this /mnt/mirror-write/download is used as DL_DIR there (not /data001/work/downloads directly).

Ah, OK. That is the same problem as Mikko. I was assuming you were seeing that locally where the two aren't symlinked together. That is a much simpler explanation :)

Quoted 100 lines · Joshua Watt
Quoted 98 lines · Martin Jansa
Quoted 6 lines

FWIW: I'm also seeing warnings like:

WARNING: Top level directory '/data001/work/downloads/git2/git.libssh.org.projects.libssh.git' doesn't match expected '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'. Re-cloning

Where /mnt/mirror-write/downloads/ is configured DL_DIR and /data001/work/downloads/ was probably the DL_DIR of the jenkins jobs which originally fetched the libssh and created the tarball with it for premirror.

Ya, that /data001 path is _really_ weird. That path comes from running git rev-parse --absolute-git-dir in the extracted directory (ud.clonedir, '/mnt/mirror-write/downloads/git2/git.libssh.org.projects.libssh.git'). The should be no absolute paths encoded in the mirror tarballs, so
this seems like it's some sort of misconfiguration(?), and not related to Mikkos problem.

I think I have a fix for Mikkos symlink problem though

Quoted 79 lines

Cheers,

Quoted 75 lines · Richard Purdie
Quoted 49 lines · Mikko Rapeli

Hi,

Quoted 37 lines · Richard Purdie
Quoted 36 lines · Mikko Rapeli

Commit 10f38157a069cb6938323cadd5e523037a29ace9 triggers re-clones of uptodate repositories when their access path changes. This is wrong. It is enough that needed commits are found from the git repo. For example when same DL_DIR is accessed using two different paths due to a symlink, then the resulting absolute paths will differ but the content is the same. Trust the content.

Avoids extra downloads of large repositories like linux-yocto for kernel when the local cache was already uptodate.

---
 bitbake/lib/bb/fetch2/git.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
bitbake/lib/bb/fetch2/git.py +0 -12
index e11271b757..0c547ea303 100644
@@ -371,19 +371,7 @@ class Git(FetchMethod):
             # The directory may exist, but not be the top level of a bare git
             # repository in which case it needs to be deleted and re-cloned.
             try:
-                # Since clones can be bare, use --absolute-git-dir instead of --show-toplevel
-                output = runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
-
-                toplevel = os.path.abspath(output.rstrip())
-                abs_clonedir = os.path.abspath(ud.clonedir).rstrip('/')
-                # The top level Git directory must either be the clone directory
-                # or a child of the clone directory. Any ancestor directory of
-                # the clone directory is not valid as the Git directory (and
-                # probably belongs to some other unrelated repository), so a
-                # clone is required
-                if os.path.commonprefix([abs_clonedir, toplevel]) != abs_clonedir:
-                    logger.warning("Top level directory '%s' doesn't match expected '%s'. Re-cloning", toplevel, ud.clonedir)
Quoted 8 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 377

Quoted 5 lines
bitbake/lib/bb/fetch2/git.py +1 -1
-                    needs_clone = True
+                runfetchcmd("LANG=C %s rev-parse --absolute-git-dir" % ud.basecmd, d, workdir=ud.clonedir)
             except bb.fetch2.FetchError as e:
                 logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e)
                 needs_clone = True

Doesn't this give rise to some of the original issues (it could find a parent git repo instead of the one being cloned)?

Quoted 6 lines

Yes, but this has not been a problem for me. Re-cloning existing fully cached repositories is the effect I see.

I think the git commit id and branch should decide if fetch or re-clone steps are needed. The path of the repository should not matter. The git remotes also not. Both of those can and do change.

In that case you're effectively sending a revert and we should probably be clear about that...

We really need to find a way to resolve things for everyone.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15045): https://lists.openembedded.org/g/bitbake-devel/message/15045
Mute This Topic: https://lists.openembedded.org/mt/101333074/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/leave/8021546/3617156/1661570722/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-