Current-Users archive

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

Re: how to write patch for pkgsrc ?

Hello kamel!

On Mon, Aug 11, 2008 at 10:13:45AM -0700, kamel derouiche wrote:
> hi,,
> how to write patch for pkgsrc ? 
> using pkgvi, mkpatches, patch? I need an example
This is pretty simple, for example:

    $ export PKGSRCDIR="/usr/pkgsrc"
        $ cd ${PKGSRCDIR}/pkgtools/pkgdiff
        $ make install
        $ cd ../../misc/dvtm
        $ make extract
        $ pkgvi $(make show-var VARNAME=WRKSRC)/
        [hey, it's our friend, vi(1) (or the ${PKGEDITOR} or ${EDITOR} 
variable)! :-)]
        /* Why dvtm doesn't like getopt(3)? */
        pkgvi: File was modified. For a diff, type:
        pkgdiff /usr/pkgsrc/misc/dvtm/work/dvtm-0.4.1/dvtm.c
        $ pkgdiff /usr/pkgsrc/misc/dvtm/work/dvtm-0.4.1/dvtm.c  # we'd like to 
see our patch

        --- /usr/pkgsrc/misc/dvtm/work/dvtm-0.4.1/dvtm.c.orig   2008-05-10 
18:39:01.000000000 +0200
        $ mkpatches
        $ cp $(make show-var VARNAME=WRKDIR)/.newpatches/* patches
        $ cat patches/patch-ab

        --- dvtm.c.orig 2008-05-10 18:39:01.000000000 +0200

However, this is the MAINTAINER-way, if you'd like to patch it with the
pkgsrc-user way (for example on dvtm we need to adjust the config.h file
for the customization):

        $ cd ${PKGSRCDIR/misc/dvtm
        $ mkdir -p ${PKGSRCDIR}/localpatches/misc/dvtm
        $ echo "LOCALPATCHES = /usr/pkgsrc/localpatches" >> /etc/mk.conf
        $ cp $(make show-var VARNAME=WRKSRC)/config.h \
        > $(make show-var VARNAME=LOCALPATCHES)/misc/dvtm/config.h.orig
        $ cd $(make show-var VARNAME=LOCALPATCHES)/misc/dvtm
        $ vi config.h.orig
        :wq config.h
        $ diff -u config.h.orig config.h > patch-co
        $ cd ${PKGSRCDIR}/misc/dvtm
        $ make install  # Finally we can enjoy dvtm with the cyan borders :-)

The "magic" variable in this example is LOCALPATCHES, the LOCALPATCHES
is like category/package/patches directory. However, the first is for
the MAINTAINER and MAINTAINERs usually patch the source only for
portability or security, the latter is for the pkgsrc user, that for
example would like a cyan border. :-)

For more information please read ``The pkgsrc guide''...
...and happy (pkg)diff(1)ing! :-)

Ciao, Leonardo
 Leonardo Taccari (leot) |

Attachment: pgp32j_rGslhx.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index