#!@PERL@ -w # -*- perl -*- # # read output of (cd /usr/pkgsrc; cvs diff -u ) and check if # py* and ruby* strings are left in buildlink3.mk. # They are then modified to Variable representation. #" use strict; use Getopt::Std; our(@ARGV); my (%opts); my($my_name) = $0; $my_name =~ s#(.*)/##; sub usage(){ print <){ # Looking for the +++ filename line in cvs diff (supposed to use 'cvs diff -u') $file_to_edit = ''; if ( /^\+\+\+ (\S+)/) { $file_to_edit = $1; } if ( $file_to_edit && -f $file_to_edit ) { if ( $file_to_edit =~ /Makefile$/ ) { $Makefile++;} elsif ( $file_to_edit =~ /buildlink3.mk$/ ) { $buildlink3++; # print __LINE__, ' ', $file_to_edit,"\n"; my ($new_file) = $file_to_edit. '.new'; my ($edit) = 0; open(NEW, "> $new_file" ) || print STDERR "Problem to write $edit: $! \n"; open(EDIT, $file_to_edit ) || print STDERR "Problem opening file $file_to_edit: $! \n"; while() { if ( /^BUILDLINK.*py27/ ) { $_=~ s/py27/\${PYPKGPREFIX}/ ; $edit++;} if ( /^BUILDLINK.*py3[0-9]/ ) { $_=~ s/py3[0-9]/\${PYPKGPREFIX}/ ; print STDERR " py3[0-9] found at $file_to_edit\n"; ; $edit++;} if ( /^BUILDLINK.*ruby[0-9][0-9]*/ ) { $_=~ s/ruby[0-9][0-9]*/\${RUBY_PKGPREFIX}/ ; $edit++;} print NEW $_; } close(EDIT); close(NEW); if ($edit) { unlink $file_to_edit; rename $new_file, $file_to_edit; $mod++;} else { $stay++; unlink $new_file; }; } else { $other++; print STDERR " (other) ", $file_to_edit,"\n"} } } close(CVS_DIFF); printf STDERR "Makefile: %4d\n", $Makefile; printf STDERR "buildlink3.mk: %4d\n", $buildlink3; printf STDERR " Modified: %4d\n", $mod; printf STDERR " Untouched: %4d\n", $stay; printf STDERR "Other: %4d\n", $other; } main(); exit;