Re: reinplace

2018-11-22 Thread Ryan Schmidt
On Nov 18, 2018, at 20:52, Mark Brethen wrote: > I tried to chain reinplace a file? i.e. > > reinplace "s|@@PREFIX@@|${prefix}|g" \ >"s|@@CFLAGS@@|${configure.cflags} ${PICFLAG}|g" \ >"s|@@CC@@|${configure.cc}|g” ${worksrcpath}_SHARED

reinplace

2018-11-18 Thread Mark Brethen
I tried to chain reinplace a file? i.e. reinplace "s|@@PREFIX@@|${prefix}|g" \ "s|@@CFLAGS@@|${configure.cflags} ${PICFLAG}|g" \ "s|@@CC@@|${configure.cc}|g” ${worksrcpath}_SHARED/Make.inc but this failed. Is there another way besides breaking them up

Re: need help with reinplace

2018-11-06 Thread Ryan Schmidt
On Nov 6, 2018, at 15:06, Helmut K. C. Tessarek wrote: > > On 2018-11-04 22:06, Ryan Schmidt wrote: >> We finally got a warning added to MacPorts so that if a reinplace doesn't do >> anything you're notified, > > On that note... > > Warning: reinp

Re: need help with reinplace

2018-11-06 Thread Helmut K. C. Tessarek
On 2018-11-04 22:06, Ryan Schmidt wrote: > We finally got a warning added to MacPorts so that if a reinplace doesn't do > anything you're notified, On that note... Warning: reinplace s|-arch [a-z0-9_]+||g didn't change anything in /opt/loc

Re: need help with reinplace

2018-11-04 Thread Ryan Schmidt
On Nov 4, 2018, at 16:27, Helmut K. C. Tessarek wrote: > On 2018-11-04 02:49, Ryan Schmidt wrote: >> The way I would approach this is to write a patch file which inserts >> "@VERSION@" into the file where you want the version to appear. Then >> you can simply r

Re: [SPAM] Re: need help with reinplace

2018-11-04 Thread Helmut K. C. Tessarek
On 2018-11-04 01:34, Joshua Root wrote: > What about it doesn't make sense to you? We need to understand this in > order to write documentation that explains it well. I thought I made this clear in my original post. I want to use this regex in inreplace: s/AC_INIT\(\[tmux\], (next-[0-9]+\.[0-9]+

Re: [SPAM] Re: [SPAM] need help with reinplace

2018-11-04 Thread Helmut K. C. Tessarek
On 2018-11-04 02:49, Ryan Schmidt wrote: > The way I would approach this is to write a patch file which inserts > "@VERSION@" into the file where you want the version to appear. Then > you can simply reinplace "s|@VERSION@|${version}|g" to get the real > version i

Re: [SPAM] need help with reinplace

2018-11-04 Thread Ryan Schmidt
, which will make it difficult when inevitably sometime in the future the port is updated to a new version and the message appears that the reinplace didn't change anything, because someone will then have to understand and either update or remove that regex. For instance, you said: > I want

Re: [SPAM] Re: need help with reinplace

2018-11-03 Thread Joshua Root
s, because the brackets here don't have to be protected from the shell. Imagine if the string you wanted to replace contained backticks or dollar signs instead of brackets. > But I get your point. There are cases where additional escaping is > required. Still, IMO this additional escapin

Re: [SPAM] Re: need help with reinplace

2018-11-03 Thread Helmut K. C. Tessarek
that is understood by all regex engines makes this example worthwhile. You don't have to worry about escaping, quoting, or whatnot. Just add a regex and it works. > This works fine: reinplace -E "s/bad/awesome/g" FILE > > So does this: reinplace -E "s/bad/${good

Re: [SPAM] Re: need help with reinplace

2018-11-03 Thread Joshua Root
On 2018-11-4 08:10 , Helmut K. C. Tessarek wrote: > set reinplace_cmd [subst -nobackslashes -nocommands > {s/bad/awesome/g}] > reinplace -E $reinplace_cmd FILE This example misses the point because the command does not contain any characters that have a special meaning in Tcl. The only r

Re: [SPAM] Re: need help with reinplace

2018-11-03 Thread Helmut K. C. Tessarek
aph like this to reinplace: Since the Tcl way of how regexes are used/interpreted (or whatnot) in reinplace truly sucks (and is fucked up), here's a way to use a regex as it used in any other language. set reinplace_cmd [subst -nobackslashes -nocommands {s/bad/awesome/g}] reinplace -E $reinp

