[MacPorts] #27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement
#27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement ---------------------------------------------+------------------------------ Reporter: james.from.wellington@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: base | Version: 1.9.2 Keywords: haspatch | Port: ---------------------------------------------+------------------------------ In the course of updating firefox-x11-devel, I wanted reinplace commands that look like this (modulo the new option): {{{ reinplace -u -E "s:(libplayback-1).so.0:${prefix}/lib/\1.dylib:" \ ${worksrcpath}/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp }}} where the \1 copies the library name into the replacement text. They work fine in sed, but did not work in macports because \1 is a tcl escape sequence for control-A. This patch provides the -u option (shown above) to convert control-A to control-H into \1 to \7, assuming that they are the remains of escape sequences, enabling the command in the Portfile to be tested by copy- pasting into command-line sed without a lot of editing. This ticket is a continuation of https://trac.macports.org/ticket/27299 -- Ticket URL: <https://trac.macports.org/ticket/27310> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement ---------------------------------------------+------------------------------ Reporter: james.from.wellington@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: base | Version: 1.9.2 Keywords: haspatch | Port: ---------------------------------------------+------------------------------ Comment(by ryandesign@…): Can't this already be accomplished without changing base by just doubling the backslashes before the numbers? I'm sure we already do this in tons of ports. -- Ticket URL: <https://trac.macports.org/ticket/27310#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement ---------------------------------------------+------------------------------ Reporter: james.from.wellington@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: base | Version: 1.9.2 Keywords: haspatch | Port: ---------------------------------------------+------------------------------ Comment(by james.from.wellington@…): I wouldn't know. If the rules are explained in the documentation, it's not obvious to me. I like this because it enables me to paste the pattern into command-line sed for testing, when it doesn't work. -- Ticket URL: <https://trac.macports.org/ticket/27310#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement ---------------------------------------------+------------------------------ Reporter: james.from.wellington@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: base | Version: 1.9.2 Keywords: haspatch | Port: ---------------------------------------------+------------------------------ Comment(by jmr@…): Replying to [comment:1 ryandesign@…]:
Can't this already be accomplished without changing base by just doubling the backslashes before the numbers? I'm sure we already do this in tons of ports. Yes. This isn't peculiar to reinplace either, you have to do the same thing when constructing a string to be run as a shell command for example. If you want a literal string, use braces. If you want some but not all of the normal substitutions, call subst(n) on your literal string with appropriate options.
-- Ticket URL: <https://trac.macports.org/ticket/27310#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement ----------------------------------------------+----------------------------- Reporter: james.from.wellington@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 1.9.2 Resolution: wontfix | Keywords: haspatch Port: | ----------------------------------------------+----------------------------- Changes (by ryandesign@…): * status: new => closed * resolution: => wontfix Comment: See for example the apache2 port which has: {{{ post-patch { reinplace -E "s/(User|Group) daemon/\\1 www/" ${worksrcpath}/docs/conf/httpd.conf.in } }}} I don't doubt our Guide is incomplete in this and many other respects. Patches to improve the documentation are welcome. -- Ticket URL: <https://trac.macports.org/ticket/27310#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27310: Feature request: -u option to reinplace, to facilitate \[0-9] copy into replacement ----------------------------------------------+----------------------------- Reporter: james.from.wellington@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 1.9.2 Resolution: wontfix | Keywords: haspatch Port: | ----------------------------------------------+----------------------------- Changes (by ryandesign@…): * cc: ryandesign@… (added) -- Ticket URL: <https://trac.macports.org/ticket/27310#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts