[pacman-dev] [PATCH] With VCS sources, only update sources in $srcdir.

Lukáš Jirkovský l.jirkovsky at gmail.com
Tue Oct 1 13:23:36 EDT 2013


Previously, the sources in $srcdir were always removed prior building.

After this change the sources are only updated. This makes
incremental builds possible. Also this goes in line with the current behaviour
for other types of sources, where the sources are just being overwritten without
being removed first.
---
 scripts/makepkg.sh.in | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 67ec240..90df60c 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -516,9 +516,11 @@ extract_bzr() {
 
 	msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr"
 	pushd "$srcdir" &>/dev/null
-	rm -rf "${dir##*/}"
 
-	if ! { bzr checkout "$dir" "${revision[@]}" --lightweight &&
+	if [[ -d "${dir##*/}" ]]; then
+		cd_safe "${dir##*/}"
+		bzr update
+	elif ! { bzr checkout "$dir" "${revision[@]}" --lightweight &&
 		( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then
 		error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr"
 		plain "$(gettext "Aborting...")"
@@ -580,9 +582,12 @@ extract_git() {
 
 	msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git"
 	pushd "$srcdir" &>/dev/null
-	rm -rf "${dir##*/}"
-
-	if ! git clone "$dir"; then
+	if [[ -d "${dir##*/}" ]]; then
+		pushd `pwd` &>/dev/null
+		cd_safe "${dir##*/}"
+		git pull
+		popd &>/dev/null
+	elif ! git clone "$dir"; then
 		error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
 		plain "$(gettext "Aborting...")"
 		exit 1
@@ -607,7 +612,7 @@ extract_git() {
 	fi
 
 	if [[ -n $ref ]]; then
-		if ! git checkout -b makepkg $ref; then
+		if ! git checkout -B makepkg $ref; then
 			error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
 			plain "$(gettext "Aborting...")"
 			exit 1
@@ -662,7 +667,6 @@ extract_hg() {
 
 	msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg"
 	pushd "$srcdir" &>/dev/null
-	rm -rf "${dir##*/}"
 
 	local ref
 	if [[ -n $fragment ]]; then
@@ -677,7 +681,10 @@ extract_hg() {
 		esac
 	fi
 
-	if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then
+	if [[ -d "${dir##*/}" ]]; then
+		cd_safe "${dir##*/}"
+		hg pull -u
+	elif ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then
 		error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg"
 		plain "$(gettext "Aborting...")"
 		exit 1
@@ -739,7 +746,6 @@ extract_svn() {
 
 	msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn"
 	pushd "$srcdir" &>/dev/null
-	rm -rf "${dir##*/}"
 
 	local ref
 	if [[ -n $fragment ]]; then
@@ -754,16 +760,20 @@ extract_svn() {
 		esac
 	fi
 
-	cp -a "$dir" .
-
 	if [[ -n ${ref} ]]; then
-		cd_safe "$(get_filename "$netfile")"
+		cd_safe "$dir"
 		if ! svn update -r ${ref}; then
 			error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn"
 			plain "$(gettext "Aborting...")"
 		fi
 	fi
 
+	if [[ -d "${dir##*/}" ]]; then
+		cp -au "$dir" "$srcdir"
+	else
+		cp -a "$dir" .
+	fi
+
 	popd &>/dev/null
 }
 
-- 
1.8.4



More information about the pacman-dev mailing list