3 use MLDBM qw(DB_File Storable);
6 $MLDBM::DumpMeth=q(portable);
9 tie %srcbin, 'MLDBM', '/org/bugs.debian.org/versions/indices/srcbin_rebuild.idx',
11 or die "tie srcbin_rebuild.idx: $!";
12 tie %binsrc, 'MLDBM', '/org/bugs.debian.org/versions/indices/binsrc_rebuild.idx',
14 or die "tie binsrc_rebuild.idx: $!";
20 my ($binname, $binver, $binarch, $srcname, $srcver) = split;
21 if (not defined $srcver) {
22 print STDERR "Something is wrong with file: $ARGV line $.: 0x".unpack(q(H*),$_)."\n";
27 if (not exists $temp_srcbin{$srcname}) {
28 $temp_srcbin{$srcname} = $srcbin{$srcname} // {};
30 push_if_not_exists($temp_srcbin{$srcname}{$srcver},[$binname, $binver, $binarch]);
31 if (not exists $temp_binsrc{$binname}) {
32 $temp_binsrc{$binname} = $binsrc{$binname} // {};
34 $temp_binsrc{$binname}{$binver}{$binarch} = [$srcname, $srcver];
36 for my $key (keys %temp_srcbin) {
37 $srcbin{$key} = $temp_srcbin{$key};
39 for my $key (keys %temp_binsrc) {
40 $binsrc{$key} = $temp_binsrc{$key};
43 sub push_if_not_exists{
44 my ($array,@push_bits) = @_;
45 PUSH_CHECK: for my $push_bit (@push_bits) {
47 my @pb = @{$push_bit};
48 ARRAY_CHECK: for my $array_bit (@{$array}) {
49 my @ab = @{$array_bit};
50 next ARRAY_CHECK unless $#ab == $#pb;
52 next ARRAY_CHECK if $ab[$i] ne $pb[$i];
54 # if we get here, then the array has matched; skip to the
55 # next thing to try to push
58 push @{$array},$push_bit;