Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jun 2002 22:39:14 -0700
From:      Doug Barton <DougB@FreeBSD.org>
To:        Ade Lovett <ade@FreeBSD.org>
Cc:        Akinori MUSHA <knu@iDaemons.org>, Trevor Johnson <trevor@jpj.net>, Mikhail Teterin <mi+mx@aldan.algebra.com>, Pete Fritchman <petef@absolutbsd.org>, portmgr@FreeBSD.org, Maxim Sobolev <sobomax@FreeBSD.org>, ports@FreeBSD.org, jmallett@FreeBSD.org
Subject:   Re: REINPLACE
Message-ID:  <3D0C2482.1D32A134@FreeBSD.org>
References:  <B9317479.11EB9%ade@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Ade Lovett wrote:
> 
> On 06/15/02 22:32, "Doug Barton" <DougB@FreeBSD.org> wrote:
> 
> > Ade Lovett wrote:
> >>
> >> On 06/14/02 18:15, "Doug Barton" <DougB@FreeBSD.org> wrote:
> >>
> >>> At tremendous risk to my sanity, I'm going to try and make a rather
> >>> obvious point one more time. You guys are putting a tremendous amount of
> >>> effort into this REINPLACE stuff in order to avoid the simple, clean
> >>> solution of not doing the patching 'in place' at all. I have the following
> >>> (or something similar) in several of my ports:
> >>>
> >>> post-patch:
> >>>       @ ${CP} ${WRKSRC}/configure ${WRKSRC}/configure.Patched
> >>>       @ ${SED} -e 's#-lpthread#${PTHREAD_LIBS}#g' \
> >>>               ${WRKSRC}/configure.Patched > ${WRKSRC}/configure
> >
> > Please tell me that you really are not so lacking in imagination.
> 
> No.  Just trying to maintain the status quo of perl -pi substituting
> regexp's in place on files, without leaving other turds around.

I can't help thinking your use of the word "turd" in this context is an
attempt to characterize my proposed solution as well, however let's
leave that aside for now. However, I think that part of the problem here
is that you're working so hard on finding a one-to-one solution (which
isn't actually possible in any case) that you're needlessly complicating
something that could be simple for the majority of cases; just to try to
make some edge cases look easy. 

> > I use this exact technique in for loops in my ports. Take a look at
> > xscreensaver for example. It used to have more files that needed the
> > malloc patch, but at this moment in time it only has one. The code above
> > works just as well in a for loop or not.
> 
> Yes.  I believed we did look at xscreensaver, once.  Still doesn't work as
> is for xargs though.

Can you explain in more detail what you mean by this? Do you mean lines
like:

audio/easytag/Makefile: @${FIND} ${WRKSRC} -name "Makefile.in" |
${XARGS} ${PERL} -pi -e \

If so, that can easily be re-written in a more explicit subshell. A
quick grep shows 331 ports that use similar semantics. Not easy, but not
impossible either.
 
> > In the rare circumstance that this matters, you could use .orig if it
> > makes you feel better (since we'd have to deal with that anyway). The
> > other alternative is to simply remove the files, like it's sometimes
> > necessary to do with the .orig files. Look at Spam Assassin for an
> > example of that.
> 
> Of course it matters.  Any "extra" file generated within ../work has the
> chance of buggering up the plist (and I'm sure you'll be first on the horn
> to explain about plist breakage).  perl -pi doesn't leave turds around, and
> can easily be used as part of a for loop, or xargs, or whatever.

Pete Frichtman responded with an equally valid solution, sed > foo.sed,
mv foo.sed foo.  So, no "turds." I've also already shown you that my
solution can be used in a for loop, and we can come up with other
solutions for the few ports that use xargs. I am interested in examples
of "whatever." 

> If you have a real solution to this problem, one that does not violate POLA
> in the $BIGNUM ports that use this technique, please feel free to provide a
> full patch. 

I'm sorry, you haven't shown a POLA violation, just a few edge cases
that would need special handling. IMO, many fewer cases would need that
kind of special handling with my solution than with the incredible
gymnastics that you guys are suggesting for REINPLACE. 

> Until then, half-assed patches (of which we have many) are
> abundant, until the authors actually understand what it is to affect 2000+
> ports at one time.

Where on earth is all this hostility coming from? Also, why are you even
considering affecting "2000 ports at one time?" I think that's actually
part of the problem here. You've determined that the problem is, "How do
we make a drop in replacement for perl -i?" Unfortunately, we've already
shown that this isn't possible. So, I'm trying to simplify the problem
by defining it as, "How do we accomplish the same result as perl -i as
simply as possible for the majority of ports, and then handle the
special cases seperately?" I think my problem is a lot easier to solve,
and my solution is more likely to succeed.

Doug

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D0C2482.1D32A134>