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:
		
							parent
							
								
									57827ae5a4
								
							
						
					
					
						commit
						b08ce80b5a
					
				| @ -45,40 +45,31 @@ let | |||||||
|     installPhase = '' |     installPhase = '' | ||||||
|       awk -F': ' '\ |       awk -F': ' '\ | ||||||
|         BEGIN   { print "[ {" } \ |         BEGIN   { print "[ {" } \ | ||||||
|         NR>1 && /^Package: / { print "} {"; } \ |         NF==0 { empty=1; } \ | ||||||
|  |         NF && empty { print "} {"; empty=0; } \ | ||||||
|         /: /    { printf "%s = \"%s\";\n", $1, $2 } \ |         /: /    { printf "%s = \"%s\";\n", $1, $2 } \ | ||||||
|         END     { print "} ]" }' $srcs > $out |         END     { print "} ]" }' $srcs > $out | ||||||
|     ''; |     ''; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  |   findMatch = name: | ||||||
|  |   let | ||||||
|     aptPackages = import aptPackageIndex; |     aptPackages = import aptPackageIndex; | ||||||
|  |     matches = lib.filter (x: name == x.Package) aptPackages; | ||||||
|  |     n = lib.length matches; | ||||||
|  |     match = builtins.traceVerbose (name + " -- ${builtins.toString n}") (builtins.head matches); | ||||||
| 
 | 
 | ||||||
|     apthost = "https://apt.repos.intel.com/oneapi/"; |     apthost = "https://apt.repos.intel.com/oneapi/"; | ||||||
| 
 |  | ||||||
|   getSum = pkgList: 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 |   in | ||||||
|     match.SHA256; |     { | ||||||
| 
 |       url = apthost + match.Filename; | ||||||
|   getUrl = pkgList: name: |       sha256 = match.SHA256; | ||||||
|   let |     }; | ||||||
|     matches = lib.filter (x: name == x.Package) pkgList; |  | ||||||
|     #match = assert lib.length matches == 1; lib.elemAt matches 0; |  | ||||||
|     n = lib.length matches; |  | ||||||
|     match = |  | ||||||
|       #builtins.trace (name + " -- n=${builtins.toString n}") |  | ||||||
|       (lib.elemAt matches 0); |  | ||||||
|   in |  | ||||||
|     apthost + match.Filename; |  | ||||||
| 
 | 
 | ||||||
|   uncompressDebs = debs: name: stdenv.mkDerivation { |   uncompressDebs = debs: name: stdenv.mkDerivation { | ||||||
|     name = name; |     name = name; | ||||||
|     srcs = debs; |     srcs = debs; | ||||||
|     buildInputs = [ dpkg ]; |     nativeBuildInputs = [ dpkg ]; | ||||||
|     phases = [ "installPhase" ]; |     phases = [ "installPhase" ]; | ||||||
|     installPhase = '' |     installPhase = '' | ||||||
|       mkdir -p $out |       mkdir -p $out | ||||||
| @ -91,10 +82,7 @@ let | |||||||
| 
 | 
 | ||||||
|   joinDebs = name: names: |   joinDebs = name: names: | ||||||
|   let |   let | ||||||
|     urls = builtins.map (x: getUrl aptPackages x) names; |     debs = builtins.map (x: builtins.fetchurl (findMatch x)) names; | ||||||
|     sums = builtins.map (x: getSum aptPackages x) names; |  | ||||||
|     getsrc = url: sha256: builtins.fetchurl { inherit url sha256; }; |  | ||||||
|     debs = lib.zipListsWith getsrc urls sums; |  | ||||||
|   in |   in | ||||||
|     uncompressDebs debs "${name}-source"; |     uncompressDebs debs "${name}-source"; | ||||||
| 
 | 
 | ||||||
| @ -442,7 +430,7 @@ let | |||||||
|     ''; |     ''; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   ifort-wrapper = wrapIntel rec { |   ifort-wrapper = wrapIntel { | ||||||
|     cc = intel-compiler-fortran; |     cc = intel-compiler-fortran; | ||||||
|     mygcc = gcc; |     mygcc = gcc; | ||||||
|     extraBuild = '' |     extraBuild = '' | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user