Date: Thu, 12 Aug 1999 12:57:50 +0200 From: Anton Berezin <tobez@plab.ku.dk> To: Bill Fumerola <billf@jade.chc-chimes.com> Cc: Tim Vanderhoek <vanderh@ecf.utoronto.ca>, Satoshi - Ports Wraith - Asami <asami@FreeBSD.ORG>, freebsd-ports@FreeBSD.ORG Subject: Re: ports/13030: Many ports use ``chown'' rather than ``/usr/sbin/chown'' in their Makefiles Message-ID: <19990812125750.B56987@lion.plab.ku.dk> In-Reply-To: <Pine.BSF.4.10.9908090901570.72927-100000@jade.chc-chimes.com>; from Bill Fumerola on Mon, Aug 09, 1999 at 09:02:47AM -0400 References: <19990809083649.B97354@mad> <Pine.BSF.4.10.9908090901570.72927-100000@jade.chc-chimes.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 09, 1999 at 09:02:47AM -0400, Bill Fumerola wrote: > On Mon, 9 Aug 1999, Tim Vanderhoek wrote: > > > If you auto-generated the patch with a script, submitting that would > > be easier. The committer can make a simple modification to have the > > script checkout anything it changes. If you hand-edit the patches, > > then patches are better. > > I'll take anything, though I'll probably end up grep'ing myself. Okay. I am sorry for the delay. The revised version of a script is below the sig. The script is interactive, and I believe is more/less convenient to use - at least it does diff prints and asks for a confirmation. It is also easy to modify it to handle chmod, strip etc. cases if necessary. Cheers, -- Anton Berezin <tobez@plab.ku.dk> The Protein Laboratory, University of Copenhagen #! /usr/bin/perl -w use strict; $| = 1; # # it is easy to add support for chmod, strip etc. # it is easy to add an external pager for diff prints # it is easy to add some autocommit feature to this # # please tell me <tobez@plab.ku.dk> if you would # like any of this to be added # # Cheers # my $tmp = ($ENV{TMPDIR} || '/tmp') . "/chowned.Makefile"; chdir "/usr/ports" or die $!; unlink $tmp; die "cannot unlink $tmp" if -r $tmp; print "searching..."; open CHOWN, "grep -il chown */*/Makefile |" or die $!; while (<CHOWN>) { print "\n"; chomp( my $makefile = $_); open MK, "< $makefile" or die $!; open PATCHED, "> $tmp" or die $!; while (<MK>) { # print lines without chown as is unless (/\bchown\b/) { print PATCHED; next; } # skip clever CHOWN assignments - they are unnecessary next if m%^\s*CHOWN\s*\??=\s*(?:/usr/sbin/)?chown\s*$%; # change all /usr/sbin/chown for ${CHOWN} s%/usr/sbin/chown%\${CHOWN}%g; # change all standalone chown for ${CHOWN} s%\bchown\b%\${CHOWN}%g; print PATCHED; } close PATCHED; close MK; my $diff = `diff -u $makefile $tmp`; if ($diff) { print "|||||||||| suggested patch for \"$makefile\":\n"; # patch the patch $diff =~ s%^--- (\S+)(.*?)\n\+{3} (\S+)(.*?)\n%--- $1.orig$2\n+++ $1$4\n%s; print $diff; my $aa = ''; until ($aa =~ /^[aAdDcC]$/) { print "|||||||||| \"$makefile\": A)ccept D)iscard C)ancel -> "; $aa = <>; } chomp $aa; last if lc $aa eq 'c'; next if lc $aa eq 'd'; rename $makefile, "$makefile.orig" or die $!; system( "/bin/cp", $tmp, $makefile); } else { # there was no difference, just tell this print "||||||||||| \"$makefile\" seems to be arleady alright.\n"; print "||||||||||| press enter -> "; scalar <>; } } close CHOWN; 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?19990812125750.B56987>