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

Print license information on '--xml --meta' #712

Merged
merged 1 commit into from
Nov 25, 2015

Conversation

pSub
Copy link
Member

@pSub pSub commented Nov 21, 2015

The nixpkgs manual prescribes the use of values from stdenv.lib.licenses
for the meta.license attribute. Those values are attribute sets and
currently skipped when running nix-env with '--xml --meta'. This has the
consequence that also nixpkgs-lint will report missing licenses.

With this commit nix-env with '--xml --meta' will print all attributes
of an attribute set that are of type tString. For example the output for
the package nixpkgs.hello is

<meta name="license" type="strings">
  <string type="url" value="http://spdx.org/licenses/GPL-3.0+" />
  <string type="shortName" value="gpl3Plus" />
  <string type="fullName" value="GNU General Public License v3.0 or later" />
  <string type="spdxId" value="GPL-3.0+" />
</meta>

This commit fixes nixpkgs-lint, too.

Closes #288, NixOS/nixpkgs#9966 and is also relevant for the "automatic linter" mentioned in NixOS/nixpkgs#11166.

The nixpkgs manual prescribes the use of values from stdenv.lib.licenses
for the meta.license attribute. Those values are attribute sets and
currently skipped when running nix-env with '--xml --meta'. This has the
consequence that also nixpkgs-lint will report missing licenses.

With this commit nix-env with '--xml --meta' will print all attributes
of an attribute set that are of type tString. For example the output for
the package nixpkgs.hello is

    <meta name="license" type="strings">
      <string type="url" value="http://spdx.org/licenses/GPL-3.0+" />
      <string type="shortName" value="gpl3Plus" />
      <string type="fullName" value="GNU General Public License v3.0 or later" />
      <string type="spdxId" value="GPL-3.0+" />
    </meta>

This commit fixes nixpkgs-lint, too.
pSub referenced this pull request in NixOS/nixpkgs Nov 21, 2015
…icenses

The nix-env query example which previously used --meta --xml has been
changed to use --json so that the license metadata is included, see
NixOS/nix#288 . Catch-all licenses have also been added to
lib/licenses.nix since they may still be useful.

See also: #2999
edolstra added a commit that referenced this pull request Nov 25, 2015
Print license information on '--xml --meta'
@edolstra edolstra merged commit afef347 into NixOS:master Nov 25, 2015
@edolstra
Copy link
Member

Thanks, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stdenv.lib.licenses is not shown in a query with --meta --xml options
2 participants