]> git.deb.at Git - deb/packages.git/commitdiff
Merge branch 'master' of ssh://source/srv/source.djpig.de/git/packages into ubuntu...
authorFrank Lichtenheld <frank@lichtenheld.de>
Wed, 12 Sep 2007 20:51:18 +0000 (22:51 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Wed, 12 Sep 2007 20:51:18 +0000 (22:51 +0200)
Conflicts:

conf/apache.conf.sed.in
config.sh.sed.in
lib/Packages/Search.pm

1  2 
conf/apache.conf.sed.in
config.sh.sed.in
lib/Packages/Search.pm
templates/html/foot.tmpl
templates/html/head.tmpl

diff --combined conf/apache.conf.sed.in
index 6384605b1666e4f3102a20c4ee5aa4b28f3bdb14,c71ef22956aedbf805635024cdc7dd6b9adbb541..bbb24d943fef27941504174d673a0248bba05ee7
  
    # RSS stuff
    AddType application/rss+xml .rdf .xml
+   RemoveType .gz
+   AddEncoding x-gzip .gz
  </Directory>
  
  <VirtualHost *>
 -   ServerAdmin webmaster@debian.org
 +   ServerAdmin frank@lichtenheld.de
     DocumentRoot %TOPDIR%/www/
     ServerName %SITE%
     ErrorLog /var/log/apache2/%SITE%-error.log
     CustomLog /var/log/apache2/%SITE%-access.log combined
  
 -   Alias /cgi-bin/ %TOPDIR%/cgi-bin/
 +   ScriptAlias /cgi-bin/ %TOPDIR%/cgi-bin/
    
 -   PerlModule ModPerl::Registry
 -   PerlTaintCheck On
 -   PerlRequire %TOPDIR%/bin/mod_perl-startup
 -   PerlSwitches -T
 +#   PerlModule ModPerl::Registry
 +#   PerlTaintCheck On
 +#   PerlRequire %TOPDIR%/bin/mod_perl-startup
++#   PerlSwitches -T
     <Location /cgi-bin/>
 -      SetHandler perl-script
 +#      SetHandler perl-script
        # mod-perl etch
 -      PerlInitHandler Apache2::Reload
 +#      PerlInitHandler Apache2::Reload
        # mod-perl sarge
        #PerlInitHandler Apache::Reload
 -      PerlHandler ModPerl::Registry
 +#      PerlHandler ModPerl::Registry
        Options +ExecCGI
 -      PerlSendHeader On
 +#      PerlSendHeader On
        allow from all
     </Location>
  
     RewriteRule ^/changelogs/ - [L]
     RewriteRule ^/Pics/ - [L]
     RewriteRule ^/about/ - [L]
 +   RewriteRule ^/ubuntu/ - [L]
     RewriteRule ^/[^/]+\.css - [L]
     RewriteRule ^/[^/]+\.js - [L]
  
     RewriteRule ^/([^/+]*)([+])([^/]*)$ "/$1%%{%}2B$3" [N]
     RewriteRule ^/changelog:(.+)$  http://%SITE%/changelogs/${changelog-url:$1} [R,L,NE]
     RewriteRule ^/src:([^/]+)$ /source/$1 [R,L,NE]
+    RewriteRule ^/file:(.+)$ http://%SITE%/search?searchon=contents&keywords=$1 [R,L,NE]
+    RewriteCond %{QUERY_STRING} =""
+    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME} -f [OR]
+    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME}.en.html -f [OR]
+    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME} -l [OR]
+    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME} -d
+    RewriteRule . - [L]
  
     RewriteRule ^/(.+)$ /cgi-bin/dispatcher.pl/$1 [L,PT]
  
diff --combined config.sh.sed.in
index 155e8b8ea140b6cee4f19d13c03d0506491f2e46,08ecd6189d9620979305765154b0e610d7f37202..1be02c86ae55de54a5b0f92ebb303ea5e6827bda
@@@ -20,42 -20,39 +20,42 @@@ cachedir=${topdir}/cach
  # unset this if %SITE% moves somewhere where the packages files
  # cannot be obtained locally
  #
