Fix parsing of new apt package list for oneapi 2023

New apt list does not have Package: as the first entry for all packages
This commit is contained in:
Aleix Boné 2025-05-15 15:48:37 +02:00
parent 684e290a38
commit f8f3811b67
No known key found for this signature in database

View File

@ -45,35 +45,26 @@ let
installPhase = ''
awk -F': ' '\
BEGIN { print "[ {" } \
NR>1 && /^Package: / { print "} {"; } \
NF==0 { empty=1; } \
NF && empty { print "} {"; empty=0; } \
/: / { printf "%s = \"%s\";\n", $1, $2 } \
END { print "} ]" }' $srcs > $out
'';
};
aptPackages = import aptPackageIndex;
apthost = "https://apt.repos.intel.com/oneapi/";
getSum = pkgList: name:
findMatch = name:
let
matches = lib.filter (x: name == x.Package) pkgList;
#n = lib.length matches;
#match = builtins.trace (name + " -- ${builtins.toString n}") (lib.elemAt matches 0);
match = lib.elemAt matches 0;
in
match.SHA256;
getUrl = pkgList: name:
let
matches = lib.filter (x: name == x.Package) pkgList;
#match = assert lib.length matches == 1; lib.elemAt matches 0;
aptPackages = import aptPackageIndex;
matches = lib.filter (x: name == x.Package) aptPackages;
n = lib.length matches;
match =
#builtins.trace (name + " -- n=${builtins.toString n}")
(lib.elemAt matches 0);
match = builtins.traceVerbose (name + " -- ${builtins.toString n}") (builtins.head matches);
apthost = "https://apt.repos.intel.com/oneapi/";
in
apthost + match.Filename;
{
url = apthost + match.Filename;
sha256 = match.SHA256;
};
uncompressDebs = debs: name: stdenv.mkDerivation {
name = name;
@ -91,10 +82,7 @@ let
joinDebs = name: names:
let
urls = builtins.map (x: getUrl aptPackages x) names;
sums = builtins.map (x: getSum aptPackages x) names;
getsrc = url: sha256: builtins.fetchurl { inherit url sha256; };
debs = lib.zipListsWith getsrc urls sums;
debs = builtins.map (x: builtins.fetchurl (findMatch x)) names;
in
uncompressDebs debs "${name}-source";
@ -453,7 +441,7 @@ let
'';
};
ifort-wrapper = wrapIntel rec {
ifort-wrapper = wrapIntel {
cc = intel-compiler-fortran;
mygcc = gcc;
extraBuild = ''