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

Re: How to cope with patches sanely



Lars Wirzenius kirjoitti:

> 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 add up to this suggestion:

If some patch system is used, there would be mandatory targets 
like "patch", "patch-new" and "patch-save" in the debian/rules. These 
can probably be included from /usr/share/quilt/quilt.make 
or /usr/share/dpatch/dpatch.make or similar. Also a target 
like "unpack" must be available if upstream sources are in compressed 
form inside the orig.tar.gz.

If debian/patches directory exists (or the patch system is detected some 
way or another), "dpkg-source -x" would run "debian/rules patch" with 
output like "Applying Debian-specific patches from 
debian/patches...done". If upstream source package is in compressed 
form inside the orig.tar.gz, then the "patch" target must depend 
on "unpack" target which unpacks and prepares the upstream stuff to 
patchable and editable source form.

After applying the patch series, "dpkg-source -x" would say something 
user-friendly like "To add new modifications, first run 'debian/rules 
patch-new', then edit files and finally run 'debian/rules patch-save'." 
The "patch-new" target would prepare a new patch to the end of the 
series and take a snapshot copy from the current source tree. 
The "patch-save" target diffs all the modifications agaist the snapshot 
and adds them to this new patch. The "patch-new"-edit-"patch-save" 
round can be repeated many times if one wants to create separate 
patches.

Would this work? :)

As Lars said, a build-depend for a patch tool is not enough. Tools must 
be available when running "dpkg-source -x" so maybe dpkg-source needs 
to check patch system's availability when it detects some patch system 
being used.


Reply to: