summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Dpkg/Compression/FileHandle.pm (renamed from scripts/Dpkg/Compression/CompressedFile.pm)42
-rw-r--r--scripts/Dpkg/Compression/Process.pm (renamed from scripts/Dpkg/Compression/Compressor.pm)6
-rw-r--r--scripts/Dpkg/Index.pm6
-rw-r--r--scripts/Dpkg/Source/Archive.pm2
-rw-r--r--scripts/Dpkg/Source/Patch.pm4
-rw-r--r--scripts/Makefile.am4
-rwxr-xr-xscripts/dpkg-scanpackages.pl6
-rwxr-xr-xscripts/dpkg-scansources.pl8
-rw-r--r--scripts/po/POTFILES.in4
-rw-r--r--scripts/t/850_Dpkg_Compression.t10
10 files changed, 45 insertions, 47 deletions
diff --git a/scripts/Dpkg/Compression/CompressedFile.pm b/scripts/Dpkg/Compression/FileHandle.pm
index ffa471eb9..fcf500552 100644
--- a/scripts/Dpkg/Compression/CompressedFile.pm
+++ b/scripts/Dpkg/Compression/FileHandle.pm
@@ -13,13 +13,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Compression::CompressedFile;
+package Dpkg::Compression::FileHandle;
use strict;
use warnings;
use Dpkg::Compression;
-use Dpkg::Compression::Compressor;
+use Dpkg::Compression::Process;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use POSIX qw(WIFSIGNALED WTERMSIG SIGPIPE);
@@ -32,43 +32,43 @@ use base qw(FileHandle Tie::Handle);
=head1 NAME
-Dpkg::Compression::CompressedFile - object dealing transparently with file compression
+Dpkg::Compression::FileHandle - object dealing transparently with file compression
=head1 SYNOPSIS
- use Dpkg::Compression::CompressedFile;
+ use Dpkg::Compression::FileHandle;
- $fh = Dpkg::Compression::CompressedFile->new(filename=>"sample.gz");
+ $fh = Dpkg::Compression::FileHandle->new(filename=>"sample.gz");
print $fh "Something\n";
close $fh;
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
open($fh, ">", "sample.bz2");
print $fh "Something\n";
close $fh;
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
$fh->open("sample.xz", "w");
$fh->print("Something\n");
$fh->close();
- $fh = Dpkg::Compression::CompressedFile->new(filename=>"sample.gz");
+ $fh = Dpkg::Compression::FileHandle->new(filename=>"sample.gz");
my @lines = <$fh>;
close $fh;
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
open($fh, "<", "sample.bz2");
my @lines = <$fh>;
close $fh;
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
$fh->open("sample.xz", "r");
my @lines = $fh->getlines();
$fh->close();
=head1 DESCRIPTION
-Dpkg::Compression::CompressedFile is an object that can be used
+Dpkg::Compression::FileHandle is an object that can be used
like any filehandle and that deals transparently with compressed
files. By default, the compression scheme is guessed from the filename
but you can override this behaviour with the method C<set_compression>.
@@ -83,7 +83,7 @@ able to open another file.
=head1 STANDARD FUNCTIONS
The standard functions acting on filehandles should accept a
-Dpkg::Compression::CompressedFile object transparently including
+Dpkg::Compression::FileHandle object transparently including
C<open> (only when using the variant with 3 parameters), C<close>,
C<binmode>, C<eof>, C<fileno>, C<getc>, C<print>, C<printf>, C<read>,
C<sysread>, C<say>, C<write>, C<syswrite>, C<seek>, C<sysseek>, C<tell>.
@@ -95,14 +95,14 @@ and you can't seek on a pipe.
=head1 FileHandle METHODS
The object inherits from FileHandle so all methods that work on this
-object should work for Dpkg::Compression::CompressedFile too. There
+object should work for Dpkg::Compression::FileHandle too. There
may be exceptions though.
=head1 PUBLIC METHODS
=over 4
-=item my $fh = Dpkg::Compression::CompressedFile->new(%opts)
+=item my $fh = Dpkg::Compression::FileHandle->new(%opts)
Creates a new filehandle supporting on-the-fly compression/decompression.
Supported options are "filename", "compression", "compression_level" (see
@@ -124,7 +124,7 @@ sub new {
bless $self, $class;
# Initializations
*$self->{"compression"} = "auto";
- *$self->{"compressor"} = Dpkg::Compression::Compressor->new();
+ *$self->{"compressor"} = Dpkg::Compression::Process->new();
*$self->{"add_comp_ext"} = $args{"add_compression_extension"} ||
$args{"add_comp_ext"} || 0;
*$self->{"allow_sigpipe"} = 0;
@@ -201,10 +201,10 @@ sub OPEN {
} elsif ($mode eq "<") {
$self->open_for_read();
} else {
- internerr("Unsupported open mode on Dpkg::Compression::CompressedFile: $mode");
+ internerr("Unsupported open mode on Dpkg::Compression::FileHandle: $mode");
}
} else {
- internerr("Dpkg::Compression::CompressedFile only supports open() with 3 parameters");
+ internerr("Dpkg::Compression::FileHandle only supports open() with 3 parameters");
}
return 1; # Always works (otherwise errors out)
}
@@ -249,7 +249,7 @@ sub BINMODE {
=item $fh->set_compression($comp)
Defines the compression method used. $comp should one of the methods supported by
-Dpkg::Compression or "none" or "auto". "none" indicates that the file is
+B<Dpkg::Compression> or "none" or "auto". "none" indicates that the file is
uncompressed and "auto" indicates that the method must be guessed based
on the filename extension used.
@@ -265,8 +265,8 @@ sub set_compression {
=item $fh->set_compression_level($level)
-Indicate the desired compression level. It should a value supported by
-the B<set_compression_level> method of B<Dpkg::Compression::Compressor>.
+Indicate the desired compression level. It should be a value accepted
+by the function C<compression_is_valid_level> of B<Dpkg::Compression>.
=cut
@@ -410,7 +410,7 @@ sub cleanup {
=head1 DERIVED OBJECTS
If you want to create an object that inherits from
-Dpkg::Compression::CompressedFile you must be aware that
+Dpkg::Compression::FileHandle you must be aware that
the object is a reference to a GLOB that is returned by Symbol::gensym()
and as such it's not a HASH.
diff --git a/scripts/Dpkg/Compression/Compressor.pm b/scripts/Dpkg/Compression/Process.pm
index cec3577cf..7eb5653c7 100644
--- a/scripts/Dpkg/Compression/Compressor.pm
+++ b/scripts/Dpkg/Compression/Process.pm
@@ -1,4 +1,4 @@
-# Copyright © 2008 Raphaël Hertzog <hertzog@debian.org>
+# Copyright © 2008-2010 Raphaël Hertzog <hertzog@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Compression::Compressor;
+package Dpkg::Compression::Process;
use strict;
use warnings;
@@ -69,7 +69,7 @@ sub get_uncompress_cmdline {
sub _sanity_check {
my ($self, %opts) = @_;
# Check for proper cleaning before new start
- error(_g("Dpkg::Compression::Compressor can only start one subprocess at a time"))
+ error(_g("Dpkg::Compression::Process can only start one subprocess at a time"))
if $self->{"pid"};
# Check options
my $to = my $from = 0;
diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm
index 7d8b47bc4..0a426f3b9 100644
--- a/scripts/Dpkg/Index.pm
+++ b/scripts/Dpkg/Index.pm
@@ -21,7 +21,7 @@ use warnings;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Control;
-use Dpkg::Compression::CompressedFile;
+use Dpkg::Compression::FileHandle;
use overload
'@{}' => sub { return $_[0]->{'order'} },
@@ -155,7 +155,7 @@ parsed. Handles compressed files transparently based on their extensions.
sub load {
my ($self, $file) = @_;
- my $cf = Dpkg::Compression::CompressedFile->new(filename => $file);
+ my $cf = Dpkg::Compression::FileHandle->new(filename => $file);
my $res = $self->parse($cf, $file);
close($cf) || syserr(_g("cannot close %s"), $file);
return $res;
@@ -189,7 +189,7 @@ based on their extensions.
sub save {
my ($self, $file) = @_;
- my $cf = Dpkg::Compression::CompressedFile->new(filename => $file);
+ my $cf = Dpkg::Compression::FileHandle->new(filename => $file);
$self->output($cf);
close($cf) || syserr(_g("cannot close %s"), $file);
}
diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm
index 202071873..6739c4bc5 100644
--- a/scripts/Dpkg/Source/Archive.pm
+++ b/scripts/Dpkg/Source/Archive.pm
@@ -29,7 +29,7 @@ use File::Basename qw(basename);
use File::Spec;
use Cwd;
-use base 'Dpkg::Compression::CompressedFile';
+use base 'Dpkg::Compression::FileHandle';
sub create {
my ($self, %opts) = @_;
diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm
index b7ba69dfd..13561ec88 100644
--- a/scripts/Dpkg/Source/Patch.pm
+++ b/scripts/Dpkg/Source/Patch.pm
@@ -19,8 +19,6 @@ use strict;
use warnings;
use Dpkg;
-use Dpkg::Compression::Compressor;
-use Dpkg::Compression;
use Dpkg::Gettext;
use Dpkg::IPC;
use Dpkg::ErrorHandling;
@@ -35,7 +33,7 @@ use Fcntl ':mode';
#XXX: Needed for sub-second timestamps, require recent perl
#use Time::HiRes qw(stat);
-use base 'Dpkg::Compression::CompressedFile';
+use base 'Dpkg::Compression::FileHandle';
sub create {
my ($self, %opts) = @_;
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 6851524c5..290b2f7dc 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -61,8 +61,8 @@ nobase_dist_perllib_DATA = \
Dpkg/Changelog/Parse.pm \
Dpkg/Checksums.pm \
Dpkg/Compression.pm \
- Dpkg/Compression/CompressedFile.pm \
- Dpkg/Compression/Compressor.pm \
+ Dpkg/Compression/FileHandle.pm \
+ Dpkg/Compression/Process.pm \
Dpkg/Conf.pm \
Dpkg/Control.pm \
Dpkg/Control/Changelog.pm \
diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl
index 9ab2b978b..e369cec99 100755
--- a/scripts/dpkg-scanpackages.pl
+++ b/scripts/dpkg-scanpackages.pl
@@ -28,7 +28,7 @@ use Dpkg::ErrorHandling;
use Dpkg::Control;
use Dpkg::Version;
use Dpkg::Checksums;
-use Dpkg::Compression::CompressedFile;
+use Dpkg::Compression::FileHandle;
use Dpkg::IPC;
textdomain("dpkg-dev");
@@ -87,7 +87,7 @@ sub set_type_udeb()
sub load_override
{
my $override = shift;
- my $comp_file = Dpkg::Compression::CompressedFile->new(filename => $override);
+ my $comp_file = Dpkg::Compression::FileHandle->new(filename => $override);
while (<$comp_file>) {
s/\#.*//;
@@ -133,7 +133,7 @@ sub load_override
sub load_override_extra
{
my $extra_override = shift;
- my $comp_file = Dpkg::Compression::CompressedFile->new(filename => $extra_override);
+ my $comp_file = Dpkg::Compression::FileHandle->new(filename => $extra_override);
while (<$comp_file>) {
s/\#.*//;
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index d922eef5d..8339233e4 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -27,7 +27,7 @@ use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Control;
use Dpkg::Checksums;
-use Dpkg::Compression::CompressedFile;
+use Dpkg::Compression::FileHandle;
use Dpkg::Compression;
textdomain("dpkg-dev");
@@ -110,7 +110,7 @@ sub load_override {
my $file = shift;
local $_;
- my $comp_file = Dpkg::Compression::CompressedFile->new(filename => $file);
+ my $comp_file = Dpkg::Compression::FileHandle->new(filename => $file);
while (<$comp_file>) {
s/#.*//;
next if /^\s*$/;
@@ -175,7 +175,7 @@ sub load_src_override {
}
debug "source override file $file";
- my $comp_file = Dpkg::Compression::CompressedFile->new(filename => $file);
+ my $comp_file = Dpkg::Compression::FileHandle->new(filename => $file);
while (<$comp_file>) {
s/#.*//;
next if /^\s*$/;
@@ -204,7 +204,7 @@ sub load_src_override {
sub load_override_extra
{
my $extra_override = shift;
- my $comp_file = Dpkg::Compression::CompressedFile->new(filename => $extra_override);
+ my $comp_file = Dpkg::Compression::FileHandle->new(filename => $extra_override);
while (<$comp_file>) {
s/\#.*//;
diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in
index 889cd1509..ff4dc8728 100644
--- a/scripts/po/POTFILES.in
+++ b/scripts/po/POTFILES.in
@@ -16,8 +16,8 @@ scripts/dpkg-source.pl
scripts/changelog/debian.pl
scripts/Dpkg/Arch.pm
scripts/Dpkg/Compression.pm
-scripts/Dpkg/Compression/CompressedFile.pm
-scripts/Dpkg/Compression/Compressor.pm
+scripts/Dpkg/Compression/FileHandle.pm
+scripts/Dpkg/Compression/Process.pm
scripts/Dpkg/Changelog.pm
scripts/Dpkg/Changelog/Debian.pm
scripts/Dpkg/Changelog/Entry.pm
diff --git a/scripts/t/850_Dpkg_Compression.t b/scripts/t/850_Dpkg_Compression.t
index d23465b64..800a363e7 100644
--- a/scripts/t/850_Dpkg_Compression.t
+++ b/scripts/t/850_Dpkg_Compression.t
@@ -18,7 +18,7 @@ use Test::More tests => 9;
use strict;
use warnings;
-use_ok('Dpkg::Compression::CompressedFile');
+use_ok('Dpkg::Compression::FileHandle');
my $tmpdir = "t.tmp/850_Dpkg_Compression";
mkdir $tmpdir;
@@ -28,7 +28,7 @@ my $fh;
sub test_write {
my ($filename, $check_result) = @_;
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
open $fh, ">", $filename or die "open failed";
print $fh $lines[0];
syswrite($fh, $lines[1]);
@@ -39,7 +39,7 @@ sub test_write {
unlink $filename or die "cannot unlink $filename";
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
$fh->open($filename, "w");
$fh->print($lines[0]);
$fh->write($lines[1], length($lines[1]));
@@ -68,7 +68,7 @@ sub check_compressed {
sub test_read {
my ($filename) = @_;
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
open($fh, "<", $filename) or die "open failed";
my @read = <$fh>;
close $fh or die "close failed";
@@ -76,7 +76,7 @@ sub test_read {
is_deeply(\@lines, \@read, "$filename correctly read (std functions)");
@read = ();
- $fh = Dpkg::Compression::CompressedFile->new();
+ $fh = Dpkg::Compression::FileHandle->new();
$fh->open($filename, "r") or die "open failed";
@read = $fh->getlines();
$fh->close() or die "close failed";