summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-01-12 21:09:14 +0100
committerDaiderd Jordan <daiderd@gmail.com>2020-01-13 11:13:01 +0100
commitc7d457c9daa5279d75fb2cdbd6599514104edd1f (patch)
tree8e4ec4fdf1002577c412e6fefec075cb62dd714c
parentdd5fd3b1ffafce509cc499099923f46467f62045 (diff)
downloadnixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.tar
nixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.tar.gz
nixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.tar.bz2
nixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.tar.lz
nixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.tar.xz
nixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.tar.zst
nixpkgs-c7d457c9daa5279d75fb2cdbd6599514104edd1f.zip
darwin.xnu: python2 -> python3
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix6
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch41
2 files changed, 45 insertions, 2 deletions
diff --git a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
index afa5dc1c08c..da2d0c5dc7b 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
@@ -1,9 +1,11 @@
 { appleDerivation, lib, bootstrap_cmds, bison, flex
-, gnum4, unifdef, perl, python
+, gnum4, unifdef, perl, python3
 , headersOnly ? true }:
 
 appleDerivation ({
-  nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python ];
+  nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python3 ];
+
+  patches = [ ./python3.patch ];
 
   postPatch = ''
     substituteInPlace Makefile \
diff --git a/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch b/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch
new file mode 100644
index 00000000000..10778406c8e
--- /dev/null
+++ b/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch
@@ -0,0 +1,41 @@
+diff --git a/bsd/kern/makekdebugevents.py b/bsd/kern/makekdebugevents.py
+index 73b2db4..d354ba0 100755
+--- a/bsd/kern/makekdebugevents.py
++++ b/bsd/kern/makekdebugevents.py
+@@ -5,7 +5,7 @@
+ # named kd_events[] or these mappings.
+ # Required to generate a header file used by DEVELOPMENT and DEBUG kernels.
+ #
+- 
++
+ import sys
+ import re
+ 
+@@ -21,18 +21,18 @@ code_table = []
+ # scan file to generate internal table
+ with open(trace_code_file, 'rt') as codes:
+     for line in codes:
+-	m = id_name_pattern.match(line)
+-	if m:
++        m = id_name_pattern.match(line)
++    if m:
+             code_table += [(int(m.group(1),base=16), m.group(2))]
+ 
+ # emit typedef:
+-print "typedef struct {"
+-print "        uint32_t   id;"
+-print "        const char *name;"
+-print "} kd_event_t;"
++print("typedef struct {")
++print("        uint32_t   id;")
++print("        const char *name;")
++print("} kd_event_t;")
+ # emit structure declaration and sorted initialization:
+-print "kd_event_t kd_events[] = {"
++print("kd_event_t kd_events[] = {")
+ for mapping in sorted(code_table, key=lambda x: x[0]):
+-        print "        {0x%x, \"%s\"}," % mapping
+-print "};"
++        print("        {0x%x, \"%s\"}," % mapping)
++print("};")
+