--localdir=/org/ftp.debian.org/debian
++#localdir=/org/ftp.debian.org/debian
  
  # path to private ftp directory
  #ftproot=/org/ftp.root
  
 -ftpsite=http://ftp.de.debian.org/debian
 -security_ftpsite=http://security.debian.org/debian-security
 -volatile_ftpsite=http://volatile.debian.org/debian-volatile
 -backports_ftpsite=http://backports.org/debian
 -amd64_ftpsite=http://amd64.debian.net/debian
 -gnuab_ftpsite=http://kfreebsd-gnu.debian.net/debian
 +ftpsite=http://archive.ubuntu.com/ubuntu
 +security_ftpsite=$ftpsite
+ ddtp_ftpsite=http://ddtp.debian.net/debian
  
  root=""
  
  # Architectures
  #
  polangs="de fi nl fr uk"
- ddtplangs="de cs da eo es fi fr hu it ja nl pl pt_BR pt_PT ru sk sv_SE uk"
+ ddtplangs="ca cs da de eo es fi fr go hu it ja km_KH ko nl pl pt pt_BR ru sk sv uk zh zh_CN zh_TW"
 -archives="us security amd64 gnuab backports volatile"
 -sections="main contrib non-free"
 -parts="$sections"
 -suites="sarge sarge-volatile sarge-backports etch etch-m68k etch-volatile etch-backports lenny sid experimental"
 +archives="us security"
 +sections="main multiverse restricted universe"
 +parts="${sections}"
 +suites="warty hoary hoary-backports breezy breezy-backports dapper dapper-backports edgy edgy-backports feisty"
  priorities="required important standard optional extra"
- dists="${suites}"
 -dists="$suites"
 -architectures="alpha amd64 arm armel hppa hurd-i386 i386 ia64 kfreebsd-i386 kfreebsd-amd64 m68k mips mipsel powerpc s390 sparc"
 -arch_sarge="alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc"
 -arch_etch="alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc"
 -arch_lenny="${arch_etch}"
 -arch_sid="${arch_sarge} armel hurd-i386 kfreebsd-i386 kfreebsd-amd64"
 -arch_experimental="${arch_sid}"
 -arch_lenny_proposed_updates="${arch_lenny}"
 -arch_etch_proposed_updates="${arch_etch}"
 +architectures="i386 amd64 powerpc"
 +arch_warty="i386 amd64 powerpc"
 +arch_warty_updates="${arch_warty}"
 +arch_hoary="${arch_warty}"
 +arch_hoary_backports="${arch_hoary}"
 +arch_hoary_updates="${arch_hoary}"
 +arch_breezy="${arch_hoary}"
 +arch_breezy_updates="${arch_breezy}"
 +arch_breezy_backports="${arch_breezy}"
 +arch_dapper="${arch_breezy}"
 +arch_dapper_updates="${arch_dapper}"
 +arch_dapper_backports="${arch_dapper}"
 +arch_edgy="${arch_dapper}"
 +arch_edgy_updates="${arch_edgy}"
 +arch_edgy_backports="${arch_edgy}"
 +arch_feisty="${arch_edgy}"
  
  # Miscellaneous
  #
diff --combined lib/Packages/Search.pm
index ad43390d38c1c7e33ca69551cd21cffea5b53433,d3872672edeadfadc8c259d2546b4141631b7121..3a204988504e95d144f23a1f5a31100883494b33
@@@ -1,8 -1,8 +1,8 @@@
  #
  # Packages::Search
  #
- # Copyright (C) 2004-2006 Frank Lichtenheld <frank@lichtenheld.de>
- # 
+ # Copyright (C) 2004-2007 Frank Lichtenheld <frank@lichtenheld.de>
+ #
  # The code is based on the old search_packages.pl script that
  # was:
  #
