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

FC firmicus04 at googlemail.com
Fri Aug 21 08:22:25 EDT 2009


Allan McRae wrote:

> FC wrote:

>> >From ae3dd41af891f059b0aa1cc888eed873684b5580 Mon Sep 17 00:00:00 2001
>> From: Francois Charette <francois at archlinux.org> <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.


Fair enough. Should I resend as two separate patches?

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

Not sure what you mean...

>

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


ok

>

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


Right, this will certainly not work with split packages...

Before I spend more time on this, do you think this is worth implementing?
I thought it coult be useful in situations where you build a pkg (with
makepkg -c) that takes a long time compiling, and then realize you
forgot one dependency, for instance. Then makepkg -R would work even if
the pkgdir is empty. Of course it is also no big deal to unpack manually
first...

F


More information about the pacman-dev mailing list