From c1ff6b37f586999623a5c17e9afbe7244f5e046e Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Sun, 10 Jun 2007 22:26:26 +0000 Subject: - tags 5.2.0 --- Distribconf.pm | 19 ------- Distribconf/Build.pm | 20 ------- MANIFEST | 7 +-- Makefile.PL | 18 +------ Packdrakeng.pm | 19 ------- Packdrakeng/zlib.pm | 19 ------- t/01packdrake.t | 66 ++++++++++++++++++++++++ t/01packdrakeng.t | 143 --------------------------------------------------- t/02packdrake.t | 66 ------------------------ 9 files changed, 69 insertions(+), 308 deletions(-) delete mode 100644 Distribconf.pm delete mode 100644 Distribconf/Build.pm delete mode 100644 Packdrakeng.pm delete mode 100644 Packdrakeng/zlib.pm create mode 100755 t/01packdrake.t delete mode 100755 t/01packdrakeng.t delete mode 100755 t/02packdrake.t diff --git a/Distribconf.pm b/Distribconf.pm deleted file mode 100644 index 1bebf57..0000000 --- a/Distribconf.pm +++ /dev/null @@ -1,19 +0,0 @@ -package Distribconf; - -(our $VERSION) = q$Id$ =~ /(\d+\.\d+)/; - -use MDV::Distribconf; - -*Distribconf:: = *MDV::Distribconf::; -warn "Warning: Distribconf is deprecated, use MDV::Distribconf instead.\n"; -1; - -=head1 NAME - -Distribconf - Compatibility wrapper around MDV::Distribconf - -=head1 DESCRIPTION - -Don't use this module. Use MDV::Distribconf instead. - -=cut diff --git a/Distribconf/Build.pm b/Distribconf/Build.pm deleted file mode 100644 index 6956637..0000000 --- a/Distribconf/Build.pm +++ /dev/null @@ -1,20 +0,0 @@ -package Distribconf::Build; - -use Distribconf; -use MDV::Distribconf::Build; - -our $VERSION = $Distribconf::VERSION; - -*Distribconf::Build:: = *MDV::Distribconf::Build::; -warn "Warning: Distribconf::Build is deprecated, use MDV::Distribconf::Build instead.\n"; -1; - -=head1 NAME - -Distribconf::Build - Compatibility wrapper around MDV::Distribconf::Build - -=head1 DESCRIPTION - -Don't use this module. Use MDV::Distribconf::Build instead. - -=cut diff --git a/MANIFEST b/MANIFEST index 8b6157b..c28d956 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,6 +1,4 @@ ChangeLog -Distribconf/Build.pm -Distribconf.pm dumpdistribconf editdistrib gendistrib @@ -8,11 +6,8 @@ genhdlist Makefile.PL MANIFEST packdrake -Packdrakeng.pm -Packdrakeng/zlib.pm packdrake.pm parsehdlist.c rpm2cpio.pl rpm2header.c -t/01packdrakeng.t -t/02packdrake.t +t/01packdrake.t diff --git a/Makefile.PL b/Makefile.PL index 056e597..be823d4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,17 +3,7 @@ use strict; use ExtUtils::MakeMaker; -my $rpmtools_version = "5.1.0"; - -# to generate the ChangeLog depending on the checkout layout -my $commonusername = "../common/"; --d $commonusername or do { - $commonusername = "../../common/"; - -d $commonusername or do { - $commonusername = "../../../common/"; - -d $commonusername or $commonusername = ""; - }; -}; +my $rpmtools_version = "5.2.0"; sub MY::postamble { < 'buildc', }, PM => { - 'Packdrakeng.pm' => '$(INST_LIBDIR)/Packdrakeng.pm', - 'Packdrakeng/zlib.pm' => '$(INST_LIBDIR)/Packdrakeng/zlib.pm', 'packdrake.pm' => '$(INST_LIBDIR)/packdrake.pm', - 'Distribconf.pm' => '$(INST_LIBDIR)/Distribconf.pm', - 'Distribconf/Build.pm' => '$(INST_LIBDIR)/Distribconf/Build.pm', }, EXE_FILES => [ qw(gendistrib genhdlist packdrake rpm2header parsehdlist rpm2cpio.pl dumpdistribconf) ], C => [], diff --git a/Packdrakeng.pm b/Packdrakeng.pm deleted file mode 100644 index 57b4ca8..0000000 --- a/Packdrakeng.pm +++ /dev/null @@ -1,19 +0,0 @@ -package Packdrakeng; - -(our $VERSION) = q($Id$) =~ /(\d+\.\d+)/; - -use MDV::Packdrakeng; - -*Packdrakeng:: = *MDV::Packdrakeng::; -warn "Warning: Packdrakeng is deprecated, use MDV::Packdrakeng instead.\n"; -1; - -=head1 NAME - -Packdrakeng - Compatibility wrapper around MDV::Packdrakeng - -=head1 DESCRIPTION - -Don't use this module. Use MDV::Packdrakeng instead. - -=cut diff --git a/Packdrakeng/zlib.pm b/Packdrakeng/zlib.pm deleted file mode 100644 index 576652a..0000000 --- a/Packdrakeng/zlib.pm +++ /dev/null @@ -1,19 +0,0 @@ -package Packdrakeng::zlib; - -(our $VERSION) = q($Id$) =~ /(\d+\.\d+)/; - -use MDV::Packdrakeng::zlib; - -*Packdrakeng::zlib:: = *MDV::Packdrakeng::zlib::; -warn "Warning: Packdrakeng::zlib is deprecated, use MDV::Packdrakeng::zlib instead.\n"; -1; - -=head1 NAME - -Packdrakeng::zlib - Compatibility wrapper around MDV::Packdrakeng::zlib - -=head1 DESCRIPTION - -Don't use this module. Use MDV::Packdrakeng::zlib instead. - -=cut diff --git a/t/01packdrake.t b/t/01packdrake.t new file mode 100755 index 0000000..1d0aebf --- /dev/null +++ b/t/01packdrake.t @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +# $Id$ + +use strict; +use Test::More tests => 7; +use Digest::MD5; + +use_ok('packdrake'); + +-d "test" || mkdir "test" or die "Can't create directory test"; + +my $coin = q{ + ___________ +< Coin coin > + ----------- + \ ,~~. + \ __( o ) + `--'==( ___/) + ( ( . / + \ '-' / + ~'`~'`~'`~'`~ +}; + +sub clean_test_files { + -d "test" or return; + system("rm -fr $_") foreach (glob("test/*")); +} + +clean_test_files(); + +mkdir "test/dir" or die "Can't create 'test/dir'"; +open(my $fh, "> test/file") or die "Can't create 'test/file'"; +print $fh $coin; +close $fh; + +symlink("file", "test/link") or die "Can't create symlink 'test/link': $!\n"; + +open($fh, "> test/list") or die "can't open 'test/list': $!\n"; +print($fh join("\n", qw(dir file link)) ."\n"); +close($fh); + +open(my $listh, "< test/list") or die "can't read 'test/list': $!\n"; +ok(packdrake::build_archive( + $listh, + "test", + "packtest.cz", + 400_000, + "gzip -9", + "gzip -d", +), "Creating a packdrake archive"); +close($listh); + +clean_test_files(); + +my $pack = packdrake->new("packtest.cz"); +ok($pack->extract_archive("test", qw(dir file link)), "Extracting files from archive"); + +ok(open($fh, "test/file"), "Opening extract file"); +sysread($fh, my $data, 1_000); +ok($data eq $coin, "data successfully restored"); +ok(-d "test/dir", "dir successfully restored"); +ok(readlink("test/link") eq "file", "symlink successfully restored"); + +clean_test_files(); + diff --git a/t/01packdrakeng.t b/t/01packdrakeng.t deleted file mode 100755 index 52d3c12..0000000 --- a/t/01packdrakeng.t +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/perl - -# $Id$ - -use strict; -use Test::More tests => 41; -use Digest::MD5; - -BEGIN { use_ok('Packdrakeng'); } - --d "test" || mkdir "test" or die "Can't create directory test"; - -my $coin = q{ - ___________ -< Coin coin > - ----------- - \ ,~~. - \ __( o ) - `--'==( ___/) - ( ( . / - \ '-' / - ~'`~'`~'`~'`~ -}; - -sub clean_test_files { - -d "test" or return; - system("rm -fr $_") foreach (glob("test/*")); -} - -sub create_test_files { - my ($number) = @_; - my %created; - foreach my $n (1 .. $number||10) { - my $size = int(rand(1024)); - system("dd if=/dev/urandom of=test/$size bs=1024 count=$size >/dev/null 2>&1"); - open(my $h, "test/$size"); - $created{"test/$size"} = Digest::MD5->new->addfile($h)->hexdigest; - close $h; - } - return %created; -} - -sub check_files { - my %files = @_; - my $ok = 1; - foreach my $f (keys %files) { - open(my $h, $f) or die "Can't read $f: $!"; - Digest::MD5->new->addfile($h)->hexdigest ne $files{$f} and do { - diag "$f differ"; - $ok = 0; - }; - close $h; - } - $ok -} - -# Test series, packing, unpacking - -sub test_packing { - my ($pack_param, $listfiles) = @_; - - ok(my $pack = Packdrakeng->new(%$pack_param), "Creating an archive"); - $pack or return; - ok($pack->add(undef, keys %$listfiles), "packing files"); - $pack = undef; # closing the archive. - - clean_test_files(); - - ok($pack = Packdrakeng->open(%$pack_param), "Re-opening the archive"); - $pack or die; - ok($pack->extract('.', keys(%$listfiles)), "extracting files"); - ok(check_files(%$listfiles), "Checking md5sum for extracted files"); - - $pack = undef; -} - -# Testing simple additional function -clean_test_files(); - -{ - my ($handle, $filename) = Packdrakeng::tempfile(); - ok($handle && $filename, "can create temp file"); - ok(-f $filename, "Temp file exists"); - ok(print($handle $coin), "can write into file"); - close($handle); - unlink($filename); - - ok(Packdrakeng::mkpath('test/parent/child'), "can create dir like mkdir -p"); - ok(-d 'test/parent/child', "the dir really exists"); -} - -# Single test: -{ - clean_test_files(); - - ok(my $pack = Packdrakeng->new(archive => "packtest.cz"), "Create a new archive"); - open(my $fh, "+> test/test") or die "Can't open test file $!"; - syswrite($fh, $coin); - sysseek($fh, 0, 0); - ok($pack->add_virtual('f', "coin", $fh), "Adding data from file"); - close($fh); - unlink("test/test"); - - ok($pack->add_virtual('d', "dir"), "Adding a dir"); - ok($pack->add_virtual('l', "symlink", "dest"), "Adding a symlink"); - $pack = undef; - - ok($pack = Packdrakeng->open(archive => "packtest.cz"), "Opening the archive"); - my ($type, $info); - ($type, $info) = $pack->infofile("noexist"); - ok(!defined($type), "get info from an non existed file"); - ($type, $info) = $pack->infofile("dir"); - ok($type eq 'd', "Get info from a dir"); - ($type, $info) = $pack->infofile("symlink"); - ok($type eq 'l' && $info eq 'dest', "Get info from a dir"); - ($type, $info) = $pack->infofile("coin"); - ok($type eq 'f' && $info eq length($coin), "Get info from a file"); - ok($pack->extract("test", "dir"), "Extracting dir"); - ok(-d "test/dir", "dir successfully restored"); - ok($pack->extract("test", "symlink"), "Extracting symlink"); - ok(readlink("test/symlink") eq "dest", "symlink successfully restored"); - - open($fh, "+> test/test") or die "Can't open file $!"; - ok($pack->extract_virtual($fh, "coin"), "Extracting data"); - sysseek($fh, 0, 0); - sysread($fh, my $data, 1000); - close($fh); - ok($data eq $coin, "Data is correct"); -} - -clean_test_files(); - -test_packing({ archive => "packtest-cat.cz", compress => 'cat', uncompress => 'cat', noargs => 1 }, { create_test_files(30) }); -clean_test_files(); - -test_packing({ archive => "packtest-gzipi.cz" }, { create_test_files(30) }); -clean_test_files(); - -test_packing({ archive => "packtest-gzip.cz", compress => "gzip", extern => 1}, { create_test_files(30) }); -clean_test_files(); - -test_packing({ archive => "packtest-bzip2.cz", compress => "bzip2", extern => 1}, { create_test_files(30) }); -clean_test_files(); diff --git a/t/02packdrake.t b/t/02packdrake.t deleted file mode 100755 index 1d0aebf..0000000 --- a/t/02packdrake.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/perl - -# $Id$ - -use strict; -use Test::More tests => 7; -use Digest::MD5; - -use_ok('packdrake'); - --d "test" || mkdir "test" or die "Can't create directory test"; - -my $coin = q{ - ___________ -< Coin coin > - ----------- - \ ,~~. - \ __( o ) - `--'==( ___/) - ( ( . / - \ '-' / - ~'`~'`~'`~'`~ -}; - -sub clean_test_files { - -d "test" or return; - system("rm -fr $_") foreach (glob("test/*")); -} - -clean_test_files(); - -mkdir "test/dir" or die "Can't create 'test/dir'"; -open(my $fh, "> test/file") or die "Can't create 'test/file'"; -print $fh $coin; -close $fh; - -symlink("file", "test/link") or die "Can't create symlink 'test/link': $!\n"; - -open($fh, "> test/list") or die "can't open 'test/list': $!\n"; -print($fh join("\n", qw(dir file link)) ."\n"); -close($fh); - -open(my $listh, "< test/list") or die "can't read 'test/list': $!\n"; -ok(packdrake::build_archive( - $listh, - "test", - "packtest.cz", - 400_000, - "gzip -9", - "gzip -d", -), "Creating a packdrake archive"); -close($listh); - -clean_test_files(); - -my $pack = packdrake->new("packtest.cz"); -ok($pack->extract_archive("test", qw(dir file link)), "Extracting files from archive"); - -ok(open($fh, "test/file"), "Opening extract file"); -sysread($fh, my $data, 1_000); -ok($data eq $coin, "data successfully restored"); -ok(-d "test/dir", "dir successfully restored"); -ok(readlink("test/link") eq "file", "symlink successfully restored"); - -clean_test_files(); - -- cgit v1.2.1