Author: guillem
Date: 2006-05-04 04:38:12 +0000 (Thu, 04 May 2006)
New Revision: 271

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/scripts/install-info.pl
Log:
Make install-info '--dir-file' option compatible with GNU install-info
by renaming the infodir variable to dirfile and not appending the
'/dir' string except when initializing from '--info-dir' or
'--infodir' (Wayne Davison). Closes: #61640, #67237, #286275


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2006-05-04 04:03:34 UTC (rev 270)
+++ trunk/ChangeLog     2006-05-04 04:38:12 UTC (rev 271)
@@ -1,3 +1,11 @@
+2006-05-04  Wayne Davison <[EMAIL PROTECTED]>,
+            Guillem Jover  <[EMAIL PROTECTED]>
+
+       * scripts/install-info.pl: Make '--dir-file' option compatible
+       with GNU install-info by renaming the infodir variable to dirfile
+       and not appending the '/dir' string except when initializing from
+       '--info-dir' or '--infodir'.
+
 2006-05-04  Guillem Jover  <[EMAIL PROTECTED]>
 
        * scripts/dpkg-gencontrol.pl: Use the source:Version substvar when

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-05-04 04:03:34 UTC (rev 270)
+++ trunk/debian/changelog      2006-05-04 04:38:12 UTC (rev 271)
@@ -42,6 +42,10 @@
   * Split usage strings to make it easier for translators when those change.
     Closes: #323957
   * Standarize start-stop-daemon usage output format.
+  * Make install-info '--dir-file' option compatible with GNU install-info
+    by renaming the infodir variable to dirfile and not appending the
+    '/dir' string except when initializing from '--info-dir' or
+    '--infodir' (Wayne Davison). Closes: #61640, #67237, #286275
 
  -- Jacobo Tarrio <[EMAIL PROTECTED]>  Wed,  3 May 2006 11:50:59 +0200
 

Modified: trunk/scripts/install-info.pl
===================================================================
--- trunk/scripts/install-info.pl       2006-05-04 04:03:34 UTC (rev 270)
+++ trunk/scripts/install-info.pl       2006-05-04 04:38:12 UTC (rev 271)
@@ -2,7 +2,6 @@
 
 use Text::Wrap;
 
-# fixme: --dirfile option
 # fixme: sort entries
 # fixme: send to FSF ?
 
@@ -23,13 +22,13 @@
              [--section regexp title] [--infodir=xxx] [--align=nnn]
              [--calign=nnn] [--quiet] [--menuentry=xxx] [--info-dir=xxx]
              [--keep-old] [--description=xxx] [--test]
-             [--remove | --remove-exactly ] [--dir-file]
+             [--remove | --remove-exactly ] [--dir-file=xxx]
              [--]
              filename
 END
 }
 
-$infodir='/usr/share/info';
+$dirfile = '/usr/share/info/dir';
 $maxwidth=79;
 $Text::Wrap::columns=$maxwidth;
 $backup='/var/backups/infodir.bak';
@@ -80,18 +79,16 @@
         $sectiontitle= shift(@ARGV);
     } elsif (m/^--(c?align|maxwidth)=([0-9]+)$/) {
        warn( "$name: $1 deprecated(ignored)\n" );
-    } elsif (m/^--infodir=/) {
-        $infodir=$';
+    } elsif (m/^--info-?dir=/) {
+       $dirfile = $' . '/dir';
     } elsif (m/^--info-file=/) {
         $filename=$';
     } elsif (m/^--menuentry=/) {
         $menuentry=$';
-    } elsif (m/^--info-dir=/) {
-        $infodir=$';
     } elsif (m/^--description=/) {
         $description=$';
     } elsif (m/^--dir-file=/) { # for compatibility with GNU install-info
-       $infodir=$';
+       $dirfile = $';
     } else {
         print STDERR "$name: unknown option \`$_'\n"; &usage(STDERR); exit 1;
     }
@@ -124,7 +121,9 @@
 # The location of the info files from the dir entry, i.e. (emacs-20/emacs).
 my $fileinentry;
 
-&dprint("infodir='$infodir'  filename='$filename'  
maxwidth='$maxwidth'\nmenuentry='$menuentry'  
basename='$basename'\ndescription='$description'  remove=$remove");
+&dprint("dirfile='$dirfile' filename='$filename' maxwidth='$maxwidth'");
+&dprint("menuentry='$menuentry' basename='$basename'");
+&dprint("description='$description' remove=$remove");
 
 if (!$remove) {
 
@@ -250,21 +249,21 @@
     }
 }
 
