Skip to content

Commit

Permalink
using Packages.gz, .bz2 is not in every distribution (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
jozef committed Dec 16, 2015
1 parent 7c90ee0 commit 9e48b90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ my $builder = Module::Build::SysPath->new(
requires => {
'Moose' => 0,
'IO::Uncompress::Bunzip2' => 0,
'IO::Uncompress::Gunzip' => 0,
'IO::Any' => 0.05,
'Parse::Deb::Control' => 0.04, # get_paras()
'Dpkg::Version' => 0,
Expand Down
9 changes: 5 additions & 4 deletions script/dpkg-scanpmpackages
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use Parse::Deb::Control 0.03;
use List::MoreUtils 'any', 'firstval';
#use IO::Compress::Bzip2 qw();
use IO::Uncompress::Bunzip2 qw($Bunzip2Error);
use IO::Uncompress::Gunzip qw($GunzipError);
use File::is;

use Carp 'croak';
Expand Down Expand Up @@ -172,22 +173,22 @@ sub parse_packages {
my @packages_files =
File::Find::Rule
->file()
->name( 'Packages.bz2' )
->name( 'Packages.gz' )
->in( $mirror_location )
;

foreach my $packages_file (@packages_files) {

my $perlpackages_filename = $packages_file;
$perlpackages_filename =~ s/(Packages).bz2/Perl$1/;
$perlpackages_filename =~ s/Packages.gz/PerlPackages/;

if ((-f $perlpackages_filename.'.bz2') and File::is->newer($perlpackages_filename.'.bz2', $packages_file)) {
print 'skipping ', $packages_file, ' no changes', "\n";
next;
}

print 'processing from ', $packages_file, "\n";
my $packages_fh = IO::Uncompress::Bunzip2->new($packages_file);
my $packages_fh = IO::Uncompress::Gunzip->new($packages_file);

#my $perlpackages_fh = IO::Compress::Bzip2->new($perlpackages_filename.'.tmp')
# or die $perlpackages_filename.' - '.$!;
Expand Down Expand Up @@ -465,7 +466,7 @@ dpkg-scanpmpackages - creates PerlPackages index from .deb files
=head1 DESCRIPTION
Finds all F<Packages.bz2> and for all F<*.deb> files listed there indexes
Finds all F<Packages.gz> and for all F<*.deb> files listed there indexes
the Perl modules files F<*.pm> creating F<PerlPackages.bz2> file in the same
folder.
Expand Down

0 comments on commit 9e48b90

Please sign in to comment.