Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsb-release: init at 1.4 #14901

Merged
merged 1 commit into from
Apr 23, 2016
Merged

lsb-release: init at 1.4 #14901

merged 1 commit into from
Apr 23, 2016

Conversation

rardiol
Copy link
Contributor

@rardiol rardiol commented Apr 22, 2016

Things done
  • Tested using sandboxing (nix-build --option build-use-chroot true or nix.useChroot on NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This is the lsb_release executable from https://sourceforge.net/projects/lsb/. Should probably be tested from someone on other linux distro.

Even if nixos is deliberately not LSB-compliant, it seems interesting to include this tool .
Making it useful on nixos requires including a /etc/lsb-release and possibly /etc/nixos-release on nixos.

some potentially relevant discussion and info:

http://www.gossamer-threads.com/lists/gentoo/user/110551

http://linux.die.net/man/1/lsb_release

cc @grahamc

@FRidh FRidh added the 8.has: package (new) This PR adds a new package label Apr 22, 2016
@abbradar
Copy link
Member

abbradar commented Apr 23, 2016

FWIW I was attracted by a thought "lsb-release? What? NixOS is not compliant by any means!" but the manual page explicitly has an example of what happens when distribution is not LSB-compatible, so this utility is useful anyway. If I understand correctly, for this to work we would need to have /etc/nixos-release (but no /etc/lsb-release) with some constants defined. Seems OK to me (would simplify detection of us by various scripts, because /etc/*-release file is a de facto standard).

@abbradar abbradar added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Apr 23, 2016
@joachifm
Copy link
Contributor

joachifm commented Apr 23, 2016

Hm, nixpkgs users might want this, regardless of nixos.
(EDIT: so adding lsb-release support to NixOS is a separate issue, IMO)

@abbradar abbradar removed the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Apr 23, 2016
@abbradar
Copy link
Member

Fair enough.

@joachifm joachifm merged commit 4a9ccee into NixOS:master Apr 23, 2016
@vcunat
Copy link
Member

vcunat commented Apr 24, 2016

We do have /etc/os-release on NixOS, but the utility doesn't pick it up:

$ ./result/bin/lsb_release -a
LSB Version:    n/a
Distributor ID: n/a
Description:    (none)
Release:        n/a
Codename:       n/a

But I agree that's a separate issue.

@abbradar
Copy link
Member

abbradar commented Apr 24, 2016

After adding /etc/nixos-release with this text:

NixOS release 16.09.git.56a2384 (Flounder)

It reports:

 nixpkgs git:(master) ✗ result/bin/lsb_release -a
LSB Version:    n/a
Distributor ID: NixOS
Description:    NixOS release 16.09.git.56a2384 (Flounder)
Release:    16.09.git.56a2384
Codename:   Flounder

From what I understand, /etc/os-release is a separate standard by Freedesktop.org sigh. Also we have /etc/NIXOS, empty one.

@abbradar
Copy link
Member

@edolstra do you think it would be useful for us to add /etc/nixos-release to make us discoverable by lsb-release utility (as a non-LSB-compatible distribution)? (asking you because this falls into "core decision" of some kind in my head, albeit a small one) FWIW I don't know of anyone relying on LSB, but I suppose it can be popular in the enterprise world (which I haven't tapped into).

@rardiol
Copy link
Contributor Author

rardiol commented Apr 24, 2016

Note that we don't need to use this specific lsb_release executable if an alternate one that reads /etc/os-release is better.

@abbradar
Copy link
Member

abbradar commented Apr 24, 2016

Oh, indeed... if there is just a version which can parse os-release and is compatible, it would be ideal.

Also lsb_release is not compatible with os-release and it works for us purely by chance because nixos-release is the first file that it finds. Try using it for znixos-release.

@vcunat
Copy link
Member

vcunat commented Apr 24, 2016

Sticking (more closely) to the published (freedesktop) standards is probably better than patching the tools, even if the standards are kinda ad hoc...

@abbradar
Copy link
Member

The problem is that there are two of them (FreeDesktop and lsb_release documentation "standard"), and they are incompatible if I understood correctly D: By "incompatible" I mean that FreeDesktop proposes /etc/os-release and lsb_release(1) expects to find /etc/lsb-release or /etc/*-release for non-LSB-compatible distributions. When it picks /etc/os-release it fails to parse it, and my example above was purely by luck: /etc/nixos-release was returned first by find, looking at the utility's source.

@rardiol rardiol deleted the lsb_release branch May 9, 2016 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants