How best to change a hard-coded config search path, before compilation

A. Karl Kornel karl at kornel.us
Fri Nov 4 17:53:41 PDT 2016


Hello!

I am creating a port for a Python program called "clustershell", and I'd 
like some advice as to how to handle a hard-coded config file search 
path.

The clustershell program looks for configuration in a number of places, 
with "/etc/clustershell/" hard-coded as the first path, so I have to 
change it to use the prefix set at build time. What I was wondering is, 
what method should I use to make the change?

The first thing I was thinking of doing is using "reinplace" directly on 
the file in question, in the pre-build phase. The section method I came 
up with was to use a patch file to change the line, replacing "/etc" 
with "PREFIX_GOES_HERE" (or something), and then using reinplace to put 
in the correct path.

Both methods do the same thing, but in my mind the second method is 
better because it makes absolutely sure I am only changing one part of 
the file. Also, if the code changes in a future version, the patch will 
fail to apply. That will help me from missing changes.

Does anyone have any advice as to how best to proceed?  I appreciate any 
advice you can provide!

-- 
~ Karl Kornel


More information about the macports-dev mailing list