From 19deb0f1c4a0fa1477f07fdd8dc6816f6a04a334 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Fri, 14 Dec 2007 23:47:03 +0000 Subject: * Convert docs to be directly viewable with a browser (and not use content negotiation). * Add doc-base entry for the documentation git-svn-id: svn+ssh://svn.debian.org/svn/pkg-apache/trunk/apache2@504 01b336ce-410b-0410-9a02-a0e7f243c266 --- debian/README.Debian | 7 ++- debian/apache2-doc.conf | 16 +------ debian/apache2-doc.dirs | 1 - debian/apache2-doc.doc-base | 10 ++++ debian/apache2-doc.lintian-overrides | 2 - debian/changelog | 8 ++++ debian/convert_docs | 93 ++++++++++++++++++++++++++++++++++++ debian/rules | 11 ++++- 8 files changed, 128 insertions(+), 20 deletions(-) create mode 100644 debian/apache2-doc.doc-base delete mode 100644 debian/apache2-doc.lintian-overrides create mode 100755 debian/convert_docs diff --git a/debian/README.Debian b/debian/README.Debian index 1680df8c..6b0bd815 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -126,7 +126,10 @@ The full apache 2 documentation can be found on the web at http://httpd.apache.org/docs/2.2/ -or, if you have installed the apache2-doc package, at +or, if you have installed the apache2-doc package, in -http://localhost/manual/ +/usr/share/doc/apache2-doc/manual/ + +or at +http://localhost/manual/ diff --git a/debian/apache2-doc.conf b/debian/apache2-doc.conf index 7ddfb95e..f4757557 100644 --- a/debian/apache2-doc.conf +++ b/debian/apache2-doc.conf @@ -1,22 +1,10 @@ -AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|pt-br|ru))?(/.*)?$ "/usr/share/doc/apache2-doc/manual/$1" -AliasMatch ^/apache2-default/manual(?:/(?:de|en|es|fr|ja|ko|pt-br|ru))?(/.*)?$ "/usr/share/doc/apache2-doc/manual/$1" -RedirectMatch ^/doc/apache2-doc/manual/(.*) /manual/$1 +Alias /manual /usr/share/doc/apache2-doc/manual/ - Options Indexes + Options Indexes FollowSymlinks AllowOverride None Order allow,deny Allow from all AddDefaultCharset off - - - SetHandler type-map - - - SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|pt-br|ru)/ prefer-language=$1 - RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|pt-br|ru)){2,}(/.*)?$ /manual/$1$2 - - LanguagePriority en de es fr ja ko pt-br ru - ForceLanguagePriority Prefer Fallback diff --git a/debian/apache2-doc.dirs b/debian/apache2-doc.dirs index 2321c207..fbb9affe 100644 --- a/debian/apache2-doc.dirs +++ b/debian/apache2-doc.dirs @@ -1,4 +1,3 @@ etc/apache2/conf.d usr/share/doc/apache2-doc var/www/apache2-default -usr/share/lintian/overrides diff --git a/debian/apache2-doc.doc-base b/debian/apache2-doc.doc-base new file mode 100644 index 00000000..8c06147d --- /dev/null +++ b/debian/apache2-doc.doc-base @@ -0,0 +1,10 @@ +Document: apache2-manual +Title: Apache HTTP Server Version 2.2 Documentation +Abstract: This documentation describes the configuration of the Apache Web + server and the included modules. +Section: web + +Format: HTML +Index: /usr/share/doc/apache2-doc/manual/en/index.html +Files: /usr/share/doc/apache2-doc/manual/*/*.html + /usr/share/doc/apache2-doc/manual/*/*/*.html diff --git a/debian/apache2-doc.lintian-overrides b/debian/apache2-doc.lintian-overrides deleted file mode 100644 index 32540bdc..00000000 --- a/debian/apache2-doc.lintian-overrides +++ /dev/null @@ -1,2 +0,0 @@ -apache2-doc: extra-license-file usr/share/doc/apache2-doc/manual/license.html.en -apache2-doc: extra-license-file usr/share/doc/apache2-doc/manual/LICENSE.gz diff --git a/debian/changelog b/debian/changelog index 2d45e519..d1f718e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apache2 (2.2.6-4) UNRELEASED; urgency=low + + * Convert docs to be directly viewable with a browser (and not use content + negotiation). + * Add doc-base entry for the documentation (closes: #311269) + + -- Stefan Fritsch Sat, 15 Dec 2007 00:16:20 +0100 + apache2 (2.2.6-3) unstable; urgency=low * Allocate fewer bucket brigades in case of a flush bucket. This might help diff --git a/debian/convert_docs b/debian/convert_docs new file mode 100755 index 00000000..906fa36d --- /dev/null +++ b/debian/convert_docs @@ -0,0 +1,93 @@ +#!/usr/bin/perl -w + +use strict; +use File::Path; +use Fatal qw/mkpath symlink open close/; + +scalar @ARGV == 2 or die; + +my $SRC=$ARGV[0]; +my $TGT=$ARGV[1]; + +# list of languages +my @lang = glob("$SRC/index.html.*") or die; +map { s{^.*html\.}{} } @lang; + +# map "ja.euc-jp" to "ja/", ... +my %lpath; +foreach my $l (@lang) { + my $t=$l; + $t =~ s{\..*$}{}; + $lpath{$l}="$t/"; +} + + +my @html=`find $SRC -name *.html` or die; +chomp(@html); +map { s{^$SRC/}{} } @html; + +foreach my $h (@html) { + my $dir=""; + if ($h =~ m{^(.*/)}) { + $dir=$1; + } + + for my $l (@lang) { + my $tdir="$TGT/$lpath{$l}"; + -d "$tdir$dir" || mkpath("$tdir$dir"); + + my $updir=$dir; + $updir =~ s{[^/]+}{..}g; + + if ($l eq "en") { + conv("$SRC/$h.en", "$tdir$h", $h); + } + elsif ( -f "$SRC/$h.$l" ) { + conv("$SRC/$h.$l", "$tdir$h", $h); + } + else { + symlink("${updir}../en/$h", "$tdir$h"); + } + + } +} + +open(my $out, ">", "$TGT/index.html"); +print $out '', + '', + "\n\n"; +foreach my $l (sort values %lpath) { + print $out qq{\n}; +} +print $out '
$l
'; + + +### END + + +sub conv { + my ($old, $new, $name) = @_; + + open(my $in, "<", $old); + local $/; + my $file = <$in>; + close($in); + + # /mod/ -> /mod/index.html + $file =~ s{href="([^:"]*/)"}{href="${1}index.html"}g; + + # style and images now one level up + $file =~ s{(src|href)="../(style|images)}{$1="../../$2}g; + $file =~ s{(src|href)="./(style|images)}{$1="../$2}g; + + foreach my $l (values %lpath) { + # language directories one level up + $file =~ s{href="\.\./$l}{href="../../$l}g; + $file =~ s{href="\./$l}{href="../$l}g; + } + + + open(my $out, ">", $new); + print $out $file; + close($out); +} diff --git a/debian/rules b/debian/rules index 91d0428a..7bcbdb82 100755 --- a/debian/rules +++ b/debian/rules @@ -183,8 +183,17 @@ install: build install-worker install-prefork install-common install-dev install cp debian/bash_completion debian/apache2.2-common/etc/bash_completion.d/apache2.2-common cp debian/apache2-doc.conf debian/apache2-doc/etc/apache2/conf.d/apache2-doc - install -m644 debian/apache2-doc.lintian-overrides debian/apache2-doc/usr/share/lintian/overrides/apache2-doc grep -rl apachectl debian/apache2-doc/usr/share/doc/apache2-doc/manual | xargs perl -p -i -e 's/apachectl(?!\.html)/apache2ctl/g' + # remove content negotiation + mv debian/apache2-doc/usr/share/doc/apache2-doc/manual \ + debian/apache2-doc/usr/share/doc/apache2-doc/manual.orig + perl debian/convert_docs debian/apache2-doc/usr/share/doc/apache2-doc/manual.orig \ + debian/apache2-doc/usr/share/doc/apache2-doc/manual + mv debian/apache2-doc/usr/share/doc/apache2-doc/manual.orig/images \ + debian/apache2-doc/usr/share/doc/apache2-doc/manual.orig/style \ + debian/apache2-doc/usr/share/doc/apache2-doc/manual + rmdir debian/apache2-doc/usr/share/doc/apache2-doc/manual/style/lang + rm -r debian/apache2-doc/usr/share/doc/apache2-doc/manual.orig #apache2-utils extras cp support/check_forensic debian/apache2-utils/usr/sbin/check_forensic -- cgit v1.2.3