Browse Source

Non-existent files where causing this to fail, and the db, there was

also a die, now there is a check to avoid this.
master
freesource 20 years ago
parent
commit
f8f6630c0f
  1. 76
      bin/fastswim

76
bin/fastswim

@ -52,9 +52,10 @@ my %version;
#$#name = 2000;
#$#ppackage = 2000;
# This way has been de-pre-c-whatever-ated because it lacks version
# rememberance, and is just kept for testing purposes
if ($#ARGV == -1) {
# This way has been de-pre-c-whatever-ated because it lacks version
# rememberance, and is just kept for testing purposes
if ($#ARGV == -1) {
print STDERR "swim: fastswim requires option/arguments, see program for instructions\n";
exit;
chdir("$ARGV[1]");
@ -78,27 +79,31 @@ my %version;
}
# Make a nice md. I decided on a Hash of Lists, giving all
# files/dirs unique name, and then a list of packages which
# correspond..because this should be faster than a Hash of Hash
# where you'd have to loop through all packages names..find the
# files/dir in all packages names which are the same..I'd assume a HL
# would be a quicker query, even though the Hash would be enormous.
# Possible things: a tree for faster query.
# Put everything into an array..every other is package name
# Better check for packages which don't have /. in their *.list...
# which is rare, but does happen. Sometimes *.list(s) don't have
# all the parent directories, but we won't worry about that.
print STDERR " Making the massive hash\n";
$| = 1; my $x = 1;
foreach $thingy (sort @ppackage) {
open(LIST, "$ARGV[1]/$thingy") or die "Humm, strange";
# Make a nice md. I decided on a Hash of Lists, giving all
# files/dirs unique name, and then a list of packages which
# correspond..because this should be faster than a Hash of Hash
# where you'd have to loop through all packages names..find the
# files/dir in all packages names which are the same..I'd assume a HL
# would be a quicker query, even though the Hash would be enormous.
# Possible things: a tree for faster query.
# Put everything into an array..every other is package name
# Better check for packages which don't have /. in their *.list...
# which is rare, but does happen. Sometimes *.list(s) don't have
# all the parent directories, but we won't worry about that.
print STDERR " Making the massive hash\n";
$| = 1; my $x = 1;
foreach $thingy (sort @ppackage) {
if (-e "$ARGV[1]/$thingy") {
open(LIST, "$ARGV[1]/$thingy");
# Because of the version..there are sometimes dots
$thingy =~ m,(.*)\.list,;
my $count = 0;
my @count = <LIST>;
close(LIST);
foreach (@count) {
$x = 1 if $x == 6;
print STDERR "|\r" if $x == 1 || $x == 4; print STDERR "/\r" if $x == 2;
@ -142,16 +147,17 @@ my %version;
}
}
}
undef @ppackage;
# We will create one file with the 1..and another with >1..
# than split..reverse..and order.accordingly..this makes
# things much faster. Remember clean-up routines for kill.
print STDERR " Starting ... writing to $ARGV[2]!\n";
# Create the database
open(BIG, ">$ARGV[2]/big.debian") or die;
open(LONG, ">$ARGV[2]/long.debian") or die;
foreach $thingy (sort keys %HL ) {
}
undef @ppackage;
# We will create one file with the 1..and another with >1..
# than split..reverse..and order.accordingly..this makes
# things much faster. Remember clean-up routines for kill.
print STDERR " Starting ... writing to $ARGV[2]!\n";
# Create the database
open(BIG, ">$ARGV[2]/big.debian") or die "Couldn't find big.debian\n";
open(LONG, ">$ARGV[2]/long.debian") or die "Couldn't find long.debian\n";
foreach $thingy (sort keys %HL ) {
$x = 1 if $x == 6;
print STDERR "|\r" if $x == 1 || $x == 4; print STDERR "/\r" if $x == 2;
print STDERR "-\r" if $x == 3 || $x == 6; print STDERR "\\\r" if $x == 5;
@ -165,11 +171,11 @@ my %version;
elsif (@{ $HL{$thingy} } == 1) {
print BIG "$thingy -> $tingy\n";
}
}
#print "Finished\n";
close(BIG);
close(LONG);
#undef %HL;
print STDERR " Cleaning up\n";
}
#print "Finished\n";
close(BIG);
close(LONG);
#undef %HL;
print STDERR " Cleaning up\n";
__END__

Loading…
Cancel
Save