Umsetzung von GenPkgList in Perl - hoffentlich damit etwas schneller
git-svn-id: svn://svn.compuextreme.de/Viitor/V962/ViitorInstall@5871 504e572c-2e33-0410-9681-be2bf7408885
This commit is contained in:
parent
e7dc4cae83
commit
d6a57727fa
68
GenPkgList.pl
Executable file
68
GenPkgList.pl
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
use File::Basename;
|
||||
use File::Path;
|
||||
use Cwd;
|
||||
use Sys::Syslog;
|
||||
|
||||
#my $ShortName=&GetShortName($ARGV[0]);
|
||||
my $DirPath=$ARGV[0];
|
||||
|
||||
if ( -d $DirPath ) {
|
||||
open(FIND,"find $DirPath -name \"\*.vpg\"|");
|
||||
my @FileList=<FIND>;
|
||||
#print "@FileList";
|
||||
foreach(@FileList) {
|
||||
#print "$_\n";
|
||||
my $ShortName=&GetShortName($_);
|
||||
my $PkgName=basename($_);
|
||||
my $FilePath=dirname($_);
|
||||
chomp($PkgName);
|
||||
(my $PkgPath = $FilePath) =~ s/$DirPath//;
|
||||
chomp($PkgPath);
|
||||
print "SN=$ShortName;PF=$PkgName;PP=$PkgPath\n";
|
||||
}
|
||||
} else {
|
||||
print "Usage: GenPkgList <Path to BINARY Distribution Files>";
|
||||
}
|
||||
|
||||
sub GetShortName() {
|
||||
my $PkgName = $_[0];
|
||||
my @StartFile;
|
||||
my $MetaInfo;
|
||||
my @Contents;
|
||||
my @MetaInfo;
|
||||
|
||||
open PACKAGE,$PkgName or die "Could ot open ViitorArchive: $! $PkgName\n";
|
||||
my $FileSizes = <PACKAGE>;
|
||||
my @FileSizes = split /\s/,$FileSizes;
|
||||
unshift(@FileSizes,0);
|
||||
$FileSizes[0]=tell(PACKAGE);
|
||||
for ( my $j = 0; $j <= 12; $j++ ) {
|
||||
for ( my $i=0; $i<=$j; $i++) {
|
||||
$StartFile[$j]+=$FileSizes[$i];
|
||||
}
|
||||
}
|
||||
shift @FileSizes;
|
||||
seek PACKAGE,$StartFile[1],0;
|
||||
if ( $FileSizes[1] > 0 ) {
|
||||
read PACKAGE,$MetaInfo,$FileSizes[1];
|
||||
@MetaInfo=&DeBzip2($MetaInfo);
|
||||
}
|
||||
(my $ShortName = $MetaInfo[0] ) =~ s/ModuleName: //;
|
||||
chomp($ShortName);
|
||||
return $ShortName;
|
||||
}
|
||||
|
||||
sub DeBzip2() {
|
||||
open (UNCOMPRESS,"|bzip2 -d -c >/tmp/PkgList_bzip2_$$") or die "Can not start decompress: $!";
|
||||
print UNCOMPRESS @_;
|
||||
close UNCOMPRESS;
|
||||
open(DATA,"/tmp/PkgList_bzip2_$$") or die "Data File after decompression not found: $!";
|
||||
my @UnBzip2Data = <DATA>;
|
||||
close DATA;
|
||||
unlink("/tmp/PkgList_bzip2_$$");
|
||||
return @UnBzip2Data;
|
||||
}
|
Loading…
Reference in New Issue
Block a user