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

check meta, treewide #32365

Merged
merged 3 commits into from
Dec 12, 2017
Merged

check meta, treewide #32365

merged 3 commits into from
Dec 12, 2017

Conversation

vcunat
Copy link
Member

@vcunat vcunat commented Dec 5, 2017

Plan:

?: add into the tarball job, simple pre-push hook for direct pushers, more meta checks, ...

Sorry, something went wrong.

@vcunat vcunat added 0.kind: enhancement Add something new 8.has: clean-up 9.needs: port to stable A PR needs a backport to the stable release. labels Dec 5, 2017
@vcunat vcunat requested review from edolstra and FRidh as code owners December 5, 2017 23:23
@vcunat
Copy link
Member Author

vcunat commented Dec 5, 2017

/cc @grahamc.

@vcunat
Copy link
Member Author

vcunat commented Dec 5, 2017

and /cc @copumpkin who started checkMeta.

@vcunat
Copy link
Member Author

vcunat commented Dec 5, 2017

For now I used nix-env -f checkMeta.nix -qa --no-name --out-path --show-trace >/dev/null with some code adapted from rebuild-amount.sh.

@7c6f434c
Copy link
Member

7c6f434c commented Dec 5, 2017

For some weird GitHub bug I cannot leave a line comment; wouldn't it be more consistent to also add the current platform to the message for Parallels tools?

I guess perfect consistency w.r.t. system/platform and colon/no-colon is too annoying to ensure across all the changes (for little gain).

In general looks good, but not sure if GitHub hides some part of diff because it is too large…

@@ -5,15 +5,15 @@ stdenv.mkDerivation {
builder = ./builder.sh;

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2006_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2006_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one isn't right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, aangifte-* were the only not done fully manually and they got wrong without me noticing :-/

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 5, 2017
Copy link
Member

@grahamc grahamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great other than these very minor issues :)

@@ -5,7 +5,7 @@ stdenv.mkDerivation {
builder = ./builder.sh;

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2007_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2007_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -6,7 +6,7 @@ stdenv.mkDerivation {
builder = ./builder.sh;

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2008_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2008_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2009-1";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2009_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2009_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2010-1";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2010_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2010_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2011-1";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2011_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2011_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2012-1";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2012_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2012_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2013-wa";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/wa2013_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/wa2013_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2013-1";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2013_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2013_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2014-wa";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/wa2014_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/wa2014_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

@@ -4,7 +4,7 @@ stdenv.mkDerivation {
name = "aangifte2014-1";

src = fetchurl {
url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2014_linux.tar.gz;
homepage = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2014_linux.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url / homepage confusion

Copy link
Member

@grahamc grahamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I don't fully grok the implications around abort vs. throw but I strongly approve of this!

@vcunat
Copy link
Member Author

vcunat commented Dec 5, 2017

We could add something like stdenv.throwSystem or frameworkize this in some other way :-)

@grahamc grahamc mentioned this pull request Dec 6, 2017
8 tasks
@@ -126,7 +126,7 @@ let
'';

throwEvalHelp = { reason , errormsg ? "" }:
throw (''
(if reason != "unknown-meta" then throw else (x : builtins.trace x true)) (''
Copy link
Member

@grahamc grahamc Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be tempted to make this configurable so we can highlight or ignore certain conditions depending on what we're testing for:

updated

diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 03a85633ed6..6e97ca7534d 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -125,11 +125,17 @@ let
 
       '';
 
-  throwEvalHelp = { reason , errormsg ? "" }:
-    throw (''
-      Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate.
+  handleEvalIssue = { reason , errormsg ? "" }:
+    let
+      msg = ''
+        Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate.
 
-      '' + ((builtins.getAttr reason remediation) attrs));
+      '' + (builtins.getAttr reason remediation) attrs;
+
+      handler = if config ? "handleEvalIssue"
+        then config.handleEvalIssue reason
+        else throw;
+    in handler msg;
 
   metaTypes = with lib.types; rec {
     # These keys are documented
@@ -192,7 +198,7 @@ let
   validityCondition =
          let v = checkValidity attrs;
          in if !v.valid
-           then throwEvalHelp (removeAttrs v ["valid"])
+           then handleEvalIssue (removeAttrs v ["valid"])
            else true;
 
 in

usage:

          handleEvalIssue = reason: errormsg:
            if reason == "unknown-meta"
              then abort errormsg
              else builtins.trace errormsg true;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we play our cards right, we could take evaluation aborted with the following error message: ‘Package ‘aangifte2006-1’ in /home/grahamc/projects/nixpkgs/pkgs/applications/taxes/aangifte-2006/default.nix:15 has an invalid meta attrset: parse the path an line, and leave in-line feedback on PRs..........

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also tempted by this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think this will be a good way to clean https://hydra.nixos.org/jobset/nixpkgs/trunk#tabs-errors 👍

@oxij
Copy link
Member

oxij commented Dec 6, 2017 via email

vcunat and others added 3 commits December 12, 2017 18:07

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
- tracing seems annoying enough
- we get errors for all packages instead of aborting on the first one
- easier to differentiate from unwanted packages (broken, unfree, etc.)
They aren't meant to be critical (uncatchable) errors.
Tested with nix-env + checkMeta:
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux and removed 10.rebuild-linux: 1-10 labels Dec 12, 2017
@grahamc grahamc merged commit e5629dc into NixOS:master Dec 12, 2017
@vcunat vcunat deleted the p/check-meta branch December 16, 2017 09:29
@samueldr samueldr removed the 9.needs: port to stable A PR needs a backport to the stable release. label Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement Add something new 8.has: clean-up 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants