]> git.donarmstrong.com Git - perltidy.git/commitdiff
improve display of any MANIFEST changes
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 1 Jan 2025 16:39:31 +0000 (08:39 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 1 Jan 2025 16:39:31 +0000 (08:39 -0800)
dev-bin/build.pl

index 312c3b9d517b79fbd58638b2863c9c3988fbf9f6..51baead026f8d76356f37aa765bdcbd92cdf76e7 100755 (executable)
@@ -315,11 +315,20 @@ sub make_docs {
 
 sub make_manifest {
 
-    my $fout      = "tmp/manifest.out";
-    my $result_uu = sys_command("make manifest >$fout 2>$fout");
-    my $status    = "OK";
-    $rstatus->{'MANIFEST'} = $status;
+    my $fout   = "tmp/manifest.out";
+    my $fdiff  = "tmp/manifest.diff";
+    my $result = sys_command("make manifest >$fout 2>$fout");
     post_result($fout);
+    $result = sys_command("diff MANIFEST.bak MANIFEST >$fdiff");
+    if ( !$result ) {
+        query("No changes to MANIFEST; hit <cr>\n");
+    }
+    else {
+        post_result($fdiff);
+        query("MANIFEST has changed, please check; hit <cr>\n");
+    }
+    my $status = "OK";
+    $rstatus->{'MANIFEST'} = $status;
     return;
 } ## end sub make_manifest
 
@@ -697,7 +706,7 @@ sub update_copyright_date {
         $string =~
 s/2000-(\d\d\d\d) by Steve Hancock/2000-$reported_year by Steve Hancock/g;
         if ( $string ne $old_string ) {
-            my $diff_msg = compare_string_buffers( \$old_string, \$string );
+            my $diff_msg = compare_string_buffers( $old_string, $string, 3 );
             print <<EOM;
 ===================================================
 Copyright year needs to be updated in $source_file:
@@ -838,10 +847,24 @@ sub line_diff {
 
 sub compare_string_buffers {
 
-    my ( $rbufi, $rbufo ) = @_;
+    my ( $string_i, $string_o, ($max_diff_count) ) = @_;
 
     # Compare input and output string buffers and return a brief text
     # description of the first difference.
+
+    # Given:
+    #   $string_i = input string, or ref to input string
+    #   $string_o = output string, or ref to output string
+    #   $max_diff_count = optional maximum number of differences to show,
+    #       default=1
+    # Return:
+    #   a string showing differences
+
+    my $rbufi = ref($string_i) ? $string_i : \$string_i;
+    my $rbufo = ref($string_o) ? $string_o : \$string_o;
+
+    if ( !defined($max_diff_count) ) { $max_diff_count = 1 }
+
     my ( @aryi, @aryo );
     my ( $leni, $leno ) = ( 0, 0 );
     if ( defined($rbufi) ) {
@@ -872,7 +895,8 @@ EOM
     my $last_nonblank_count = 0;
 
     # loop over lines until we find a difference
-    my $count = 0;
+    my $count      = 0;
+    my $diff_count = 0;
     while ( @aryi && @aryo ) {
         $count++;
         my $linei = shift @aryi;
@@ -936,9 +960,12 @@ EOM
 >$count:$lineo
 $line_diff
 EOM
-        return $msg;
+        $diff_count++;
+        last if ( $diff_count >= $max_diff_count );
     } ## end while ( @aryi && @aryo )
 
+    if ($diff_count) { return $msg }
+
     #------------------------------------------------------
     # no differences found, see if one file has fewer lines
     #------------------------------------------------------