[email protected] wrote:
> Revision: 48384
>           http://trac.macports.org/changeset/48384
> Author:   [email protected]
> Date:     2009-03-20 09:52:08 -0700 (Fri, 20 Mar 2009)
> Log Message:
> -----------
> port1.0/portutil.tcl:
> New handle_option-replace proc which allows to apply strsed on an option
> 
> Modified Paths:
> --------------
>     trunk/base/src/port1.0/portutil.tcl
> [...]

A little bit of explanation on this commit. We often have stuff like the
following lines in our Portfiles, especially in variants:

  configure.args-delete --disable-foo
  configure.args-append --enable-foo

Writing these lines is cumbersome in my opinion. So I created a similar
*-replace which allows to apply strsed replaces on an option:

  configure.args-replace s/--disable-foo/--enable-foo/

Note this is not real sed, only a small subset is supported (lacking
documentation). You can only do "s/foo/bar/" which replaces a single
instance of the search pattern or "g/foo/bar/" to make the replace
global, i.e. apply on all occurrences. It is also possible to leave out
's' or 'g' which behaves like 's', but can also be used for deletes like
"/foo/". The delimiter, which is "/" above, can be chosen freely. If you
want to play with strsed or test your replaces do what you expect, use [1].

I hope Portfile authors will find *-replace as useful as I do.

Rainer

[1]
http://trac.macports.org/wiki/CommittersTipsAndTricks#DoExplorativeProgrammingintclshwithReadlineSupport
_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev

Reply via email to