aura icon indicating copy to clipboard operation
aura copied to clipboard

use shallow clones

Open adam-devel opened this issue 4 years ago • 14 comments

shallow clone *-git packages (using --depth=1) for faster cloning

adam-devel avatar Jan 31 '21 23:01 adam-devel

  • why?
  • what use-cases are?
  • wouldn't it break stuff?
  • what are the alternatives (other AUR wrappers) doing?

This issues needs more info.

ratijas avatar Feb 02 '21 12:02 ratijas

This may be a concern of makepkg, it's the thing that does the actual pulling of git sources. Here's an example. Notice that the calling of git clone isn't present anywhere in the PKGBUILD - makepkg handles this.

Otherwise, aura already does do a shallow git clone for all packages to get their PKGBUILDs and patch files before building.

fosskers avatar Feb 02 '21 18:02 fosskers

  • why?

faster cloning, take less disk space also, why not? packages are built from the source code of a specific commit i don't see the need to pull the history of the source code just to not use it in the building process

  • what use-cases are?

having slow connection and/or limited bandwidth

  • wouldn't it break stuff?

maybe, but it's not obvious to me

  • what are the alternatives (other AUR wrappers) doing?

i don't know and i don't think it really matter

adam-devel avatar Feb 02 '21 22:02 adam-devel

This may be a concern of makepkg, it's the thing that does the actual pulling of git sources. Here's an example. Notice that the calling of git clone isn't present anywhere in the PKGBUILD - makepkg handles this.

Otherwise, aura already does do a shallow git clone for all packages to get their PKGBUILDs and patch files before building.

i think, when a repository is already cloned, makepkg does not re-clone it. maybe this can be taken advantage of to allow aura to handle this part? (cloning repositories for makepkg) i think at this point this is too much for aura to handle, and might even be considered out of scope for an aur helper

adam-devel avatar Feb 02 '21 22:02 adam-devel

I'm going to look into makepkg and see if a patch is necessary there.

fosskers avatar Feb 02 '21 22:02 fosskers

https://wiki.archlinux.org/index.php/User:Apg#makepkg:_shallow_git_clones

Morganamilo avatar Feb 02 '21 22:02 Morganamilo

This was proposed and rejected (more than once) on pacman tracker https://wiki.archlinux.org/index.php/User:Apg#makepkg:_shallow_git_clones but there is a way which I've been using couple times https://gist.github.com/andrewgregory/770cbedfa2da3817d762483155a330b8

(oops, was couple seconds too late)

micwoj92 avatar Feb 02 '21 22:02 micwoj92

@fosskers would it be acceptable to have a flag that would make aura wrap makepkg like this (or use this file instead of /usr/bin/makepkg, and let bash take care of overriding the git command):

https://gist.github.com/andrewgregory/770cbedfa2da3817d762483155a330b8

adam-devel avatar Feb 02 '21 22:02 adam-devel

It would break any packages that make use of checkout in the pkgbuild.

Morganamilo avatar Feb 02 '21 22:02 Morganamilo

yeah, its why i asked if it would be acceptable to have it under a flag (not a default behavior)

adam-devel avatar Feb 02 '21 23:02 adam-devel

Yesterday I was probably drunk AF or something, and I mistook the issue to be a request for NOT doing recursive clones. Naturally, I felt surprised and wtf'ed about it.

I'm sorry, and I take my words (https://github.com/fosskers/aura/issues/690#issuecomment-771610305) back.

Since this is not a technical restriction of aura, but simply a matter of breaking weird PKGBUILDs at compile-time, I believe this feature would quite acceptable as an opt-in flag.

ratijas avatar Feb 03 '21 09:02 ratijas

@Morganamilo Thanks for the link. Well the Arch devs might not like shallow cloning (they often prioritise "power user" scenarios, re: the first linked issue in the tracker), but I don't see why we shouldn't. Parsing the .SCINFO instead would be one way to fetch all the sources ahead of time. And indeed if done so, I don't think makepkg tries again (at least for tarballs). I can experiment with this.

fosskers avatar Feb 03 '21 18:02 fosskers

If you choose to bypass makepkg with the source downloading then you'll have to handle #commit= #tag= ?siged and so on.

Morganamilo avatar Feb 03 '21 18:02 Morganamilo

We will have to explore this as a new feature after the 4.0 release.

fosskers avatar Feb 03 '21 19:02 fosskers