[pacman-dev] [PATCH 1/3] makepkg: Move .PKGINFO creation into a function.

Allan McRae allan at archlinux.org
Sun Jun 21 06:49:29 EDT 2009


Loui Chang wrote:
> Signed-off-by: Loui Chang <louipc.ist at gmail.com>
> ---
>  scripts/makepkg.sh.in |   24 ++++++++++++++----------
>  1 files changed, 14 insertions(+), 10 deletions(-)
>
>   

I like the idea but have a few comments on the implementation.

> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 433fe34..d396480 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -871,22 +871,13 @@ tidy_install() {
>  	fi
>  }
>  
> -create_package() {
> +write_pkginfo() {
>   

I'd like this to stay at the top of create_package as nameofpkg is also 
needed there.  Then write_pkginfo can just be called with "write_pkginfo 
$nameofpkg"

>  	if [ -z "$1" ]; then
>  		nameofpkg="$pkgname"
>  	else
>  		nameofpkg="$1"
>  	fi
>  
> -	if [ ! -d "$pkgdir" ]; then
> -		error "$(gettext "Missing pkg/ directory.")"
> -		plain "$(gettext "Aborting...")"
> -		exit 1 # $E_MISSING_PKGDIR
> -	fi
> -
> -	cd "$pkgdir"
> -	msg "$(gettext "Creating package...")"
> -
>  	local builddate=$(date -u "+%s")
>  	if [ -n "$PACKAGER" ]; then
>  		local packager="$PACKAGER"
> @@ -951,6 +942,19 @@ create_package() {
>  			fi
>  		fi
>  	done
> +}
> +
> +create_package() {
> +	if [ ! -d "$pkgdir" ]; then
> +		error "$(gettext "Missing pkg/ directory.")"
> +		plain "$(gettext "Aborting...")"
> +		exit 1 # $E_MISSING_PKGDIR
> +	fi
>
>   

Note comment above:

> +	write_pkginfo $@
> +
> +	cd "$pkgdir"
> +	msg "$(gettext "Creating package...")"
>   

The warning about license should be moved to the write_pkginfo function.
>  
>  	# TODO maybe remove this at some point
>  	# warn if license array is not present or empty
>   

Allan




More information about the pacman-dev mailing list