Re: need help with reinplace

2018-11-02 Thread Ryan Schmidt
On Nov 2, 2018, at 19:40, Helmut K. C. Tessarek wrote: > Or at least a reference to what `subst -nobackslashes -nocommands` does > and how to use it to build useful regexes. ;-) That's in the Tcl documentation: https://www.tcl.tk/man/tcl8.5/TclCmd/subst.htm

Re: need help with reinplace

2018-11-02 Thread Helmut K. C. Tessarek
bst -nobackslashes -nocommands > {s/AC_INIT\(\[tmux\], (next-[0-9]+\.[0-9]+)\)/AC_INIT([tmux], \1 > (${version}))/g}] > reinplace -E $reinplace_cmd ${worksrcpath}/configure.ac I ended up using this one, since it had the entire regex on one line. Thanks again! Cheers, K. C. -- regards Helmut K.

Re: need help with reinplace

2018-11-02 Thread Joshua Root
figure out why. > > I want to replace the following line in configure.ac > AC_INIT([tmux], next-2.9) > with > AC_INIT([tmux], next-2.9 (${version})) > > The > > reinplace -E "s|^AC_INIT\(\[tmux\], > (next-\[0-9\]+\.\[0-9\]+)\)$|AC_INIT(\[tmux\], \\1 ${versio

need help with reinplace

2018-11-02 Thread Helmut K. C. Tessarek
re.ac AC_INIT([tmux], next-2.9) with AC_INIT([tmux], next-2.9 (${version})) The reinplace -E "s|^AC_INIT\(\[tmux\], (next-\[0-9\]+\.\[0-9\]+)\)$|AC_INIT(\[tmux\], \\1 ${version})|g" ${worksrcpath}/configure.ac With that I get an error message: invalid command name "0-9" Weir

Re: [macports-ports] branch master updated: scidavis: remove unnecessary reinplace instructions in case of standard prefix

2018-05-08 Thread Nicolas Pavillon
Thanks for the comment. This reinplace in fact did nothing in practice as it was acting on an old patch that is not used anymore. I should have deleted it completely, fixed in f04fa388. >> >> new f578df0 scidavis: remove unnecessary reinplace instructions in case >>

Re: [macports-ports] branch master updated: scidavis: remove unnecessary reinplace instructions in case of standard prefix

2018-05-08 Thread Ryan Schmidt
/heads/master by this push: > > new f578df0 scidavis: remove unnecessary reinplace instructions in case > of standard prefix > > f578df0 is described below > > > commit f578df0c2a5e1479fa834624b11e487ed79b23cb > > Author: Nicolas Pavillon > AuthorDa

Re: reinplace first occurrence

2017-08-03 Thread Ryan Schmidt
On Aug 3, 2017, at 15:19, db wrote: > On 3 Aug 2017, at 18:46, Ryan Schmidt wrote: > >> I can't remember anybody asking for this functionality (replace first >> occurrence) before, so that's why there isn't an easy way to do it. > > I needed to add disabled/true to a startup item provided by a

Re: reinplace first occurrence

2017-08-03 Thread db
On 3 Aug 2017, at 18:46, Ryan Schmidt wrote: > You could run a two-command sed manually (with system, not reinplace). Or > maybe you can use awk, or an ed script. This works. Caveat emptor: || (empy RE) doesn't work and range seems to start on first line, not on its subsequent. rei

Re: reinplace first occurrence

