diff options
author | Norbert Preining <preining@logic.at> | 2010-03-01 01:54:19 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2010-03-01 01:54:19 +0000 |
commit | 904fd0757fe037dbfbf156b31f72e5ff5c7cd796 (patch) | |
tree | 36f000ab754854574aad17c01d9cd9ac739f1053 /Master/tlpkg/tlperl.straw/bin/ptardiff | |
parent | 402bd194f686177d2dfca24f7c4766434c514141 (diff) |
commit more files of the tlperl.straw dir, still not complete
git-svn-id: svn://tug.org/texlive/trunk@17244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl.straw/bin/ptardiff')
-rwxr-xr-x | Master/tlpkg/tlperl.straw/bin/ptardiff | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl.straw/bin/ptardiff b/Master/tlpkg/tlperl.straw/bin/ptardiff new file mode 100755 index 00000000000..21e7d6cce59 --- /dev/null +++ b/Master/tlpkg/tlperl.straw/bin/ptardiff @@ -0,0 +1,112 @@ +#!/usr/bin/perl + +use strict; +use Archive::Tar; +use Getopt::Std; + +my $opts = {}; +getopts('h:', $opts) or die usage(); + +die usages() if $opts->{h}; + +### need Text::Diff -- give a polite error (not a standard prereq) +unless ( eval { require Text::Diff; Text::Diff->import; 1 } ) { + die "\n\t This tool requires the 'Text::Diff' module to be installed\n"; +} + +my $arch = shift or die usage(); +my $tar = Archive::Tar->new( $arch ) or die "Couldn't read '$arch': $!"; + + +foreach my $file ( $tar->get_files ) { + next unless $file->is_file; + my $name = $file->name; + + diff( \($file->get_content), $name, + { FILENAME_A => $name, + MTIME_A => $file->mtime, + OUTPUT => \*STDOUT + } + ); +} + + + + +sub usage { + return q[ + +Usage: ptardiff ARCHIVE_FILE + ptardiff -h + + ptardiff is a small program that diffs an extracted archive + against an unextracted one, using the perl module Archive::Tar. + + This effectively lets you view changes made to an archives contents. + + Provide the progam with an ARCHIVE_FILE and it will look up all + the files with in the archive, scan the current working directory + for a file with the name and diff it against the contents of the + archive. + + +Options: + h Prints this help message + + +Sample Usage: + + $ tar -xzf Acme-Buffy-1.3.tar.gz + $ vi Acme-Buffy-1.3/README + + [...] + + $ ptardiff Acme-Buffy-1.3.tar.gz > README.patch + + +See Also: + tar(1) + ptar + Archive::Tar + + ] . $/; +} + + + +=head1 NAME + +ptardiff - program that diffs an extracted archive against an unextracted one + +=head1 DESCRIPTION + + ptardiff is a small program that diffs an extracted archive + against an unextracted one, using the perl module Archive::Tar. + + This effectively lets you view changes made to an archives contents. + + Provide the progam with an ARCHIVE_FILE and it will look up all + the files with in the archive, scan the current working directory + for a file with the name and diff it against the contents of the + archive. + +=head1 SYNOPSIS + + ptardiff ARCHIVE_FILE + ptardiff -h + + $ tar -xzf Acme-Buffy-1.3.tar.gz + $ vi Acme-Buffy-1.3/README + [...] + $ ptardiff Acme-Buffy-1.3.tar.gz > README.patch + + +=head1 OPTIONS + + h Prints this help message + +=head1 SEE ALSO + +tar(1), L<Archive::Tar>. + +=cut |