Package: dpkg
Version: 1.14.22
Severity: wishlist

The update-alternatives program could be changed to explicitly ignore
errors that happen inside /usr/share/doc, and by extending the spirit of
Policy, it could also explicitly ignore errors in /usr/share/man and
/usr/share/info.  Maybe also /usr/share/locale.

The idea is that files in the three directories are 'optional' and might
or might not be present.  They could have been removed by the sysadmin
to save space, or might have even been filtered out automatically during
installation.

Every package that uses update-alternatives could be changed to ignore
errors for optional files, or update-alternatives could be changed
itself to ignore the errors.

The motivation comes from hacks like localepurge and docpurge (on
Maemo).  And although these programs are hacks, the functionality they
try to provide is good.  I expect dpkg to get support for filters
eventually.

Nobody probably makes alternatives inside /usr/share/locale, but at
least the openssh-client package maintains alternatives for man pages
and it's a real problem when docpurge removes /usr/share/man.

Sooo.  I'll try the following patch in Maemo.  It is probably quite
incomplete.

Index: scripts/update-alternatives.pl
===================================================================
--- scripts/update-alternatives.pl      (revision 16457)
+++ scripts/update-alternatives.pl      (working copy)
@@ -113,6 +113,21 @@ sub quit
     exit(2);
 }
 
+# Same as 'quit', but ignore errors related to documentation.
+#
+sub maybe_quit {
+    my ($file, $msg) = @_;
+    printf STDERR "%s: %s\n", $progname, $msg;
+    if ($file =~ "^/usr/share/man/" ||
+       $file =~ "^/usr/share/info/" ||
+       $file =~ "^/usr/share/doc/")
+    {
+       printf STDERR "%s: ignoring error.\n", $progname;
+    } else {
+       exit (2);
+    }
+}
+
 sub badusage
 {
     printf STDERR "%s: %s\n\n", $progname, "@_";
@@ -705,12 +720,12 @@ sub rename_mv {
 sub checked_symlink {
     my ($filename, $linkname) = @_;
     symlink($filename, $linkname) ||
-       &quit(sprintf(_g("unable to make %s a symlink to %s: %s"), $linkname, 
$filename, $!));
+       &maybe_quit($linkname, sprintf(_g("unable to make %s a symlink to %s: 
%s"), $linkname, $filename, $!));
 }
 sub checked_mv {
     my ($source, $dest) = @_;
     rename_mv($source, $dest) ||
-       &quit(sprintf(_g("unable to install %s as %s: %s"), $source, $dest, 
$!));
+       &maybe_quit($source, sprintf(_g("unable to install %s as %s: %s"), 
$source, $dest, $!));
 }
 sub config_all {
     opendir ADMINDIR, $admindir or die sprintf(_g("Serious problem: %s"), $!);



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

Reply via email to