[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /usr/share/doc (was Re: weekly policy summary)



On Jul 29, Steve Greenland wrote:
> Another option is to provide a package whose job is monitor the
> directories in /usr/doc and /usr/share/doc, and maintain the
> /usr/doc/<pkg> -> /usr/share/doc/<pkg> links as needed. A sysadmin who
> needed/wanted the links could install the package, one who doesn't
> wouldn't. It's admitted slightly more that looping in /usr/doc/share,
> but not a whole lot. It has the advantage of providing the symlinks
> without making each package deal with them. The disadvantage would be
> that the symlinks would be out-of-date between runs, but I bet you could
> run it from cron every hour (probably every 5 minutes!) without serious
> system affect (except that it would spin up the disks on laptops, so
> maybe not every 5 minutes.

It wouldn't spin the disk if it monitored something that is cached.
For example, you could have "debian-doclinkd" monitor
/var/lib/dpkg/status for mtime changes.  This could actually do the
symlinking (perhaps after waiting for /var/lib/dpkg/status's mtime to
stop changing).

Something like (C-like pseudocode; this is damn close to executable
Python code if you drop the braces and use the needed namespace
resolutions and tuple references):

mtime = stat("/var/lib/dpkg/status").st_mtime;
while(1) {
  sleep(60);
  newmtime = stat("/var/lib/dpkg/status").st_mtime;
  if( difftime(mtime, newmtime) ) {
    /* Wait for changes to stop */
    mtime = newmtime;
    while(!difftime(mtime, newmtime)) {
      sleep(60);
      newmtime = stat("/var/lib/dpkg/status").st_mtime;
    }
    for file in glob('/usr/share/doc/*') {
      if(!stat('/usr/doc/'+filepart(file)))
        symlink(file, '/usr/doc/'+filepart(file);
    }
  }
}

It'd run fully when launched, then do nothing (OK, wake up every
minute, stat a file, and go back to sleep) until another package is
installed.

You may be able to select() on a file descriptor to do this too.  It
might be less load on the system that way (although the load of this
code is trivial).

The utility of this package really depends on whether
Standards-Version >= 3.0.0.0 is going to be mandatory for all packages
in potato.


Chris
-- 
=============================================================================
|        Chris Lawrence       |  You have a computer.  Do you have Linux?   |
|   <quango@watervalley.net>  |    http://www.linux-m68k.org/index.html     |
|                             |                                             |
|   Grad Student, Pol. Sci.   |       Do you want your bank to snoop?       |
|  University of Mississippi  |      http://www.defendyourprivacy.com/      |
=============================================================================


Reply to: