Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the preferred way to manage local patches in the FreeBSD ports tree. As an example look at textproc/urlview. This port installs the url_handler.sh script. This script defines applications to be used for different url types. The default applications do not match my system.

So, what to do? I used two rather unsatisfying ways in the past:

  1. Build and install the vanilla port and edit `/usr/local/bin/url_handler.sh` directly. This messes up the deletion of the installed port as the checksum has changed. This can be avoided by messing with the files in `/var/db/pkg` directly but that's as hackish as it can get.
  2. Create a patch file in `/usr/ports/textproc/urlview/files` that patches the script in the `patch` phase accordingly. However this fails if you are using `portsnap` as it wipes the directory clean before updating the ports tree.

How are you guys handling this kind of things?

share|improve this question
    
maybe this is worth asking on server fault. I am also interested after upgrading a few of the packages myself. – Andrew Cox Oct 24 '09 at 0:42
    
Check out the port from AnonCVS, then you can add local files to your port. – arved Dec 9 '11 at 12:53

Option 2. I have a handful of patches to particular ports. If one has a newer version, update your ports tree, then copy in the modified patches and manually run 'make patch' to see if it patches cleanly. Then 'make' to see if builds.

share|improve this answer

I would say option 2 but use a script to copy your patches. A script helps document a procedure, which really helps when you go back in a year and try to figure out what you did.

Although you could write something fancy which "overlays" a directory structure onto the ports tree, I find that simpler is better:

#/bin/sh
PORTSTREE="/usr/ports"
MYPATCHDIR="/wherever/you/put/these"

# my textproc/urlview patch
cp ${MYPATCHDIR}/myurlview.patch ${PORTSTREE}/textproc/urlview/files

Now you can list all your modifications in one file, and have all your patches in one directory. Run the script after you portsnap or (nowdays) svn a new ports tree.

share|improve this answer

You must log in to answer this question.