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

Allan McRae allan at archlinux.org
Tue Oct 8 22:54:03 EDT 2013


On 02/10/13 03:23, Lukáš Jirkovský wrote:
> 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.
> ---

Patch seems to be broken:

makepkg: line 586: unexpected EOF while looking for matching ``'
makepkg: line 3188: syntax error: unexpected end of file


>  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

Why is the pushd/popd needed here?   And backticks are bad.

> +		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
>  }
>  
> 



More information about the pacman-dev mailing list