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

Bug#914287: lsb-release: please parse /usr/lib/os-release and deprecate /etc/lsb-release



Package: lsb-release
Version: 9.20170808
Severity: wishlist

Debian's Python implementation of the LSB-standardized lsb_release
command parses various sources of data, including the non-standardized
configuration file /etc/lsb-release. That file doesn't exist in Debian,
but is typically shipped in base-files by derivatives. It is not "API"
itself, although packages designed for Ubuntu sometimes treat it as
though it was.

systemd defines a new "API", which has been adopted in Debian even
for non-systemd systems: the /usr/lib/os-release file (formerly
/etc/os-release, which is now a symlink). This "API" is defined in terms
of parsing a text file, not running a Python program, so it's much faster
to use.

If lsb_release looked at /usr/lib/os-release, then derivatives could edit
that file and /etc/dpkg/origins/default (which they need to do anyway)
and wouldn't usually need to add /etc/lsb-release. /usr/lib/os-release
uses the same subset of shell syntax as /etc/lsb-release.

The fields are:

lsb_release -r, --release: e.g. "9.6"
    /etc/lsb-release DISTRIB_RELEASE

    This appears to be os-release's optional VERSION_ID (not VERSION,
    for which the example given in the man page includes a Fedora release
    codename as well as the bare version number), except that stretch's
    os-release just says "9", not "9.6". For the sorts of uses people
    make of lsb_release (for example gating features that should only be
    enabled in newer Debian), I think it would probably make most sense
    for this to be 10 for the whole lifetime of buster, ignoring point
    releases?  Or it could preferentially come from /etc/debian_version,
    which would retain the minor version.

lsb_release -c, --codename: e.g. "stretch"
    /etc/lsb-release DISTRIB_CODENAME

    This is exactly os-release's optional VERSION_CODENAME.

lsb_release -i, --id: e.g. "Debian" or "Ubuntu"
    /etc/lsb-release DISTRIB_ID
    /etc/dpkg/origins/default Vendor

    There is no direct equivalent in os-release (ID is "debian", NAME is
    "Debian GNU/Linux", neither of which matches) but /etc/dpkg/origins
    should be sufficient to not need /etc/lsb-release; using os-release
    ID, possibly transformed to title-case, might be a good fallback.

lsb_release -d, --description: e.g. "Debian GNU/Linux 9.6 (stretch)"
    /etc/lsb-release DISTRIB_DESCRIPTION
    Fallback is "${ID} ${OS} ${RELEASE} (${CODENAME})"

    os-release PRETTY_NAME looks suitable for this. It can include the
    OS vendor, version number and/or codename. One difference is that
    stretch has PRETTY_NAME="Debian GNU/Linux 9 (stretch)", without the
    9.6; but I don't think that's a very important distinction, so it
    might make most sense for $(lsb_release -ds) in the buster release
    to be "Debian GNU/Linux 10 (buster)" across all point releases.

Regards,
    smcv


Reply to: