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

Allan McRae allan at archlinux.org
Mon Jun 22 03:15:21 EDT 2009


Loui Chang wrote:
> Signed-off-by: Loui Chang <louipc.ist at gmail.com>
> ---
>  scripts/makepkg.sh.in |   36 ++++++++++++++++++++----------------
>  1 files changed, 20 insertions(+), 16 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index b555a03..2140ff0 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -871,22 +871,7 @@ tidy_install() {
>  	fi
>  }
>  
> -create_package() {
> -	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...")"
> -
> +write_pkginfo() {
>  	local builddate=$(date -u "+%s")
>  	if [ -n "$PACKAGER" ]; then
>  		local packager="$PACKAGER"
> @@ -958,6 +943,25 @@ create_package() {
>  		warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT"
>  		plain "$(gettext "Example for GPL\'ed software: license=('GPL').")"
>  	fi
> +}
> +
> +create_package() {
> +	if [ ! -d "$pkgdir" ]; then
> +		error "$(gettext "Missing pkg/ directory.")"
> +		plain "$(gettext "Aborting...")"
> +		exit 1 # $E_MISSING_PKGDIR
> +	fi
> +
> +	if [ -z "$1" ]; then
> +		nameofpkg="$pkgname"
> +	else
> +		nameofpkg="$1"
> +	fi
> +
> +	write_pkginfo $nameofpkg
> +
> +	cd "$pkgdir"
> +	msg "$(gettext "Creating package...")"
>  
>  	local comp_files=".PKGINFO"
>  
>   

Thanks pushed to my working branch with a couple of minor changes:

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2140ff0..2bb7eb9 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -880,14 +880,13 @@ write_pkginfo() {
        fi
        local size=$(du -sk | awk '{print $1 * 1024}')
 
-       # write the .PKGINFO file
        msg2 "$(gettext "Generating .PKGINFO file...")"
        echo "# Generated by makepkg $myver" >.PKGINFO
        if [ "$INFAKEROOT" -eq 1 ]; then
                echo "# using $(fakeroot -v)" >>.PKGINFO
        fi
        echo "# $(LC_ALL=C date -u)" >>.PKGINFO
-       echo "pkgname = $nameofpkg" >>.PKGINFO
+       echo "pkgname = $1" >>.PKGINFO
        echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
        echo "pkgdesc = $pkgdesc" >>.PKGINFO
        echo "url = $url" >>.PKGINFO






More information about the pacman-dev mailing list