Reinplace

Ryan Schmidt ryandesign at macports.org
Mon Apr 2 10:31:01 PDT 2012


On Apr 1, 2012, at 08:53, Craig Treleaven wrote:
> At 10:20 AM -0400 3/31/12, Jeremy Lavergne wrote:
>> > cd cd "/opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_Myth.25/mythtv/work/mythtv-v0.25-rc-0-g92f7d1f/mythtv"
>>> sudo find . -name "Makefile" -exec sed -i '' 's/ -L / /g' {} \;
>>> 
>>> This is what MacPorts Reinplace extension is for, right?  Would this be the right syntax?
>>> 
>>> post-configure {
>>> 	reinplace 's/ -L / /g' ${worksrcpath}/Makefile
>>> }
>>> 
>>> Reinplace will do a recursive search from the specified directory on down, right?
>> 
>> reinplace will only operate on the files you give to it. You need to give it a complete list or you might use it in conjunction with fs-traverse (see `man portfile`).
>> 
> 
> I'm struggling with this.  Did I mention I'm new to MacPorts AND tcl? ;)  What I've got so far is this:
> 
> post-configure {
>   	fs-traverse myfile ${configure.dir} {
> 			if  { [ file tail $myfile ] == "Makefile" } {
> #				ui_info "Removing any spurious -L from ${myfile}"
> 				reinplace "s/ -L / /g" ${myfile}
>       	}
>   	}
> }
> 
> The trouble is that it does the reinplace on less than half the 20 or so files that need it.

Since you've subsequently noticed the same problem when running "find", I suspect your regular expression is not correct. I will try to build the port later and see if I can figure out what's going on.


> BTW, in debug output, it spews the following for every file that it fixes.
> 
>> DEBUG: Executing proc-post-org.macports.configure-configure-0
>> DEBUG: euid/egid changed to: 0/0
>> DEBUG: chowned /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_Myth.25/mythtv/work/mythtv-v0.25-rc-0-g92f7d1f/mythtv/Makefile to macports
>> DEBUG: euid/egid changed to: 506/502
>> DEBUG: euid/egid changed to: 0/0
>> DEBUG: setting attributes on /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_Myth.25/mythtv/work/mythtv-v0.25-rc-0-g92f7d1f/mythtv/Makefile
>> DEBUG: euid/egid changed to: 506/502
>> DEBUG: euid/egid changed to: 0/0
>> DEBUG: chowned /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_Myth.25/mythtv/work/mythtv-v0.25-rc-0-g92f7d1f/mythtv/bindings/perl/Makefile to macports
>> DEBUG: euid/egid changed to: 506/502
>> DEBUG: euid/egid changed to: 0/0
>> DEBUG: setting attributes on /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_Myth.25/mythtv/work/mythtv-v0.25-rc-0-g92f7d1f/mythtv/bindings/perl/Makefile
>> DEBUG: euid/egid changed to: 506/502
> 
> I noticed the ".asroot" whatchamacallit but I don't seem to be able to add that to post-configure.  Is there some way to run the whole segment with appropriate permissions?


This spew is normal; I suggest you ignore it. I don't know why we added it to reinplace. Perhaps it should be removed from base. It becomes especially annoying for any port using the kde4 portgroup, because the kde4 portgroup does a reinplace on every file in the tarball, resulting in three lines of output in the log for every file, and some ports have thousands of files. For example, kdelibs4's main.log file is over 4MB large just by the time the extract phase finishes.




More information about the macports-dev mailing list