[pacman-dev] [PATCH] makepkg: Add a late check if package exists when using package functions

Nezmer git at nezmer.info
Wed May 26 09:55:41 EDT 2010


On Wed, May 26, 2010 at 11:30:38AM +1000, Allan McRae wrote:
> On 26/05/10 02:00, Nezmer wrote:
> >pkgver and pkgrel can be overridden in package functions. makepkg can't
> >use the overridden values when doing the early check if a package file
> >already exists. That means makepkg will silently delete the existing
> >package file and generate a new one.
> >
> >pkgbase=N
> >pkgname=(N1 N2)
> >pkgver=1
> >pkgrel=1
> >arch=(any)
> >
> >package_N1() {
> >   pkgver=v1
> >}
> >
> >package_N2() {
> >   pkgver=v2
> >}
> >
> >Signed-off-by: Nezmer<git at nezmer.info>
> 
> 
> I am not sure about this...   I am of the opinion that if you have
> to override pkgver in every package function, then your default
> value is wrong.  With a better default pkgver, the check should
> detect at least one of your packages is already built and abort.

I generally agree. I understand how this condition will probably never
occur in arch.

I discovered this when I decided to prefix or postfix pkgver and/or
pkgrel with some values dynamically. As I'm not sure If this is possible
in any other way, I wrote a function to do this and called it in package
functions.


I'm probably the only one who needs this. So, I edited the condition
to respect FORCE and applied to my personal tree:
 (( (PKGFUNC || SPLITPKG) && !FORCE ))

> 
> Also, I really do not like the erroring out after all the packages
> have been built  (although "makepkg -R" would save all that work).
> I think these conditions should be an error out early or not at all.

IMHO, silently deleting files (especially outside $startdir) is always
bad. The rarity of this condition is a more compelling argument.

> 
> Allan
> 

Thank you for your feedback.

Nezmer


More information about the pacman-dev mailing list