After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796953 - Add option to enable shallow fetch optimization
Add option to enable shallow fetch optimization
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: cerbero
unspecified
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-08-13 20:17 UTC by Nicolas Dufresne (ndufresne)
Modified: 2018-11-03 10:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add option to enable shallow fetch optimization (3.54 KB, patch)
2018-08-13 20:17 UTC, Nicolas Dufresne (ndufresne)
needs-work Details | Review

Description Nicolas Dufresne (ndufresne) 2018-08-13 20:17:44 UTC
See commit, this is a proposal to add a shallow fetch optimization option
to cerbero global configuration. This reduces fetch time both initially and
when we check for updates.
Comment 1 Nicolas Dufresne (ndufresne) 2018-08-13 20:17:49 UTC
Created attachment 373322 [details] [review]
Add option to enable shallow fetch optimization

When use_shallow_fetch=True is set in your cerbero.cbc file, cerbero
will attempt to fetch only the requested tag or branch from the git
server, without any history. This speeds up the fetch operation, though
it only works well know references (branches and tags). Git protocol 2
might allow further optimization in the future.
Comment 2 Sebastian Dröge (slomo) 2018-08-14 07:11:09 UTC
Review of attachment 373322 [details] [review]:

::: cerbero/build/source.py
@@ +215,3 @@
+            commit = self.config.recipe_commit(self.name) or self.commit
+            if self.config.use_shallow_fetch and commit.startswith('origin/'):
+              git.fetch_ref(self.repo_dir, 'origin', commit[7:], fail=False)

Why limit it to "origin/"? What's wrong with doing it for specific commits or tags (note: tags don't specify the remote!), or other remotes than origin?

::: recipes/taglib.recipe
@@ -8,3 @@
     version = '1.11.1'
     stype = SourceType.TARBALL
-    url = 'https://taglib.org/releases/taglib-%(version)s.tar.gz'

This should be a separate commit
Comment 3 Nicolas Dufresne (ndufresne) 2018-08-14 13:18:44 UTC
Oops, the taglib thing is totally accidental, I'll remove/split in next update. It's possible someone already fixed this taglib issue, I need to check.

About the origin/, this is because git shallow is only supported on branches and tags (announced commit). This is a limitation of the git protocol 1, I haven't tested, but this should work with git protocol 2. Though it's too early, all the servers we use need to be updated.
Comment 4 Nicolas Dufresne (ndufresne) 2018-08-14 13:27:40 UTC
I need to check for tags (not tested yet). In theory, because you can have multiple remotes in cerbero (an ancient use case from the original SDK), you could have clashing tags, which would lead to some ambiguity error. I've seen that once elsewhere, a bad release, and someone moved the tag / force push. But this is rare.

I guess we need to improve a bit that change, since atm it means the shallow can only work on origin branches. Not that useful for CI after all.
Comment 5 Nirbheek Chauhan 2018-08-14 13:31:35 UTC
(In reply to Nicolas Dufresne (ndufresne) from comment #4)
> I need to check for tags (not tested yet). In theory, because you can have
> multiple remotes in cerbero (an ancient use case from the original SDK), you
> could have clashing tags, which would lead to some ambiguity error. 
> 
> I guess we need to improve a bit that change, since atm it means the shallow
> can only work on origin branches. Not that useful for CI after all.

A nice way to do this might be to have a function `self._ref_can_shallow` (or similar) that splits on '/' and checks whether the first part of that is `in self.remotes`. That should cover branches.
Comment 6 Nicolas Dufresne (ndufresne) 2018-08-14 17:34:06 UTC
Agreed, but I'm starting to think I'll just drop that optimization for now and reconsider if the new git protocol can do what I really want it to do.
Comment 7 GStreamer system administrator 2018-11-03 10:24:28 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/cerbero/issues/71.