2017-08-03 Thread Ryan Schmidt
;d still like to know how to do it. Well the stack overflow answer says non-GNU sed doesn't support the single-command version, and needs a two-command version. reinplace doesn't support executing multiple commands. You could run a two-command sed manually (with system, not reinplac

reinplace first occurrence

2017-08-03 Thread db
I checked portfile's man page and peaked at the source, but couldn't figure out yet, why these forms don't work. https://stackoverflow.com/a/11458836/2167331 In the meantime, I worked around it, but I'd still like to know how to do it.

Re: env python - port select or reinplace

2017-04-28 Thread db
On 28 Apr 2017, at 03:19, Ryan Schmidt wrote: > Use the latest stable version of python. Or offer variants so the user can > choose, and default to the latest stable version. Could you please take a look at #54054? The port rewrites some paths before copying the files in place — nothing fancy.

Re: env python - port select or reinplace

2017-04-27 Thread Ryan Schmidt
> On Apr 27, 2017, at 13:28, db wrote: > > On 27 Apr 2017, at 19:11, Joshua Root wrote: >> If you have a dependency on a pythonXY port you need to make the scripts use >> that particular version. > > I have #! /usr/bin/env python3 in the scripts, no particular version. You must make it be a

Re: env python - port select or reinplace

2017-04-27 Thread db
On 27 Apr 2017, at 19:11, Joshua Root wrote: > If you have a dependency on a pythonXY port you need to make the scripts use > that particular version. I have #! /usr/bin/env python3 in the scripts, no particular version. But even if I had one, and it run on any (recent) version, what should I u

Re: env python - port select or reinplace

2017-04-27 Thread Joshua Root
On 2017-4-28 02:00 , db wrote: What should I use to reference the python binary, put notes to use port select or rewrite the interpreter directive? If you have a dependency on a pythonXY port you need to make the scripts use that particular version. - Josh

env python - port select or reinplace

2017-04-27 Thread db
What should I use to reference the python binary, put notes to use port select or rewrite the interpreter directive?

Re: Reinplace warnings

2017-03-21 Thread Joshua Root
On 2017-3-21 23:07 , Craig Treleaven wrote: 1) What happens if my port uses ‘reinplace -q …’ but the user hasn’t updated to MacPorts 2.4.1? Does the port fail or is the -q flag ignored? With 2.4.0, the flag is accepted; with older versions, it fails. If the user has updated the ports tree

Re: Reinplace warnings

2017-03-21 Thread Ryan Schmidt
On Mar 21, 2017, at 07:07, Craig Treleaven wrote: > > 1) What happens if my port uses ‘reinplace -q …’ but the user hasn’t updated > to MacPorts 2.4.1? Does the port fail or is the -q flag ignored? With 2.4.0 it will be ignored. With earlier, an error will occur, so users shoul

Reinplace warnings

2017-03-21 Thread Craig Treleaven
1) What happens if my port uses ‘reinplace -q …’ but the user hasn’t updated to MacPorts 2.4.1? Does the port fail or is the -q flag ignored? 2) My MythTV ports have scores of Perl and Python scripts where I need to reinplace the shebang lines. That works but the user now gets over 100

Re: Warning: reinplace ... didn't change anything in ...

2017-02-28 Thread Brandon Allbery
On Tue, Feb 28, 2017 at 2:30 PM, Ryan Schmidt wrote: > > On Feb 28, 2017, at 06:34, Brandon Allbery wrote: > > > Is there a convenient way to silence it? For example, I can imagine a > reinplace intended to allow replacement of /opt/local with an alternate > prefix, whi

Re: Warning: reinplace ... didn't change anything in ...

2017-02-28 Thread Ryan Schmidt
On Feb 28, 2017, at 06:34, Brandon Allbery wrote: > Is there a convenient way to silence it? For example, I can imagine a > reinplace intended to allow replacement of /opt/local with an alternate > prefix, which will in most cases trigger the warning. Continue reading the rest of

Re: Warning: reinplace ... didn't change anything in ...

2017-02-28 Thread Brandon Allbery
On Mon, Feb 27, 2017 at 1:10 PM, Ryan Schmidt wrote: > MacPorts 2.4.1 shows a new warning when a reinplace command doesn't change > anything. The purpose of reinplace is to change something in a file, so > when that doesn't happen, it may be a developer error that we

Re: Warning: reinplace ... didn't change anything in ...

2017-02-28 Thread Mojca Miklavec
On 28 February 2017 at 01:02, Jeremy Lavergne wrote: > On 02/27/2017 01:10 PM, Ryan Schmidt wrote: >> >> MacPorts 2.4.1 shows a new warning when a reinplace command doesn't change >> anything. The purpose of reinplace is to change something in a file, so when >>

Re: Warning: reinplace ... didn't change anything in ...

2017-02-27 Thread Jeremy Lavergne
Can buildbot report on this at warning levels? Or should we have something `-Werror`-like? On 02/27/2017 01:10 PM, Ryan Schmidt wrote: > MacPorts 2.4.1 shows a new warning when a reinplace command doesn't change > anything. The purpose of reinplace is to change something in a fi

Warning: reinplace ... didn't change anything in ...

2017-02-27 Thread Ryan Schmidt
MacPorts 2.4.1 shows a new warning when a reinplace command doesn't change anything. The purpose of reinplace is to change something in a file, so when that doesn't happen, it may be a developer error that we want to alert the developer about. Portfile developers should remove these w