[issue2006] Add shallow src/pkgsrc option to /usr/Makefile

John Marino (via DragonFly issue tracker) sinknull at leaf.dragonflybsd.org
Sat Mar 5 21:38:36 PST 2011


New submission from John Marino <dragon at marino.st>:

This "feature" tracks the need for a shallow checkout of src and pkgsrc git 
repositories.  A patch of the former follows.  Originally posted on 29 Sep 2010 
on @users:


With regards to the source code at /usr/src, there are some of us users that 
don't need the entire history of the repository going back to version 2.0, but 
rather are only looking for head revision.

Currently, typing "make src-create" will clone the entire repository, which is 
currently at 306.8K objects and has a download of 229MB (and 226K deltas).

I created a patch that adds makefile option "make src-create-shallow" which will 
set the fetch depth to 1.  When I ran this today, the object count for the head 
revision was 98.6K and took 186MB to download (58K deltas).

I know 43 MB doesn't seem like a whole lot, but some people don't fast internet 
connections and don't have commit authority, so this shallow pull might be 
desirable for them.  As time passes, the difference between a full repository 
and head pull will increase, so the benefit of such an option will increase as 
well.

My proposed patch follows.

Regards,
John



--- Makefile.orig    2010-09-29 12:53:57 +0200
+++ Makefile    2010-09-29 13:41:02 +0200
@@ -29,6 +29,7 @@
 .endif
 .else
     @echo "    make src-create          - fetch initial src repo from the net"
+    @echo "    make src-create-shallow  - fetch initial history-free src repo"
     @echo "    make src-update          - update your src repo from the net"
 .endif
     @echo ""
@@ -75,6 +76,18 @@
     cd ${.CURDIR}/src && git checkout master
     cd ${.CURDIR}/src && git pull

+src-create-shallow:
+    @echo "If problems occur you may have to rm -rf src and try again."
+    @echo ""
+    mkdir -p ${.CURDIR}/src
+    cd ${.CURDIR}/src && git init
+    cd ${.CURDIR}/src && \
+        git remote add origin git://git.dragonflybsd.org/dragonfly.git
+    cd ${.CURDIR}/src && git fetch --depth=1 origin
+    cd ${.CURDIR}/src && git branch master origin/master
+    cd ${.CURDIR}/src && git checkout master
+    cd ${.CURDIR}/src && git pull
+
 src-checkout:
     cd ${.CURDIR}/src && git checkout master

----------
assignedto: sjg
keyword: feature
messages: 9663
nosy: marino, sjg
priority: feature
status: unread
title: Add shallow src/pkgsrc option to /usr/Makefile

_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue2006>
_____________________________________________________






More information about the Bugs mailing list