Subject: Re: patching order
To: iMil <imil@home.imil.net>
From: Johnny Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 04/08/2005 10:46:23
iMil wrote:
> 
> i'm modifying openssh's package to integrate OpenSSH LDAP Public Key 
> (openssh-lpk patch) feature. Nothing's wrong with options.mk usage, 
> except that patches/patch-at conflicts with openssh-lpk.patch, defined by:
> 
> PATCH_SITES= http://www.opendarwin.org/projects/openssh-lpk/files/
> PATCHFILES=             openssh-lpk-3.9p1-0.3.2.patch
> 
> However, openssh-lpk patch does not conflict with patches when applied 
> after them.
> 
> My question is, is there any way to affect patching order, say, 
> patches/* before PATCHFILES ?

No, there isn't any way to specify patching order.  There's no good 
general way to do this since patches can conflict, especially if they 
are 3rd-party patches that aren't integrated into the mainline distribution.

What I would do is rename patch-at to "no-privsep-patch" and create a 
no-privsep-lpk-patch that contains the same changes but after the 
openssh-lpk patch is applied.  Then you would create a post-patch target 
that looks something like:

post-patch:
.if !empty(PKG_OPTIONS:Mlpk)
	${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/no-privsep-lpk-patch
.else
	${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/no-privsep-patch
.endif

It's kludgy, but the best we can do for now.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>