-if (!$nowrite && ( ! -e "$infodir/dir" || ! -s "$infodir/dir" )) {
+if (!$nowrite && ( ! -e $dirfile || ! -s _ )) {
     if (-r $backup) {
-       print STDERR "$name: no file $infodir/dir, retrieving backup file 
$backup.\n";
-       if (system ("cp $backup $infodir/dir")) {
-           print STDERR "$name: copying $backup to $infodir/dir failed, giving 
up: $!\n";
+       print STDERR "$name: no file $dirfile, retrieving backup file 
$backup.\n";
+       if (system ("cp $backup $dirfile")) {
+           print STDERR "$name: copying $backup to $dirfile failed, giving up: 
$!\n";
            exit 1;
        }
     } else {
         if (-r $default) {
            print STDERR "$name: no backup file $backup available, retrieving 
default file.\n";
            
-           if (system("cp $default $infodir/dir")) {
-               print STDERR "$name: copying $default to $infodir/dir failed, 
giving up: $!\n";
-       exit 1;
-    }
+           if (system("cp $default $dirfile")) {
+               print STDERR "$name: copying $default to $dirfile failed, 
giving up: $!\n";
+               exit 1;
+           }
        } else {
            print STDERR "$name: no backup file $backup available.\n";
            print STDERR "$name: no default file $default available, giving 
up.\n";
@@ -273,15 +272,15 @@
     }
 }
 
-if (!$nowrite && !link("$infodir/dir","$infodir/dir.lock")) {
+if (!$nowrite && !link($dirfile, "$dirfile.lock")) {
     print STDERR "$name: failed to lock dir for editing! $!\n".
-        ($! =~ m/exists/i ? "try deleting $infodir/dir.lock ?\n" : '');
+        ($! =~ m/exists/i ? "try deleting $dirfile.lock ?\n" : '');
 }
 
-open(OLD,"$infodir/dir") || &ulquit("open $infodir/dir: $!");
+open(OLD, $dirfile) || &ulquit("open $dirfile: $!");
 @work= <OLD>;
-eof(OLD) || &ulquit("read $infodir/dir: $!");
-close(OLD) || &ulquit("close $infodir/dir after read: $!");
+eof(OLD) || &ulquit("read $dirfile: $!");
+close(OLD) || &ulquit("close $dirfile after read: $!");
 while (($#work >= 0) && ($work[$#work] !~ m/\S/)) { $#work--; }
 
 while (@work) {
@@ -443,22 +442,22 @@
 }
 
 if (!$nowrite) {
-    open(NEW,"> $infodir/dir.new") || &ulquit("create $infodir/dir.new: $!");
-    print(NEW @head,join("\n",@newwork)) || &ulquit("write $infodir/dir.new: 
$!");
-    close(NEW) || &ulquit("close $infodir/dir.new: $!");
+    open(NEW, "> $dirfile.new") || &ulquit("create $dirfile.new: $!");
+    print(NEW @head, join("\n", @newwork)) || &ulquit("write $dirfile.new: 
$!");
+    close(NEW) || &ulquit("close $dirfile.new: $!");
 
-    unlink("$infodir/dir.old");
-    link("$infodir/dir","$infodir/dir.old") ||
-        &ulquit("cannot backup old $infodir/dir, giving up: $!");
-    rename("$infodir/dir.new","$infodir/dir") ||
-        &ulquit("install new $infodir/dir: $!");
-unlink("$infodir/dir.lock") || die "$name: unlock $infodir/dir: $!\n";
-system ("cp $infodir/dir $backup") && warn "$name: couldn't backup 
$infodir/dir in $backup: $!\n";
+    unlink("$dirfile.old");
+    link($dirfile, "$dirfile.old") ||
+        &ulquit("cannot backup old $dirfile, giving up: $!");
+    rename("$dirfile.new", $dirfile) ||
+        &ulquit("install new $dirfile: $!");
+    unlink("$dirfile.lock") || die "$name: unlock $dirfile: $!\n";
+    system ("cp $dirfile $backup") && warn "$name: couldn't backup $dirfile in 
$backup: $!\n";
 }
 
 sub ulquit {
-    unlink("$infodir/dir.lock") ||
-        warn "$name: warning - unable to unlock $infodir/dir: $!\n";
+    unlink("$dirfile.lock") ||
+        warn "$name: warning - unable to unlock $dirfile: $!\n";
     die "$name: $_[0]\n";
 }
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to