[pacman-dev] [PATCH] allow "makepkg -R" to first unpack an already built package when $pkgdir is empty

Allan McRae allan at archlinux.org
Thu Aug 20 09:00:51 EDT 2009


FC wrote:
> >From ae3dd41af891f059b0aa1cc888eed873684b5580 Mon Sep 17 00:00:00 2001
> From: Francois Charette <francois at archlinux.org>
> Date: Tue, 18 Aug 2009 22:10:56 +0200
> Subject: [PATCH] makepkg -R: allow unpacking when pkgdir is empty
>
> Also fixed some typos :)
>   

When you "additional" part of your patch is as large as the patch 
itself, just make two patches.  I have not reviewed the typo fixes.

>  create_package() {
>      if [ ! -d "$pkgdir" ]; then
> -        error "$(gettext "Missing pkg/ directory.")"
> -        plain "$(gettext "Aborting...")"
> -        exit 1 # $E_MISSING_PKGDIR
> +        if [ "$REPKG" -eq 1 -a -f
> $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]; then
> +            mkdir "$pkgdir" && cd "$pkgdir"
> +            if ! bsdtar -xf
> $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ; then
>   

Please keep test style consistent with the rest of the code base.

> +                error "$(gettext "Failed to extract package for
> repackaging")"
> +                exit 1 # TODO: error code
> +            fi
> +            cd ..
>   

Do not "cd .." as $startdir and $pkgdir are not always related like 
that.  Especially with split packages.

> +        else
> +            error "$(gettext "Missing pkg/ directory.")"
> +            plain "$(gettext "Aborting...")"
> +            exit 1 # $E_MISSING_PKGDIR
> +        fi
>      fi
>
>      cd "$pkgdir"
>   

General comment:
Have you tested this with PKGBUILDs that define a package() function 
(including split packages)?   These PKGBUILDs run the package() function 
when using the -R option.  Without actually testing, I think this will fail.

Allan




More information about the pacman-dev mailing list