You are not logged in.

#1 2015-05-16 09:43:35

xpixelz
Member
From: Tunisia
Registered: 2012-02-29
Posts: 47
Website

[Solved] Forcing PKGBUILD git shallow clone through makepkg script!

Recently I was making a pkg that downloaded ~500MB (the whole git repo) and who needs all that for a simple build purpose!

# vim `which makepkg` +/clone
...
541         msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
542         if ! git clone --mirror "$url" "$dir"; then
543             error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
...

Appending "--mirror --single-branch --depth 1" to the "git clone" command:

541         msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
542         if ! git clone --mirror --single-branch --depth 1 "$url" "$dir"; then
543             error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"

Here is a diff view:

--- makepkg ...
+++ makepkg ...
@@ -539,7 +539,7 @@

    if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
        msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
-       if ! git clone --mirror "$url" "$dir"; then
+       if ! git clone --mirror --single-branch --depth 1 "$url" "$dir"; then
            error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
            plain "$(gettext "Aborting...")"
            exit 1

Now I've got only 100MB for the same package.

Are there any drawbacks I'm not yet aware of?

Last edited by xpixelz (2015-07-03 08:41:53)

Offline

#2 2015-05-19 12:52:48

xpixelz
Member
From: Tunisia
Registered: 2012-02-29
Posts: 47
Website

Re: [Solved] Forcing PKGBUILD git shallow clone through makepkg script!

Well found out it fails when cloning over http:

$ git clone http://git.tukaani.org/xz.git --mirror --depth 1 --single-branch
Cloning into bare repository 'xz.git'...
fatal: dumb http transport does not support --depth

Offline

Board footer

Powered by FluxBB