Proposed new src option for /usr/Makefile

John Marino dragonflybsd at marino.st
Wed Sep 29 12:17:59 PDT 2010



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







More information about the Users mailing list