Author: jfs
Date: Tue Jan 11 22:44:51 2011
New Revision: 8104

URL: http://svn.debian.org/wsvn/?sc=1&rev=8104
Log:
Changes to adapt to the new structure generated by  manpage-extractor.pl:

    - Change how the Packages file is parsed to also obtain the filename from 
the file
    - Use the filename to define where in the pool is the package and use that 
to
      define where to symlink from


Modified:
    man-cgi/extractor/files-release.pl

Modified: man-cgi/extractor/files-release.pl
URL: 
http://svn.debian.org/wsvn/man-cgi/extractor/files-release.pl?rev=8104&op=diff
==============================================================================
--- man-cgi/extractor/files-release.pl (original)
+++ man-cgi/extractor/files-release.pl Tue Jan 11 22:44:51 2011
@@ -7,6 +7,7 @@
 
 use strict;
 use Getopt::Std;
+use File::Basename;
 # Options:
 # -d = debug
 # -m dir     = use mirror directory 'dir'
@@ -65,12 +66,16 @@
         print "Creating directories for $release...";
        mkdir $manpages_dists."/".$release if ! -d $manpages_dists."/".$release;
        foreach my $package ( keys(%{$packages{$release}}) ) {
+               my $filename= retrieve_filename($packages{$release}{$package});
                my $version= retrieve_version($packages{$release}{$package});
-               if ( -e $manpages_files."/".$package."_".$version ) {
+               my $location=  dirname($filename);
+               $location =~ s|^.*pool/||
+               my $packagedir = 
$manpages_files."/".$location."/".$package."_".$version;
+               if ( -e "$packagedir" ) {
                     # For each directory, create, for each file
                     # symlink
-                    print STDERR "Symlink 
${manpages_files}/${package}_${version}\n" if $debug;
-                    replicate_dirs($manpages_dists."/".$release, 
$manpages_files."/".$package."_".$version);
+                    print STDERR "Symlinking from $packagedir\n" if $debug;
+                    replicate_dirs($manpages_dists."/".$release, $packagedir);
                }
        }
         print "..done\n";
@@ -112,7 +117,7 @@
             if ( -e $dstdir."/".$content ) {
                 unlink $dstdir."/".$content || die ("Cannot remove old file 
$dstdir/$content: $!");
             }
-            symlink $srcdir."/".$content, $dstdir."/".$content || die ("Cannot 
linke to new file $dstdir/$content: $! ");
+            symlink $srcdir."/".$content, $dstdir."/".$content || die ("Cannot 
link to new file $dstdir/$content: $! ");
         }
         # TODO: Should we do anything with other files?, probably not
 
@@ -126,10 +131,20 @@
        my ($text)=...@_;
        print "Extracting version from $text\n" if $debug;
        my $retversion="unknown";
-       if ( $text =~ /^.*{(.*?)}$/ ){
+       if ( $text =~ /^.*{(.*?)}/ ){
                $retversion=$1;
        } 
        return $retversion;
+}
+sub retrieve_filename {
+# Retrieves the filename info from the text
+       my ($text)=...@_;
+       print "Extracting location from $text\n" if $debug;
+       my $retf="unknown";
+       if ( $text =~ /^.*} loc:(.*?)$/ ){
+               $retf=$1;
+       } 
+       return $retf;
 }
 sub retrieve_text {
 # Retrieves the description info from the text
@@ -152,15 +167,16 @@
 # 0 - no package
 # 1 - package name read
 # 2 - version read
-# 3 - package description read
+# 3 - pool filename location read
+# 4 - package description read
        my $state=0;
        my $packagename="";
        my $description="";
        my $version="";
        while (<FILE>) {
                chomp;
-               if ( $state == 3 && /^$/ ){
-                       
$packages{$release}{$packagename}=$description."{".$version."}";
+               if ( $state == 4 && /^$/ ){
+                       
$packages{$release}{$packagename}=$description."{".$version."} loc:".$filename";
                        print "Found $packagename: $description ($version)\n" 
if $debug;
                        $state=0;
                }
@@ -168,8 +184,12 @@
 # Package that does not comply the state-machine
                        $state=0;
                }
-               if ( $state == 2 && /^Description: (.*)$/ ){
+               if ( $state == 3 && /^Description: (.*)$/ ){
                        $description=$1;
+                       $state=4;
+               }
+               if ( $state == 2 && /^Filename: (.*)$/ ){
+                       $filename=$1;
                        $state=3;
                }
                if ( $state == 1 && /^Version: (.*)$/ ){


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to