[pacman-dev] [RFC] git and svn adding --depth option

Timofey Titovets nefelim4ag at gmail.com
Wed Oct 1 09:26:12 UTC 2014


Good time of day,
I thinking about adding to makepkg --depth option for speed up git clone 
and svn checkout command, what used for building packages.

I add small patch and i like to hear your opinions, people.

 From d7195baef241ba8411e834665842c3686a05a6d2 Mon Sep 17 00:00:00 2001
From: Timofey Titovets <nefelim4ag at gmail.com>
Date: Wed, 1 Oct 2014 01:14:51 +0300
Subject: [PATCH] git/svn source download: added --depth option

Signed-off-by: Timofey Titovets <nefelim4ag at gmail.com>
---
  scripts/makepkg.sh.in | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f949403..0142ba8 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -540,9 +540,12 @@ download_git() {
  	url=${url##*git+}
  	url=${url%%#*}

+	if [[ $FASTGIT != 0 ]]; then
+		depth="--depth 5"
+	fi
  	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 $depth "$url" "$dir"; then
  			error "$(gettext "Failure while downloading %s %s repo")" "${repo}" 
"git"
  			plain "$(gettext "Aborting...")"
  			exit 1
@@ -705,10 +708,14 @@ download_svn() {
  	fi
  	url=${url%%#*}

+	if [[ $FASTSVN != 0 ]]; then
+		depth="--depth 5"
+	fi
+
  	if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
  		msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "svn"
  		mkdir -p "$dir/.makepkg"
-		if ! svn checkout --config-dir "$dir/.makepkg" "$url" "$dir"; then
+		if ! svn checkout $depth --config-dir "$dir/.makepkg" "$url" "$dir"; then
  			error "$(gettext "Failure while downloading %s %s repo")" "${repo}" 
"svn"
  			plain "$(gettext "Aborting...")"
  			exit 1
-- 
2.1.1


More information about the pacman-dev mailing list