[pacman-dev] [PATCH] Update existing sources instead of removing them first for VCS sources.

Allan McRae allan at archlinux.org
Wed Oct 9 23:05:18 EDT 2013


On 09/10/13 22:13, 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.
> ---
>  scripts/makepkg.sh.in | 33 +++++++++++++++++++++------------
>  1 file changed, 21 insertions(+), 12 deletions(-)
> 

I'm looking at the git functions here as this is what I am testing...
I am almost certain the comment below applied to bzr and hg too.

<snip>

> @@ -580,9 +582,11 @@ 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
> +		cd_safe "${dir##*/}"
> +		git pull
> +		cd_safe "$srcdir"

No need for that cd there.

> +	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 +611,7 @@ extract_git() {
>  	fi
>  
>  	if [[ -n $ref ]]; then
> -		if ! git checkout -b makepkg $ref; then
> +		if ! git checkout -B makepkg $ref; then

I immediately noticed that this will not allow me to switch from using a
branch/commit/tag and then revert to using master.

I guess removing that "if [[ -n $ref ]]" is enough to fix that?

>  			error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
>  			plain "$(gettext "Aborting...")"
>  			exit 1
> @@ -662,7 +666,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


<snip>

> @@ -754,16 +759,20 @@ extract_svn() {
>  		esac
>  	fi
>  
> -	cp -a "$dir" .
> -

Huh...

>  	if [[ -n ${ref} ]]; then
> -		cd_safe "$(get_filename "$netfile")"
> +		cd_safe "$dir"

Umm...   how are you going into $dir when it has never been copied?

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

I think this needs to go where the old "cp -a" was.  I also guess that
svn will not be affected by the issue with git/hg/bzr above given the
master copy is always being copied over and then the reference checked out.

>  	popd &>/dev/null
>  }
>  
> 



More information about the pacman-dev mailing list