]> git.deb.at Git - deb/packages.git/commitdiff
Clean-up behind Jeroen :)
authorFrank Lichtenheld <frank@lichtenheld.de>
Thu, 23 Feb 2006 05:38:25 +0000 (05:38 +0000)
committerFrank Lichtenheld <frank@lichtenheld.de>
Thu, 23 Feb 2006 05:38:25 +0000 (05:38 +0000)
Also begin working on newpkg support
create_index_pages doesn't work again yet, but I really need some sleep
right now ;)

bin/create_index_pages
bin/newpkg_info [new file with mode: 0755]
bin/parse-packages
bin/parse-sources
cgi-bin/dispatcher.pl
cron.d/600prepare_newpkg [new file with mode: 0755]
lib/Packages/HTML.pm
lib/Packages/Page.pm
lib/Packages/Search.pm

index 8b20ebd7fcf010be4e0306ea4b18d328a990c965..1cce8f17921222ff1a8842fcc4b58bf8addbd4e7 100755 (executable)
@@ -46,125 +46,113 @@ my (%pages);
 
 print "write suite index files ...\n";
 foreach my $s (@SUITES) {
-    foreach my $a (@ARCHIVES) {
-       next if $a eq 'security';
-       next if $a eq 'non-US';
-       my $key = ($a eq 'us') ? $s : "$s/$a";
-       my $root = ($a eq 'us') ? '' : '../';
-       mkpath ( "$wwwdir/$key" );
-       foreach my $lang (@LANGUAGES) {
-           my $locale = get_locale( $lang );
-           setlocale ( LC_ALL, $locale ) or do {
-               warn "couldn't set locale ($lang/$locale)\n";
-               next;
-           };
-           open $pages{$key}{$lang}{index}{fh}, '>', "$wwwdir/$key/index.$lang.html.new"
-               or die "can't open index file for output: $!";
-           my $index_title = sprintf( _g( "List of sections in \"%s\"" ),
-                                      $key );
-           print {$pages{$key}{$lang}{index}{fh}} header( title => $index_title,
-                                                          title_keywords => "debian, $s",
-                                                          desc => encode_entities( $index_title, '"' ),
-                                                          lang => $lang ),
-           title( $index_title ), '<div id="lefthalfcol"><dl>';
-           my $i = 0; my $num_sections = keys %{$subsections->{$s}{$a}};
-           foreach my $ssec ((keys %{$subsections->{$s}{$a}}, 'virtual')) {
-               next if $ssec eq '-';
-               if ($sections_descs{$ssec}) {
-                   print {$pages{$key}{$lang}{index}{fh}} "<dt><a href=\"$ssec/\">".dgettext( 'sections', $sections_descs{$ssec}[0] )."</a></dt><dd>".dgettext( 'sections', $sections_descs{$ssec}[1] )."</dd>\n";
-                   $i++;
-                   if ($i eq ceil($num_sections/2)) {
-                       print {$pages{$key}{$lang}{index}{fh}} "</dl>\n</div> <!-- end lefthalfcol -->\n<div id=\"righthalfcol\">\n<dl>\n";
-                   }
+    my $key = $s;
+    mkpath ( "$wwwdir/$key" );
+    foreach my $lang (@LANGUAGES) {
+       my $locale = get_locale( $lang );
+       setlocale ( LC_ALL, $locale ) or do {
+           warn "couldn't set locale ($lang/$locale)\n";
+           next;
+       };
+       open $pages{$key}{$lang}{index}{fh}, '>', "$wwwdir/$key/index.$lang.html.new"
+           or die "can't open index file for output: $!";
+       my $index_title = sprintf( _g( "List of sections in \"%s\"" ),
+                                  $key );
+       print {$pages{$key}{$lang}{index}{fh}} header( title => $index_title,
+                                                      title_keywords => "debian, $s",
+                                                      desc => encode_entities( $index_title, '"' ),
+                                                      lang => $lang ),
+       title( $index_title ), '<div id="lefthalfcol"><dl>';
+       my $i = 0; my $num_sections = keys %{$subsections->{$s}{'us'}};
+       foreach my $ssec ((keys %{$subsections->{$s}{'us'}}, 'virtual')) {
+           next if $ssec eq '-';
+           if ($sections_descs{$ssec}) {
+               print {$pages{$key}{$lang}{index}{fh}} "<dt><a href=\"$ssec/\">".dgettext( 'sections', $sections_descs{$ssec}[0] )."</a></dt><dd>".dgettext( 'sections', $sections_descs{$ssec}[1] )."</dd>\n";
+               $i++;
+               if ($i eq ceil($num_sections/2)) {
+                   print {$pages{$key}{$lang}{index}{fh}} "</dl>\n</div> <!-- end lefthalfcol -->\n<div id=\"righthalfcol\">\n<dl>\n";
                }
            }
-
-           print {$pages{$key}{$lang}{index}{fh}} '</dl></div>',
-           "<p class=\"psmallcenter\"><a href=\"allpackages\" title=\""._g( "List of all packages" )."\">".
-               _g( "All packages" ) ."</a><br>(<a href=\"allpackages.en.txt.gz\">".
-               _g( "compact compressed textlist" )."</a>)</p>\n";
-           print {$pages{$key}{$lang}{index}{fh}} trailer( "$root../", 'index', $lang, @LANGUAGES );
-           close $pages{$key}{$lang}{index}{fh} or
-               warn "can't close index file $wwwdir/$key/index.$lang.html.new: $!";
-           rename( "$wwwdir/$key/index.$lang.html.new",
-                   "$wwwdir/$key/index.$lang.html" );
-
        }
+       
+       print {$pages{$key}{$lang}{index}{fh}} '</dl></div>',
+       "<p class=\"psmallcenter\"><a href=\"allpackages\" title=\""._g( "List of all packages" )."\">".
+           _g( "All packages" ) ."</a><br>(<a href=\"allpackages.en.txt.gz\">".
+           _g( "compact compressed textlist" )."</a>)</p>\n";
+       print {$pages{$key}{$lang}{index}{fh}} trailer( "../", 'index', $lang, @LANGUAGES );
+       close $pages{$key}{$lang}{index}{fh} or
+           warn "can't close index file $wwwdir/$key/index.$lang.html.new: $!";
+       rename( "$wwwdir/$key/index.$lang.html.new",
+               "$wwwdir/$key/index.$lang.html" );
+       
     }
 }
 setlocale( LC_ALL, 'C' ) or die "couldn't reset locale";
 
 print "opening files ...\n";
 foreach my $s (@SUITES) {
-    foreach my $a (@ARCHIVES) {
-       next if $a eq 'security';
-       next if $a eq 'non-US';
-       my $key = ($a eq 'us') ? $s : "$s/$a";
-       mkpath ( "$wwwdir/$key" );
-       open $pages{$key}{fh}, '>', "$wwwdir/$key/allpackages.en.html.new"
+    my $key = $s;
+    mkpath ( "$wwwdir/$key" );
+    open $pages{$key}{fh}, '>', "$wwwdir/$key/allpackages.en.html.new"
+       or die "can't open index file for output: $!";
+
+    my $title = sprintf( _g( "Software Packages in \"%s\"" ),
+                        $key );
+    print {$pages{$key}{fh}} header( title => $title,
+                                    title_keywords => "debian, $s",
+                                    desc => encode_entities( $title, '"' ),
+                                    lang => 'en' ),
+    title( $title ), '<dl>';
+
+    foreach my $sec (keys %{$sections->{$s}{'us'}}) {
+       mkpath ( "$wwwdir/$key/$sec" );
+       open $pages{$key}{$sec}{fh}, '>', "$wwwdir/$key/$sec/index.en.html.new"
            or die "can't open index file for output: $!";
-
-       my $title = sprintf( _g( "Software Packages in \"%s\"" ),
-                            $key );
-       print {$pages{$key}{fh}} header( title => $title,
-                                        title_keywords => "debian, $s",
-                                        desc => encode_entities( $title, '"' ),
-                                        lang => 'en' ),
+       $title = sprintf( _g( "Software Packages in \"%s\", section %s" ),
+                         $key, $sec );
+       print {$pages{$key}{$sec}{fh}} header( title => $title,
+                                              title_keywords => "debian, $s, $sec",
+                                              desc => encode_entities( $title, '"' ),
+                                              lang => 'en' ),
+       title( $title ), '<dl>';
+    }
+    foreach my $ssec ((keys %{$subsections->{$s}{'us'}}, 'virtual')) {
+       next if $ssec eq '-';
+       mkpath ( "$wwwdir/$key/$ssec" );
+       open $pages{$key}{$ssec}{fh}, '>', "$wwwdir/$key/$ssec/index.en.html.new"
+           or die "can't open index file for output: $!";
+       $title = sprintf( _g( "Software Packages in \"%s\", subsection %s" ),
+                         $key, $ssec );
+       print {$pages{$key}{$ssec}{fh}} header( title => $title,
+                                               title_keywords => "debian, $s, $ssec",
+                                               desc => encode_entities( $title, '"' ),
+                                               lang => 'en' ),
+       title( $title ), '<dl>';
+    }
+    foreach my $prio (keys %{$priorities->{$s}{'us'}}) {
+       next if $prio eq '-';
+       mkpath ( "$wwwdir/$key/$prio" );
+       open $pages{$key}{$prio}{fh}, '>', "$wwwdir/$key/$prio/index.en.html.new"
+           or die "can't open index file for output: $!";
+       $title = sprintf( _g( "Software Packages in \"%s\", priority %s" ),
+                         $key, $prio );
+       print {$pages{$key}{$prio}{fh}} header( title => $title,
+                                               title_keywords => "debian, $s, $prio",
+                                               desc => encode_entities( $title, '"' ),
+                                               lang => 'en' ),
        title( $title ), '<dl>';
-
-       foreach my $sec (keys %{$sections->{$s}{$a}}) {
-           mkpath ( "$wwwdir/$key/$sec" );
-           open $pages{$key}{$sec}{fh}, '>', "$wwwdir/$key/$sec/index.en.html.new"
-               or die "can't open index file for output: $!";
-           $title = sprintf( _g( "Software Packages in \"%s\", section %s" ),
-                             $key, $sec );
-           print {$pages{$key}{$sec}{fh}} header( title => $title,
-                                                  title_keywords => "debian, $s, $sec",
-                                                  desc => encode_entities( $title, '"' ),
-                                                  lang => 'en' ),
-           title( $title ), '<dl>';
-       }
-       foreach my $ssec ((keys %{$subsections->{$s}{$a}}, 'virtual')) {
-           next if $ssec eq '-';
-           mkpath ( "$wwwdir/$key/$ssec" );
-           open $pages{$key}{$ssec}{fh}, '>', "$wwwdir/$key/$ssec/index.en.html.new"
-               or die "can't open index file for output: $!";
-           $title = sprintf( _g( "Software Packages in \"%s\", subsection %s" ),
-                             $key, $ssec );
-           print {$pages{$key}{$ssec}{fh}} header( title => $title,
-                                                   title_keywords => "debian, $s, $ssec",
-                                                   desc => encode_entities( $title, '"' ),
-                                                   lang => 'en' ),
-           title( $title ), '<dl>';
-       }
-       foreach my $prio (keys %{$priorities->{$s}{$a}}) {
-           next if $prio eq '-';
-           mkpath ( "$wwwdir/$key/$prio" );
-           open $pages{$key}{$prio}{fh}, '>', "$wwwdir/$key/$prio/index.en.html.new"
-               or die "can't open index file for output: $!";
-           $title = sprintf( _g( "Software Packages in \"%s\", priority %s" ),
-                             $key, $prio );
-           print {$pages{$key}{$prio}{fh}} header( title => $title,
-                                                   title_keywords => "debian, $s, $prio",
-                                                   desc => encode_entities( $title, '"' ),
-                                                   lang => 'en' ),
-           title( $title ), '<dl>';
-       }
     }
 }
 
 print "writing package info ...\n";
 while (my ($pkg, $data) = each %packages) {
-    my %pkg;
-    foreach (split /\000/o, $data) {
+    my (%pkg,%virt);
+    my ($virt, $p_data) = split /\000/o, $data, 2;
+    %virt = split /\01/o, $virt; 
+    foreach (split /\000/o, $p_data) {
        my @data = split ( /\s/o, $_, 8 );
-       my $key = $data[1];
-       if ($data[0] !~ /^(?:us|security|non-US)$/o) {
-           $key = "$data[1]/$data[0]";
-       }
-       $pkg{$key} ||= new Packages::Page( $pkg );
-       if ($data[2] ne 'virtual') {
-           $pkg{$key}->merge_package( { package => $pkg,
+       $pkg{$data[1]} ||= new Packages::Page( $pkg );
+       $pkg{$data[1]}->merge_package( { package => $pkg,
                                         archive => $data[0],
                                         suite => $data[1],
                                         architecture => $data[2],
@@ -173,10 +161,13 @@ while (my ($pkg, $data) = each %packages) {
                                         priority => $data[5],
                                         version => $data[6],
                                         description => $data[7] } );
-       } else {
-           $pkg{$key}->add_provided_by([split /\s+/, $data[7]]);
-       }
     }
+    foreach (keys %virt) {
+       next if $_ eq '-';
+       $pkg{$_} ||= new Packages::Page( $pkg );
+       $pkg{$_}->add_provided_by([split /\s+/, $virt{$_}]);
+    }
+    
     while (my ($key, $entry) = each %pkg) {
        if (my $provided_by = $entry->{provided_by}) {
            my $str = "<dt><a href=\"$pkg\">$pkg</a> ".
@@ -194,7 +185,7 @@ while (my ($pkg, $data) = each %packages) {
        my $short_desc_txt = $entry->get_newest( 'description' );
        my $short_desc = encode_entities( $short_desc_txt, "<>&\"" );
        my $priority = $entry->get_newest( 'priority' );
-
+       
        my $str = "<dt><a href=\"$pkg\">$pkg</a> ($v_str) ";
        my $txt_str = "$pkg ($v_str)";
        if ($section ne 'main') {
@@ -206,12 +197,14 @@ while (my ($pkg, $data) = each %packages) {
            $txt_str .= " [$archive]";
        }
        $str .= "</dt>\n     <dd>$short_desc</dd>\n";
-        $txt_str .= " $short_desc_txt\n";
+       $txt_str .= " $short_desc_txt\n";
        print {$pages{$key}{fh}} $str
            or die "couldn't write to output file: $!";
        print {$pages{$key}{$section}{fh}} $str
            or die "couldn't write to output file: $!";
        if ($subsection ne '-') {
+           print STDERR "pages{$key}{$subsection}{fh}\n"
+               unless $pages{$key}{$subsection}{fh};
            print {$pages{$key}{$subsection}{fh}} $str
                or die "couldn't write to output file: $!";
        }
@@ -224,38 +217,33 @@ while (my ($pkg, $data) = each %packages) {
 
 print "closing files ...\n";
 foreach my $s (@SUITES) {
-    foreach my $a (@ARCHIVES) {
-       next if $a eq 'security';
-       next if $a eq 'non-US';
-       my $key = ($a eq 'us') ? $s : "$s/$a";
-       my $root = ($a eq 'us') ? '' : '../';
-       print {$pages{$key}{fh}} '</dl>', trailer( "$root../" );
-       close $pages{$key}{fh} or
-           warn "can't close index file $wwwdir/$key/allpackages.en.html.new: $!";
-       rename( "$wwwdir/$key/allpackages.en.html.new",
-               "$wwwdir/$key/allpackages.en.html" );
-       foreach my $sec (keys %{$sections->{$s}{$a}}) {
-           print {$pages{$key}{$sec}{fh}} '</dl>', trailer( "$root../../" );
-           close $pages{$key}{$sec}{fh} or
-               warn "can't close index file $wwwdir/$key/$sec/index.en.html.new: $!";
-           rename( "$wwwdir/$key/$sec/index.en.html.new",
-                   "$wwwdir/$key/$sec/index.en.html" );
-       }
-       foreach my $ssec ((keys %{$subsections->{$s}{$a}}, 'virtual')) {
-           next if $ssec eq '-';
-           print {$pages{$key}{$ssec}{fh}} '</dl>', trailer( "$root../../" );
-           close $pages{$key}{$ssec}{fh} or
-               warn "can't close index file $wwwdir/$key/$ssec/index.en.html.new: $!";
-           rename( "$wwwdir/$key/$ssec/index.en.html.new",
-                   "$wwwdir/$key/$ssec/index.en.html" );
-       }
-       foreach my $prio (keys %{$priorities->{$s}{$a}}) {
-           next if $prio eq '-';
-           print {$pages{$key}{$prio}{fh}} '</dl>', trailer( "$root../../" );
-           close $pages{$key}{$prio}{fh} or
-               warn "can't close index file $wwwdir/$key/$prio/index.en.html.new: $!";
-           rename( "$wwwdir/$key/$prio/index.en.html.new",
-                   "$wwwdir/$key/$prio/index.en.html" );
-       }
+    my $key = $s;
+    print {$pages{$key}{fh}} '</dl>', trailer( "../" );
+    close $pages{$key}{fh} or
+       warn "can't close index file $wwwdir/$key/allpackages.en.html.new: $!";
+    rename( "$wwwdir/$key/allpackages.en.html.new",
+           "$wwwdir/$key/allpackages.en.html" );
+    foreach my $sec (keys %{$sections->{$s}{'us'}}) {
+       print {$pages{$key}{$sec}{fh}} '</dl>', trailer( "../../" );
+       close $pages{$key}{$sec}{fh} or
+           warn "can't close index file $wwwdir/$key/$sec/index.en.html.new: $!";
+       rename( "$wwwdir/$key/$sec/index.en.html.new",
+               "$wwwdir/$key/$sec/index.en.html" );
+    }
+    foreach my $ssec ((keys %{$subsections->{$s}{'us'}}, 'virtual')) {
+       next if $ssec eq '-';
+       print {$pages{$key}{$ssec}{fh}} '</dl>', trailer( "../../" );
+       close $pages{$key}{$ssec}{fh} or
+           warn "can't close index file $wwwdir/$key/$ssec/index.en.html.new: $!";
+       rename( "$wwwdir/$key/$ssec/index.en.html.new",
+               "$wwwdir/$key/$ssec/index.en.html" );
+    }
+    foreach my $prio (keys %{$priorities->{$s}{'us'}}) {
+       next if $prio eq '-';
+       print {$pages{$key}{$prio}{fh}} '</dl>', trailer( "../../" );
+       close $pages{$key}{$prio}{fh} or
+           warn "can't close index file $wwwdir/$key/$prio/index.en.html.new: $!";
+       rename( "$wwwdir/$key/$prio/index.en.html.new",
+               "$wwwdir/$key/$prio/index.en.html" );
     }
 }
diff --git a/bin/newpkg_info b/bin/newpkg_info
new file mode 100755 (executable)
index 0000000..cdfac5f
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use lib './lib';
+
+use Packages::Config qw( $TOPDIR );
+use Packages::DB;
+use Packages::Search qw( :all );
+&Packages::Config::init( './' );
+
+my $suite = $ARGV[0] or die "No suite given";
+my $start_time = time;
+
+sub get_iso_date {
+    my ($age) = @_;
+
+    my ($day, $month, $year) = (gmtime($start_time - ($age*86_400)))[3..5];
+    $month++;
+    $year += 1900;
+    return sprintf( "%04s-%02s-%02s", $year, $month, $day );
+}
+
+open CHANGES, '>', "$TOPDIR/files/packages/newpkg_info.new"
+    or die "Couldn't open CHANGES file: $!";
+for (my $age = 0; $age < 7; $age++) {
+    my (%old, %changes);
+    my $newday = get_iso_date( $age );
+    my $oldday = get_iso_date( $age+1 );
+    open OLD, '<', "$TOPDIR/files/packages/package_names_$suite.$oldday"
+       or die "Couldn't open OLD file $TOPDIR/files/packages/package_names_$suite.$oldday: $!";
+    while (<OLD>) {
+       chomp;
+       $old{$_} = 1;
+    }
+    close OLD;
+    open NEW, '<', "$TOPDIR/files/packages/package_names_$suite.$newday"
+       or die "Couldn't open NEW file $TOPDIR/files/packages/package_names_$suite.$newday: $!";
+    while (<NEW>) {
+       chomp;
+       if ($old{$_}) {
+           # we assume here that the input contains no dupes!
+           delete $old{$_};
+       } else {
+           $changes{$_} = 1;
+       }
+    }
+    close NEW;
+    foreach (keys %old) {
+       $changes{$_} = -1;
+    }
+
+    my %archives = map { $_ => 1 } qw( us security non-US );
+    foreach (sort keys %changes) {
+       my $entry = read_entry_simple( \%packages, $_, \%archives, $suite)
+           or die "Can't find entry for package $_";
+       shift @$entry; # remove virtual pkg info
+       print CHANGES join(" ", $_, $age, @$entry)."\n";
+       print "Wrote entry: ".join(" ", $_, $age, @$entry)."\n";
+    }
+}
+closes CHANGES;
+
+rename("$TOPDIR/files/packages/newpkg_info.new",
+       "$TOPDIR/files/packages/newpkg_info");
index b3aab25fff2ee63b7e779edb86a2928023cba511..e441515c8708bbfcb59939630c611c69a07caab8 100755 (executable)
@@ -20,6 +20,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 use strict;
+use warnings;
 use lib './lib';
 
 $| = 1;
@@ -52,6 +53,7 @@ $/ = "";
 for my $archive (@ARCHIVES) {
     for my $suite (@SUITES) {
 
+       my %package_names_suite = ();
        print "Reading $archive/$suite...\n";
        my %packages_all_db;
        tie %packages_all_db, "DB_File", "$DBDIR/packages_all_$suite.db.new",
@@ -79,6 +81,7 @@ for my $archive (@ARCHIVES) {
                    }
                }
                $package_names{$data{'package'}} = 1;
+               $package_names_suite{$data{'package'}} = 1;
                my $src = $data{'package'};
                my $src_version = '';
                if ($data{'source'}) {
@@ -139,6 +142,13 @@ for my $archive (@ARCHIVES) {
                        = $data;
        }
 
+       open NAMES, '>>', "$DBDIR/package_names_$suite.txt.new"
+           or die "Error creating package names list: $!";
+       foreach (sort keys %package_names_suite) {
+           print NAMES "$_\n";
+       }
+       close NAMES;
+
        untie %packages_all_db;
     }
 }
@@ -256,6 +266,8 @@ rename("$DBDIR/sources_packages.db.new", "$DBDIR/sources_packages.db");
 for my $suite (@SUITES) {
        rename("$DBDIR/packages_all_$suite.db.new",
               "$DBDIR/packages_all_$suite.db");
+       rename("$DBDIR/package_names_$suite.txt.new",
+              "$DBDIR/package_names_$suite.txt");
 }
 rename("$DBDIR/packages_descriptions.db.new",
        "$DBDIR/packages_descriptions.db");
index 6456c0e1929844751914d2be581701b4759ff4da..732112658e74f236c6d8e4d9d459b5a67d277c8d 100755 (executable)
@@ -41,6 +41,7 @@ for my $archive (@ARCHIVES) {
     for my $suite (@SUITES) {
 
        print "Reading $archive/$suite...\n";
+       my %source_names_suite = ();
        my %sources_all_db;
        tie %sources_all_db, "DB_File", "$DBDIR/sources_all_$suite.db.new",
                O_RDWR|O_CREAT, 0666, $DB_BTREE
@@ -59,6 +60,7 @@ for my $archive (@ARCHIVES) {
                        $data{$key} = $value;
                }
                $source_names{$data{'package'}} = 1;
+               $source_names_suite{$data{'package'}} = 1;
                delete $data{'binary'};
 
                $data{files} =~ s/\s*\n\s*/\01/sog;
@@ -86,6 +88,12 @@ for my $archive (@ARCHIVES) {
                $sources_all_db{"$archive $suite $data{'package'}"}
                        = $data;
        }
+       open NAMES, '>>', "$DBDIR/source_names_$suite.txt.new"
+           or die "Error creating source names list: $!";
+       foreach (sort keys %source_names_suite) {
+           print NAMES "$_\n";
+       }
+       close NAMES;
 
        untie %sources_all_db;
     }
@@ -129,6 +137,7 @@ untie %source_postfixes_db;
 
 for my $suite (@SUITES) {
        rename("$DBDIR/sources_all_$suite.db.new", "$DBDIR/sources_all_$suite.db");
+       rename("$DBDIR/source_names_$suite.txt.new", "$DBDIR/source_names_$suite.txt");
 }
 rename("$DBDIR/sources_small.db.new", "$DBDIR/sources_small.db");
 rename("$DBDIR/source_postfixes.db.new", "$DBDIR/source_postfixes.db");
index 254f0b6da3bdf116931f55dd2e3f5f12b1e4ccd2..e863de91b172aa0ff94823e9fc4d0218b4e9f71f 100755 (executable)
@@ -171,7 +171,7 @@ my %params_def = ( keywords => { default => undef,
                                    match => '^([\w-]+)$',
                                    array => ',', var => \@archives,
                                    replace => { all => \@ARCHIVES,
-                                                default => [qw(us security non-US)]} },
+                                                default => \@ARCHIVES} },
                   exact => { default => 0, match => '^(\w+)$',  },
                   lang => { default => $http_lang, match => '^(\w+)$',  },
                   source => { default => 0, match => '^(\d+)$',  },
diff --git a/cron.d/600prepare_newpkg b/cron.d/600prepare_newpkg
new file mode 100755 (executable)
index 0000000..b97f4f3
--- /dev/null
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+. `dirname $0`/../config.sh
+
+packagesdir=${filesdir}/packages
+test -d ${packagesdir} || mkdir -p ${packagesdir}
+
+LANG=C cat ${filesdir}/db/package_names_unstable.txt \
+    | sort | uniq > ${packagesdir}/package_names_unstable.$(date -I)
+
+cd $topdir
+
+./bin/newpkg_info unstable
index fc37c9466f9f7e44281f16938c052038bede4e53..c8cd39df920de4dca0a2f2f2f9e2cb2cc5ee159d 100644 (file)
@@ -238,6 +238,18 @@ sub dep_item {
     return "$link$name$post_link$info$desc";
 } # end dep_item
 
+sub provides_string {
+    my ($path, $entry) = @_;
+    my @provided_by = split /\s/, $entry;
+    my $short_desc = "virtual package provided by ";
+    if (@provided_by < 10) {
+       $short_desc .= join( ', ',map { "<a href=\"$path/$_\">$_</a>" } @provided_by);
+    } else {
+       $short_desc .= scalar(@provided_by)." packages";
+    }
+    return $short_desc;
+}
+
 sub print_deps {
     my ( $packages, $opts, $pkg, $relations, $type) = @_;
     my %dep_type = ('depends' => 'dep', 'recommends' => 'rec', 
@@ -294,20 +306,17 @@ sub print_deps {
                if ( $is_old_pkgs ) {
                    push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
                                              $p_name, "$pkg_version$arch_str" );
-               } elsif (defined $entry->[0]) {
-# FIXME: can be both virtual package (defined $entry->[0]) and real one
-                   my @provided_by = split /\s/, $entry->[0];
-                   $short_desc = "virtual package provided by ";
-                   if (@provided_by < 10) {
-                       $short_desc .= join( ', ',map { "<a href=\"$ROOT/$path/$_\">$_</a>" } @provided_by);
-                   } else {
-                       $short_desc .= scalar(@provided_by)." packages";
-                   }
-                   push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
-                                             $p_name, "$pkg_version$arch_str", $short_desc );
-               } else {
+               } elsif (defined $entry->[1]) {
                    $entries{$p_name} ||= $entry;
                    $short_desc = encode_entities( $short_desc, "<>&\"" );
+                   $short_desc .= "<br>".provides_string( "$ROOT/$path",
+                                                          $entry->[0] )
+                       if defined $entry->[0];
+                   push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
+                                             $p_name, "$pkg_version$arch_str", $short_desc );
+               } elsif (defined $entry->[0]) {
+                   $short_desc = provides_string( "$ROOT/$path",
+                                                  $entry->[0] );
                    push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
                                              $p_name, "$pkg_version$arch_str", $short_desc );
                }
index 000f1a0c24bfcaaad9a33236b5f08fb024fd2371..417c97ef68f8baf90d41fc2806333abdfe9ab2ed 100644 (file)
@@ -128,12 +128,16 @@ sub merge_package {
 
     debug( "package $data->{package}/$data->{version}/$data->{architecture} is subsequent merge", 3 ) if DEBUG;
     my $is_newest;
-    if ($is_newest =
-       (version_cmp( $data->{version}, $self->{newest} ) > 0)) {
+    my $cmp = version_cmp( $data->{version}, $self->{newest} );
+    if ($is_newest = ($cmp > 0)) {
        $self->{newest} = $data->{version};
        foreach my $key (@TAKE_NEWEST) {
            $self->{data}{$key} = $data->{$key};
        }
+    } elsif (($cmp == 0) &&
+            $self->{data}{archive} ne 'us') {
+       #FIXME crude hack to prefer us archive over others
+       $self->{data}{archive} = $data->{archive};
     }
     debug( "is_newest= ".($is_newest||0), 3 ) if DEBUG;
     if (!$self->{versions}{$data->{architecture}}
index 24aa88aabc0a071508b5a122b50d30775b93a49c..3f24e977856e46d3a9dfc8182d874d45bb5b5a69 100644 (file)
@@ -380,9 +380,9 @@ sub read_entry_simple {
     my %virt = split /\01/o, $virt; 
     debug( "read_entry_simple: key=$key, archives=".
           join(" ",(keys %$archives)).", suite=$suite", 1) if DEBUG;
-    # FIXME: magically encoded a max of 7 suites here by the '8'
-    foreach (split /\000/o, $result, 8) {
+    foreach (split /\000/o, $result) {
        my @data = split ( /\s/o, $_, 8 );
+       debug( "use entry: @data", 2 ) if DEBUG && $data[1] eq $suite;
        return [ $virt{$suite}, @data ] if $data[1] eq $suite;
     }
     return [ $virt{$suite} ];