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

Bug#701477: lintian: Should it support XDG?



Package: lintian
Version: 2.5.11
Severity: wishlist

There was a suggestion in #d-mentors about Lintian supporting the XDG
specification for data files and config files[1].  The main argument
was (AFAICT) to avoid cluttering $HOME with dot files.  Personally, I
have no strong feelings either way.  Only that if we do this, we should
do it before releasing 2.5.12[2].

A quick summary, XDG defines 4 types paths:
 * config (lintianrc)
 * data (profiles/, data/, vendors/, lib/, checks/)
 * cache (not relevant to lintian)
 * runtime dir (... also not relevant, unless "lintiand" becomes a thing)

The files/dirs listed in parentheses are the files/dirs /I/ believe
falls into the given category.

For comparison, here are the default search paths:

 * lintianrc (ignoring $LINTIAN_ROOT/lintianrc for a moment):
   NOW: $HOME/.lintian/rc:/etc/lintianrc
   XDG: $HOME/.config/lintianrc:/etc/xdg/lintianrc

 * user/sys data (profiles, vendor data files etc.):
   NOW: $HOME/.lintian/<DIR>:/etc/lintian/<DIR>:/usr/share/lintian/<DIR>
   XDG: $HOME/.local/share/lintian/<DIR>:/usr/local/share/lintian/<DIR>:\
        /usr/share/lintian/<DIR>

Note the lintianrc file currently is special cased to prefer
$LINTIAN_ROOT/lintianrc above all other paths.  It seems a bit weird,
but I suspect it was once relevant for the reporting on lintian.d.o
(it isn't anymore AFAICT[3]).
  To be honest, I would be in favour of simply removing the
LINTIAN_ROOT/lintianrc case unless there is still a use for it, which
I simply missed (regardless of whether we adopt XDG or not).


There are also a couple of cases/ cmd options to consider though:
 * --include-dir <dir>
   - I suggest inserting <dir> between the $HOME/.local/share and
     /usr/local/share/lintian
 * --no-user-dirs
   - Ignore all XDG specified directories and only use $LINTIAN_ROOT plus
     "--include-dir"-directories.
 * --cfg, --no-cfg (and LINTIAN_CFG)
   - Unchanged (i.e. overrule the search dirs).
 * LINTIAN_ROOT vs XDG_DATA_DIRS
   - Current LINTIAN_ROOT is always last in the search dir.  I have no
     intention of changing that.  Though with $XDG_DATA_DIRS,
     /usr/share/lintian could appear earlier than last.  I suggest we
     handle that XDG_DATA_DIRS similar to dirs passed via --include-dirs


... and finally, time for the big pink elephant in the corner,
backwards compatibility.  At the very least, we should stil check
~/.lintianrc and /etc/lintianrc as they are widely used now.  I am not
too sure how "used" ~/.lintian and /etc/lintian are - though keeping
it will probably not be a huge headache for now.

Including compatibility, I envision we have the following search path
for config files:

  $XDG_CONFIG_HOME/lintianrc
    (default: $HOME/.config/lintianrc)
  $HOME/.lintianrc *
  $XDG_CONFIG_DIRS/lintianrc  (shipped conffile)
    (default: /etc/xdg/lintianrc)
  /etc/lintianrc *

... and for "data":

  $XDG_DATA_HOME/lintian
    (default: $HOME/.local/share/lintian)
  $HOME/.lintian *
  /etc/lintian *
  $XDG_DATA_DIRS/lintian
    (default: /usr/local/share/lintian:/usr/share/lintian)
  LINTIAN_ROOT
    (default: /usr/share/lintian)

(entries marked with * are compatibility locations)


Jakub, I know you have an opinion on less clutter in $HOME.  If you
want this, you get the "privilege" of helping me get this right!

~Niels

[1] http://standards.freedesktop.org/basedir-spec/latest/ar01s03.html

Perl module support available from libfile-basedir-perl:
  http://search.cpan.org/dist/File-BaseDir/lib/File/BaseDir.pm

[2] Because 2.5.12 will start using "~/.lintian" to a much higher
degree than previous releases.

[3] The config file must be set via the harness config and is passed
with LINTIAN_CFG, so the search path is not used.


Reply to: