diff options
-rwxr-xr-x | Master/tlpkg/bin/cmp-textfiles | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Master/tlpkg/bin/cmp-textfiles b/Master/tlpkg/bin/cmp-textfiles index 88897294f4a..d0b3e30a152 100755 --- a/Master/tlpkg/bin/cmp-textfiles +++ b/Master/tlpkg/bin/cmp-textfiles @@ -1,13 +1,14 @@ #!/usr/bin/env perl # $Id$ # Public domain. Originally written 2008, Karl Berry. -# Compare two files considering CR, LF, and CRLF as equivalent. +# Compare two files considering CR, LF, and CRLF as equivalent. , +# and ignoring %% lines (see below). +# # Used in place and tlpkg-ctan-check in TeX Live. exit (&main ()); -sub main -{ +sub main { if (@ARGV != 2) { warn <<END_USAGE; Usage: $0 FILE1 FILE2. @@ -27,8 +28,13 @@ END_USAGE # Return contents of FNAME as a string, converting all of CR, LF, and # CRLF to just LF. # -sub read_file -{ +# Also, annoyingly, ignore lines consisting only of "%%". For an +# unknown reason, derived files on CTAN often contain these lines, while +# the same files regenerated by us do not. CTAN's general policy is not +# to hold derived files, but there are too many exceptions and it is not +# worth the time to continually contact CTAN and authors. +# +sub read_file { my ($fname) = @_; my $ret = ""; @@ -36,6 +42,7 @@ sub read_file open (FILE, $fname) || die "open($fname) failed: $!"; while (<FILE>) { s/\r\n?/\n/g; + next if /^\s*%%\s*$/; # ignore %% lines, see above. #warn "line is |$_|"; $ret .= $_; } |