| @@ -1,16 +1,18 @@ | | | @@ -1,16 +1,18 @@ |
1 | #!@PERL@ -w | | 1 | #!@PERL@ -w |
2 | # -*- perl -*- | | 2 | # -*- perl -*- |
3 | # | | 3 | # |
| | | 4 | # $NetBSD: check-cvs-diff,v 1.4 2022/11/17 00:20:28 gutteridge Exp $ |
| | | 5 | # |
4 | # read output of (cd /usr/pkgsrc; cvs diff -u ) and check if | | 6 | # read output of (cd /usr/pkgsrc; cvs diff -u ) and check if |
5 | # py* and ruby* strings are left in buildlink3.mk. | | 7 | # py* and ruby* strings are left in buildlink3.mk. |
6 | # They are then modified to Variable representation. | | 8 | # They are then modified to Variable representation. |
7 | #" | | 9 | #" |
8 | use strict; | | 10 | use strict; |
9 | use Getopt::Std; | | 11 | use Getopt::Std; |
10 | our(@ARGV); | | 12 | our(@ARGV); |
11 | my (%opts); | | 13 | my (%opts); |
12 | | | 14 | |
13 | my($my_name) = $0; | | 15 | my($my_name) = $0; |
14 | $my_name =~ s#(.*)/##; | | 16 | $my_name =~ s#(.*)/##; |
15 | | | 17 | |
16 | sub usage(){ | | 18 | sub usage(){ |
| @@ -55,27 +57,27 @@ sub main() { | | | @@ -55,27 +57,27 @@ sub main() { |
55 | | | 57 | |
56 | open(CVS_DIFF, $CVS_DIFF) || die "Problem opening file $CVS_DIFF: $!\n"; | | 58 | open(CVS_DIFF, $CVS_DIFF) || die "Problem opening file $CVS_DIFF: $!\n"; |
57 | while(<CVS_DIFF>){ | | 59 | while(<CVS_DIFF>){ |
58 | # Looking for the +++ filename line in cvs diff (supposed to use 'cvs diff -u') | | 60 | # Looking for the +++ filename line in cvs diff (supposed to use 'cvs diff -u') |
59 | $file_to_edit = ''; | | 61 | $file_to_edit = ''; |
60 | if ( /^\+\+\+ (\S+)/) { | | 62 | if ( /^\+\+\+ (\S+)/) { |
61 | $file_to_edit = $1; } | | 63 | $file_to_edit = $1; } |
62 | if ( $file_to_edit && -f $file_to_edit ) { | | 64 | if ( $file_to_edit && -f $file_to_edit ) { |
63 | if ( $file_to_edit =~ /Makefile$/ ) { $Makefile++;} | | 65 | if ( $file_to_edit =~ /Makefile$/ ) { $Makefile++;} |
64 | elsif ( $file_to_edit =~ /buildlink3.mk$/ ) { $buildlink3++; | | 66 | elsif ( $file_to_edit =~ /buildlink3.mk$/ ) { $buildlink3++; |
65 | # print __LINE__, ' ', $file_to_edit,"\n"; | | 67 | # print __LINE__, ' ', $file_to_edit,"\n"; |
66 | my ($new_file) = $file_to_edit. '.new'; | | 68 | my ($new_file) = $file_to_edit. '.new'; |
67 | my ($edit) = 0; | | 69 | my ($edit) = 0; |
68 | open(NEW, "> $new_file" ) || print STDERR "Problem to write $edit: $! \n"; | | 70 | open(NEW, "> $new_file" ) || print STDERR "Problem opening file $new_file: $! \n"; |
69 | open(EDIT, $file_to_edit ) || print STDERR "Problem opening file $file_to_edit: $! \n"; | | 71 | open(EDIT, $file_to_edit ) || print STDERR "Problem opening file $file_to_edit: $! \n"; |
70 | while(<EDIT>) { | | 72 | while(<EDIT>) { |
71 | if ( /^BUILDLINK.*py27/ ) { $_=~ s/py27/\${PYPKGPREFIX}/ ; $edit++;} | | 73 | if ( /^BUILDLINK.*py27/ ) { $_=~ s/py27/\${PYPKGPREFIX}/ ; $edit++;} |
72 | if ( /^BUILDLINK.*py3[0-9]/ ) { $_=~ s/py3[0-9]/\${PYPKGPREFIX}/ ; | | 74 | if ( /^BUILDLINK.*py3[0-9]/ ) { $_=~ s/py3[0-9]/\${PYPKGPREFIX}/ ; |
73 | print STDERR " py3[0-9] found at $file_to_edit\n"; | | 75 | print STDERR " py3[0-9] found at $file_to_edit\n"; |
74 | ; $edit++;} | | 76 | ; $edit++;} |
75 | if ( /^BUILDLINK.*ruby[0-9][0-9]*/ ) { $_=~ s/ruby[0-9][0-9]*/\${RUBY_PKGPREFIX}/ ; $edit++;} | | 77 | if ( /^BUILDLINK.*ruby[0-9][0-9]*/ ) { $_=~ s/ruby[0-9][0-9]*/\${RUBY_PKGPREFIX}/ ; $edit++;} |
76 | print NEW $_; | | 78 | print NEW $_; |
77 | } | | 79 | } |
78 | close(EDIT); | | 80 | close(EDIT); |
79 | close(NEW); | | 81 | close(NEW); |
80 | if ($edit) { unlink $file_to_edit; | | 82 | if ($edit) { unlink $file_to_edit; |
81 | rename $new_file, $file_to_edit; | | 83 | rename $new_file, $file_to_edit; |