stdenv: pURL speed optimization

This commit is contained in:
Hans Joachim Kliemeck
2025-10-03 21:19:10 +00:00
committed by d068328
parent c78e6a2359
commit 64a6ca1114
4 changed files with 23 additions and 13 deletions
+6 -1
View File
@@ -424,7 +424,12 @@ lib.extendMkDerivation {
meta = {
# Add default meta information.
platforms = go.meta.platforms or lib.platforms.all;
identifiers.purlParts = finalAttrs.src.meta.identifiers.purlParts or { };
identifiers = {
${if (finalAttrs.src.meta.identifiers.purl or null) != null then "purl" else null} =
finalAttrs.src.meta.identifiers.purl;
${if (finalAttrs.src.meta.identifiers.purls or null) != null then "purls" else null} =
finalAttrs.src.meta.identifiers.purls;
};
}
// meta;
};
@@ -416,7 +416,12 @@ let
# default to python's platforms
platforms = python.meta.platforms;
isBuildPythonPackage = python.meta.platforms;
identifiers.purlParts = attrs.src.meta.identifiers.purlParts or { };
identifiers = {
${if (attrs.src.meta.identifiers.purl or null) != null then "purl" else null} =
attrs.src.meta.identifiers.purl;
${if (attrs.src.meta.identifiers.purls or null) != null then "purls" else null} =
attrs.src.meta.identifiers.purls;
};
}
// meta;
}
@@ -308,7 +308,11 @@ lib.makeOverridable (
};
})
// (lib.optionalAttrs (type == "git") {
identifiers.purlParts = src.meta.identifiers.purlParts or { };
identifiers = {
${if (src.meta.identifiers.purl or null) != null then "purl" else null} = src.meta.identifiers.purl;
${if (src.meta.identifiers.purls or null) != null then "purls" else null} =
src.meta.identifiers.purls;
};
})
// meta;
}
+6 -10
View File
@@ -605,12 +605,6 @@ let
})
tryCPEPatchVersionInUpdateWithVendor
];
hasAllPURLParts =
purlParts:
let
values = attrValues purlParts;
in
(length values == 2) && !any isNull values;
# The meta attribute is passed in the resulting attribute set,
# but it's not part of the actual derivation, i.e., it's not
@@ -718,14 +712,16 @@ let
) possibleCPEPartsFuns;
purlParts = attrs.meta.identifiers.purlParts or { };
purl = if hasAllPURLParts purlParts then "pkg:${purlParts.type}/${purlParts.spec}" else null;
purls = optional (purl != null) purl;
purl =
attrs.meta.identifiers.purl or (
if purlParts ? type && purlParts ? spec then "pkg:${purlParts.type}/${purlParts.spec}" else null
);
purls = attrs.meta.identifiers.purls or (optional (purl != null) purl);
v1 = {
inherit
cpeParts
possibleCPEs
purlParts
purls
;
${if cpe != null then "cpe" else null} = cpe;
@@ -734,7 +730,7 @@ let
in
v1
// {
inherit v1;
inherit v1 purlParts;
};
# Expose the result of the checks for everyone to see.