@@@ -23,7 -23,7 +23,7 @@@
  #
  #    You should have received a copy of the GNU General Public License
  #    along with this program; if not, write to the Free Software
- #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ #    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  #
  
  =head1 NAME
@@@ -58,6 -58,7 +58,7 @@@ our @ISA = qw( Exporter )
  our @EXPORT_OK = qw( read_entry read_entry_all read_entry_simple
                     read_src_entry read_src_entry_all find_binaries
                     do_names_search do_fulltext_search do_xapian_search
+                    find_similar
                     );
  our %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
  
@@@ -81,7 -82,7 +82,7 @@@ sub read_entry_all 
        }
      }
  
-     foreach (split /\000/o, $result) {
+     foreach (split(/\000/o, $result||'')) {
        my @data = split ( /\s/o, $_, 8 );
        debug( "Considering entry ".join( ':', @data), 2) if DEBUG;
        if ($opts->{h_suites}{$data[1]}
@@@ -100,14 -101,13 +101,14 @@@ sub read_entry 
      read_entry_all( $hash, $key, $results, \@non_results, $opts );
  }
  
 -#FIXME: make configurable
 -my %fallback_suites = (
 -                     'sarge-backports' => 'sarge',
 -                     'sarge-volatile' => 'sarge',
 -                     'etch-backports' => 'etch',
 -                     'etch-volatile' => 'etch',
 -                     experimental => 'sid' );
 +sub fallback_suite {
 +    my $suite = shift;
 +    if ($suite =~ /^(\S+)-(?:updates|backports)/) {
 +      return $1;
 +    } else {
 +      return undef;
 +    }
 +}
  
  sub read_entry_simple {
      my ($hash, $key, $archives, $suite) = @_;
        debug( "use entry: @data", 2 ) if DEBUG && $data[1] eq $suite;
        return [ $virt{$suite}, @data ] if $data[1] eq $suite;
      }
 -    if (my $fb_suite = $fallback_suites{$suite}) {
 +    if (my $fb_suite = fallback_suite($suite)) {
        my $fb_result = read_entry_simple( $hash, $key, $archives, $fb_suite );
        my $fb_virt = shift(@$fb_result);
        $virt{$suite} .= $virt{$suite} ? " $fb_virt" : $fb_virt if $fb_virt;
@@@ -199,7 -199,7 +200,7 @@@ sub do_names_search 
  }
  
  sub do_xapian_search {
-     my ($keywords, $db, $did2pkg, $packages, $read_entry, $opts,
+     my ($keywords, $dbpath, $did2pkg, $packages, $read_entry, $opts,
        $results, $non_results) = @_;
  
  # NOTE: this needs to correspond with parse-packages!
      my $stemmer = Lingua::Stem->new();
      my $stemmed_keywords = $stemmer->stem( @tmp );
  
-     my $db = Search::Xapian::Database->new( $db );
+     my $db = Search::Xapian::Database->new( $dbpath );
      my $enq = $db->enquire( OP_OR, @$keywords, @$stemmed_keywords );
      debug( "Xapian Query was: ".$enq->get_query()->get_description(), 1) if DEBUG;
      my @matches = $enq->matches(0, 999);
      }
  }
  
+ sub find_similar {
+     my ($pkg, $dbpath, $did2pkg) = @_;
+     my $db = Search::Xapian::Database->new( $dbpath );
+     my $enq = $db->enquire( "P$pkg" );
+     debug( "Xapian Query was: ".$enq->get_query()->get_description(), 1) if DEBUG;
+     my $first_match = ($enq->matches(0,1))[0]->get_document();
+     my @terms;
+     my $term_it = $first_match->termlist_begin();
+     my $term_end = $first_match->termlist_end();
+     for (; $term_it ne $term_end; $term_it++) {
+       debug( "TERM: ".$term_it->get_termname(), 3);
+       push @terms, $term_it->get_termname();
+     }
+     my $rel_enq = $db->enquire( OP_OR, @terms );
+     debug( "Xapian Query was: ".$rel_enq->get_query()->get_description(), 1) if DEBUG;
+     my @rel_pkg = $rel_enq->matches(2,20);
+ #    use Data::Dumper;
+ #    debug(Dumper(\@rel_pkg),1);
+     my (@order, %tmp_results);
+     foreach my $match ( @rel_pkg ) {
+       my $id = $match->get_docid();
+       my $result = $did2pkg->{$id};
+       foreach (split /\000/o, $result) {
+           my @data = split /\s/, $_, 3;
+           debug ("Considering $data[0], arch = $data[2], relevance=".$match->get_percent(), 3) if DEBUG;
+           next if $data[0] eq $pkg;
+           unless ($tmp_results{$data[0]}++) {
+               push @order, $data[0];
+           }
+       }
+     }
+     undef $db;
+     debug ("ORDER: @order", 2) if DEBUG;
+     return @order[0..10];
+ }
  sub find_binaries {
      my ($pkg, $archive, $suite, $src2bin) = @_;
  
diff --combined templates/html/foot.tmpl
index 493069863a1fafb13aad41ac1c3757ddbcece919,17a5e2a2a22949c7ecde4cf3f27fa6adbc324b70..64eb5505c3e8ca1649c6b2fd2aea6411bde19b31
@@@ -1,9 -1,8 +1,9 @@@
  [%- IF benchmark && debug -%]
  Total page evaluation took [% benchmark %]<br>
  [%- END -%]
 -</div> <!-- end inner -->
 +</div></div></div></div>
  
 +<div class=\"clear mozclear\"></div><div id=\"prefooter\">
  <div id="footer">
  
  [% IF langs.size > 0 %]
@@@ -11,9 -10,9 +11,9 @@@
  <!--UdmComment-->
  <p>This page is also available in the following languages:</p>
  <p class="navpara">
- [% FOREACH langs %]
- <a href="[% "$page_name?lang=$lang" %]" title="[% tooltip %]" hreflang="[% lang %]" lang="[% lang %]" rel="alternate">[% selfname %]
- [%- IF transliteration %] ([% transliteration %])[% END %]</a>
+ [% FOREACH l IN langs %]
+ <a href="[% "$page_name?lang=$l.lang" %]" title="[% l.tooltip %]" hreflang="[% l.lang %]" lang="[% l.lang %]" rel="alternate">[% l.selfname %]
+ [%- IF l.transliteration %] ([% l.transliteration %])[% END %]</a>
  [% END %]
  </p>
  <p>How to set <a href="[% cn_help_url %]">the default document language</a></p>
@@@ -24,8 -23,6 +24,8 @@@
  <p [%- ' class="bordertop"' IF langs.size > 0 %]>Back to: <a href="[% homepage %]">[% organisation %] homepage</a> || <a href="[% searchformurl %]">Packages search page</a></p>
  
  <hr class="hidecss">
 +<div id="footWrapper">
 +<div id="footer" class="inside">
  <div id="fineprint" class="bordertop">
  <p>To report a problem with the web site, e-mail <a href="mailto:[% contact.mail %]">[% contact.mail %]</a>. For other contact information, see the [% organisation %] <a href="[% contact.url %]">contact page</a>.</p>
  <p>[% IF timestamp.string %]Generated: [% timestamp.string %]<br>[% END %]
@@@ -33,8 -30,8 +33,8 @@@
  Content Copyright &copy; [% copyright.years %] <a href="[% copyright.url %]">[% copyright.name %]</a>; See <a href="[% license.url %]">license terms</a>. [% IF trademarknotes -%][% trademarknotes %][%- END %]
  [% END %]
  <p><a href="/about/">Learn more about this site</a>.</p>
 -</div> <!-- end fineprint -->
  </div> <!-- end footer -->
 -</div> <!-- end outer -->
 +</div> <!-- end footWrapper -->
 +</div> <!-- end pageWrapper -->
  </body>
  </html>
diff --combined templates/html/head.tmpl
index 00894ce9e95110e197376119cff4edb55c5ef452,05e8d975ece5281d1a3d3678c3bcb01c1381b295..1dbd8a83497ffd9d7b51b32e24492e2383a4491a
@@@ -12,8 -12,6 +12,8 @@@
  <link href="/debian.css" rel="stylesheet" type="text/css" media="all">
  <link href="/packages.css" rel="stylesheet" type="text/css" media="all">
  <link href="/packages-site.css" rel="stylesheet" type="text/css" media="all">
 +<link href="/ubuntu/ubuntu.css" rel="stylesheet" type="text/css" media="all">
 +<link href="/ubuntu/masthead.css" rel="stylesheet" type="text/css" media="all">
  [% IF rss_alternate %]
  <link rel="alternate" type="application/rss+xml" title="RSS" href="[% rss_alternate %]">
  [% END %]
  [% sitewidemsg.txt %]
  </div>
  [%- END -%]
 -<div id="header">
 -   <div id="upperheader">
 +    <div id="pageWrapper">
 +      <div id="mastWrapper">
 +        <div id="masthead">
 +          <a class="imageLink"
 +             href="[% homepage %]">&nbsp;</a>
  
 -   <div id="logo">
 -  <!-- very Debian specific use of the logo stuff -->
 -  <a href="[% logo.url %]"><img src="[% logo.src %]" alt="" /></a>
 -  <a href="[% logo.url %]"><img src="/Pics/debian-small.png" alt="[% logo.alt %]" width="90" height="31"></a>
 -</div> <!-- end logo -->
 +          <a class="hiddenStructure"
 +             href="[% homepage %]/#documentContent">Skip
 +             to content</a>
  
  [%- IF print_search_field %]
  [% checked = 'checked="checked"'
     selected = 'selected="selected"' %]
 +<div id="search">
  <form method="GET" action="/search">
  <div id="hpacketsearch">
  [% IF search_field_values.mode %]<input type="hidden" name="mode" value="[% search_field_values.mode %]">[% END %]
  package names</option>
  <option value="all" [% selected IF search_field_values.searchon == 'all' %]>descriptions</option>
  <option value="sourcenames" [% selected IF search_field_values.searchon == 'sourcenames' %]>source package names</option>
- <option value="contents" [% selected IF search_field_values.searchon == 'contents' %]>package contents</option
+ <option value="contents" [% selected IF search_field_values.searchon == 'contents' %]>package contents</option>
  </select>
  <input type="text" size="30" name="keywords" value="[% search_field_values.keywords | html %]" id="kw">
  <span style="font-size: 60%"><a href="[% searchformurl %]">all options</a></span>
  </div> <!-- end hpacketsearch -->
  </form>
 +</div>
  [% END %]
  
 -</div> <!-- end upperheader -->
 +     <!-- masthead content begin -->
 +    <h5 class="hiddenStructure">Sections</h5>    
 +    <div id="nav">
 +      <ul>        
 +      </ul>
 +    </div> <!-- nav -->
 +    <!-- masthead content end -->
 +    </div> <!-- masthead -->
 +   </div>  <!-- mastWrapper -->
 +
 +<div class="visualClear"></div>
 +<div id="contentColumn">
 +<div class="inside">
 +<div id="content" class="">
 +<div class="documentContent" id="region-content">
 +
  
  <p class="hidecss"><a href="#inner">skip the navigation</a></p>
  <div id="pnavbar">
  [% END %]
  </div> <!-- end navbar -->
  
 -</div> <!-- end header -->
 -<div id="outer">
 -<div id="inner">
 -
  [%- IF page_title %]
 -  <h1>[% page_title %]</h1>
 +  <h1 class="documentFirstHeading">[% page_title %]</h1>
    [%- PROCESS 'html/messages.tmpl' -%]
  [% END -%]