patching in general

markd at macports.org markd at macports.org
Thu Feb 5 10:12:10 PST 2009


>> I wonder if some macro would be useful that would automatically parse
>> patched files for a set of standard names (highly unique) to be 
>> replaced
>> according to defaults ( '__mports__prefix__' -> ${prefix} etc.) 
>> that could
>> be overridden.  Maybe that is too complex, but sometimes I think the
>> current patch-and-reinplace way does seem like a cumbersome (though 
>> not
>> difficult) way to do it.
>
>Yeah, it's especially painful when you have to extract
>the list of all files touched from the patch and then
>duplicate that list in the Portfile for reinplace...
>
>That's why some ports use a custom patch{} phase instead,
>to filter the patch accordingly before applying it. Like yum,
>http://trac.macports.org/browser/trunk/dports/sysutils/yum/ ?
>
>Having such a patch-filter built-in to port would be nice.
>
>--anders

>patch {
>	                foreach patch $patchfiles {
>	                        system "cd '${workpath}/${distname}' && \
>	                        sed -e 's#@@PREFIX@@#${prefix}#g' -e
>'s#@@PYTHON@@#${prefix}/bin/python2.4#g'
>'${portpath}/${filesdir}/${patch}' | patch -p0"
>	                }
>	}

I see.  That would be a cool macro, say 'fixpatchfiles' with a standard
table of default mappings that could be augmented or overridden.  To do
the latter in a portfile, a table could be provided:

'fixpatchfiles __macports__prefix__:${prefix}/bin \
     __macports__foo__:${whatever}'

But then we could probably do with a lot of macros that we don't have now.
 Things like portage has (dobin, dodoc, etc.) would be a higher stage of
development that we may get to someday.

Mark



More information about the macports-dev mailing list