[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to cope with patches sanely



On Thu, Jan 31, 2008 at 08:54:03AM +0000, Lars Wirzenius wrote:
> On to, 2008-01-31 at 09:19 +0100, sean finney wrote:
> > is there any reason why this issue couldn't be solved by amending policy (or 
> > just simply patching dpkg-source) to require that "debian/rules patch" (or 
> > some less commonly used name if we're worried about existing implementations 
> > of this rule) is called as part of the unpacking process or a source package?   
> > just a thought...
> 
> That would be one possible way of implementing it. I'd be satisfied with
> that, and it's in the spirit of the way Debian tries to standardize on
> interfaces that don't unduly limit implementation.
> 
> To prevent having to add a no-op to thousands of source packages that
> don't use a patch management system, a tweak to the rule might be
> appropropriate: the target is only required if the debian/patches
> directory exists. Alternatively, only if debian/control's source package
> stanza has a "Patch-System: simple-patchsys/quilt/dbs/..." header.
> 
> On the other hand, this would require at least some of the build
> dependencies be present at the time of unpacking the source, unless we
> make quilt and cdbs and dpatch etc build essential. Perhaps it would be
> better to make the creation of the source package create a .diff.gz that
> already has the patches applied? This may be more complicated to change,
> and probably requires changes to how the patch systems are used.

Bah, one can make the rule optional using gnu make -q feature, make
resturns:
  -q returns:
  * 0 if the target exists and is up to date
  * 1 if the target exists and is _not_ up to date
  * 2 if the target doesn't exists.


With the following snipplet (assuming set -e), you can support packages
that don't have a patch target at all gracefully, while not requiring it
to be present:

# there probably exists shorter but well ..
if ./debian/rules -q patch 2>/dev/null; then
    :
else
    if test $? = 1; then
	./debian/rules patch
    fi
fi


  Of course, that would mean that the few debian/rules (hi Manoj) in
Debian not being makefiles should support -q semantics, though I assume
it's easier to migrate this little amount of packages, rather than every
debian/rules to have a patch target ;)


-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpN0m3otuL2B.pgp
Description: PGP signature


Reply to: