All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] fetch2/git: Prevent git fetcher from fetching gitlab repository metadata
@ 2022-08-19 16:54 Marek Vasut
  2022-08-20 12:06 ` Peter Kjellerstedt
  2022-08-22 16:02 ` Luca Ceresoli
  0 siblings, 2 replies; 23+ messages in thread
From: Marek Vasut @ 2022-08-19 16:54 UTC (permalink / raw)
  To: bitbake-devel
  Cc: Marek Vasut, Martin Jansa, Peter Kjellerstedt, Richard Purdie

The bitbake git fetcher currently fetches 'refs/*:refs/*', i.e. every
single object in the remote repository. This works poorly with gitlab
and github, which use the remote git repository to track its metadata
like merge requests, CI pipelines and such.

Specifically, gitlab generates refs/merge-requests/*, refs/pipelines/*
and refs/keep-around/* and they all contain massive amount of data that
are useless for the bitbake build purposes. The amount of useless data
can in fact be so massive (e.g. with FDO mesa.git repository) that some
proxies may outright terminate the 'git fetch' connection, and make it
appear as if bitbake got stuck on 'git fetch' with no output.

To avoid fetching all these useless metadata, tweak the git fetcher such
that it only fetches refs/heads/* and refs/tags/* . Avoid using negative
refspecs as those are only available in new git versions.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Martin Jansa <Martin.Jansa@gmail.com>
Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 4534bd75..b5fc0a51 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -382,7 +382,7 @@ class Git(FetchMethod):
               runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
 
             runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=ud.clonedir)
-            fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, shlex.quote(repourl))
+            fetch_cmd = "LANG=C %s fetch -f --progress %s refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*" % (ud.basecmd, shlex.quote(repourl))
             if ud.proto.lower() != 'file':
                 bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
             progresshandler = GitProgressHandler(d)
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-09-02 15:54 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19 16:54 [PATCH] [RFC] fetch2/git: Prevent git fetcher from fetching gitlab repository metadata Marek Vasut
2022-08-20 12:06 ` Peter Kjellerstedt
2022-08-22  5:19   ` [bitbake-devel] " Mikko.Rapeli
2022-08-22  6:57     ` Alexander Kanavin
2022-08-22  7:38       ` Mikko.Rapeli
2022-08-22  8:29         ` Marek Vasut
2022-08-22  8:37           ` Marek Vasut
2022-08-22  8:41             ` Marek Vasut
2022-08-22  9:09               ` Mikko.Rapeli
2022-08-22  8:41             ` Alexander Kanavin
2022-08-22 10:35               ` Marek Vasut
2022-08-22 10:51                 ` Mikko.Rapeli
2022-08-22 10:57                 ` Quentin Schulz
2022-08-22 11:55                   ` Marek Vasut
2022-08-22 14:17                     ` Richard Purdie
2022-08-22 15:21                       ` Peter Kjellerstedt
2022-08-22 16:39                         ` Marek Vasut
2022-09-01 17:50                           ` Marek Vasut
2022-09-02 15:54                             ` Richard Purdie
2022-08-22 16:02 ` Luca Ceresoli
2022-08-22 16:06   ` Peter Kjellerstedt
2022-08-22 16:07   ` Richard Purdie
2022-08-23 14:34     ` Luca Ceresoli

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.