From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1IrAKY-00078g-MH for garchives@archives.gentoo.org; Sun, 11 Nov 2007 10:46:19 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.2/8.14.0) with SMTP id lABAjKk6028264; Sun, 11 Nov 2007 10:45:20 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.14.2/8.14.0) with ESMTP id lABAhQt1025816 for ; Sun, 11 Nov 2007 10:43:27 GMT Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 6BC79658BD for ; Sun, 11 Nov 2007 10:43:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -0.168 X-Spam-Level: X-Spam-Status: No, score=-0.168 required=5.5 tests=[AWL=0.364, BAYES_00=-2.599, RCVD_NUMERIC_HELO=2.067] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iNGk3MxqoWkB for ; Sun, 11 Nov 2007 10:43:20 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id ADE52649BF for ; Sun, 11 Nov 2007 10:43:18 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IrAHU-00053P-EN for gentoo-dev@gentoo.org; Sun, 11 Nov 2007 10:43:08 +0000 Received: from 81.168.40.136 ([81.168.40.136]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Nov 2007 10:43:08 +0000 Received: from slong by 81.168.40.136 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Nov 2007 10:43:08 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-dev@lists.gentoo.org From: Steve Long Subject: [gentoo-dev] Re: to patch or sed was -> repoman and checking for correct quoting Date: Sun, 11 Nov 2007 10:47:12 +0000 Message-ID: References: <47358D39.8050901@gentoo.org> <20071110173623.GA32402@shuttle> <1194717029.13773.26.camel@wlt.obsidian-studios.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 81.168.40.136 User-Agent: KNode/0.10.4 Sender: news Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id lABAjKln028264 X-Archives-Salt: 51a5364d-fe66-4755-ade7-4ae0035c9417 X-Archives-Hash: 1de4bb1de52dfaa0ef0db496c66ba330 William L. Thomson Jr. wrote: > On Sat, 2007-11-10 at 18:36 +0100, Bo =D8rsted Andresen wrote: >> On Sat, Nov 10, 2007 at 11:51:37AM +0100, Krzysiek Pawlik wrote: >> > It's purpose is to remove the ${D} from makefile, additionally ${D} = is >> > in single quotes, so it will not be expanded - is it a bug in repoma= n >> > check? >>=20 >> What ${D} ? I see none in that makefile. Which is why I think a patch >> would be better in this case. A patch would actually tell you when hal= f >> of the substitutions don't match anything... I think this is a point >> worth making even if it doesn't change your point. >=20 > I have kinda gone back and forth between patches and sed. While I agree > patches are better since they fail to apply at times. Sed stuff can be > more portable amongst revisions, as I have found with maintaining assp. > Where the patch grew to the point it had to be mirrored :(. >=20 > Now I know some will scream, puke, throw up in their mouth, and so on. > But seems like sed should have an OPTIONAL argument or etc to tell sed > to either fail if it can't make the change anywhere. And/or keep/output > a count of how many things were modified. >=20 ed does this by default (which can make it trickier) -- if a standard sea= rch and replace doesn't match, it's considered an error. I appreciate ed isn'= t currently part of system set, but imo it should be, since it's specified = in posix. A workaround is grep -q, eg: if grep -qF '${D}' file; then sed -i '#\${D}##' file fi (You need to escape $ in a regex or it'll be treated as end marker.) This= is more useful in cases where you need to know what is in the file for whatever reason (eg grep -q '^FEATURES=3D"[^"]*-blah' /etc/make.conf [1])= , since the sed will not affect the file if there is no match. Of course, repoman still needs to ignore stuff in single quotes. [1] if ! grep -qF sandbox < <(portageq envvar FEATURES); then .. (for example) is safer for general case. --=20 gentoo-dev@gentoo.org mailing list