summaryrefslogtreecommitdiff
path: root/app-admin/foundry/files/foundry-0.6.0-profile-whitespace.patch
blob: e206438b49ca327039d79e1c89706b62e8c1a8e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git a/src/foundry/data/merge/purge-libressl.py b/src/foundry/data/merge/purge-libressl.py
--- a/src/foundry/data/merge/purge-libressl.py
+++ b/src/foundry/data/merge/purge-libressl.py
@@ -208,11 +208,13 @@
     except UnicodeDecodeError:
         return
 
+    # Only lines that mention LibreSSL change; every other line is kept byte for byte
+    # (profiles copied from Gentoo must stay identical to Gentoo's).
     lines: list[str] = []
-    for line in text.splitlines():
+    for line in text.split("\n"):
         stripped = line.strip()
         if "libressl" not in line and "curl_ssl_libressl" not in line and "LibreSSL" not in line:
-            lines.append(line.rstrip())
+            lines.append(line)
             continue
         if stripped in {"libressl", "curl_ssl_libressl"}:
             continue
@@ -225,7 +227,7 @@
         line = re.sub(r'[ \t]+"$', '"', line)
         lines.append(line)
 
-    new_text = "\n".join(lines) + ("\n" if text.endswith("\n") else "")
+    new_text = "\n".join(lines)
     if new_text != text:
         path.write_text(new_text)
 
diff --git a/src/osforge/data/merge/purge-libressl.py b/src/osforge/data/merge/purge-libressl.py
--- a/src/osforge/data/merge/purge-libressl.py
+++ b/src/osforge/data/merge/purge-libressl.py
@@ -208,11 +208,13 @@
     except UnicodeDecodeError:
         return
 
+    # Only lines that mention LibreSSL change; every other line is kept byte for byte
+    # (profiles copied from Gentoo must stay identical to Gentoo's).
     lines: list[str] = []
-    for line in text.splitlines():
+    for line in text.split("\n"):
         stripped = line.strip()
         if "libressl" not in line and "curl_ssl_libressl" not in line and "LibreSSL" not in line:
-            lines.append(line.rstrip())
+            lines.append(line)
             continue
         if stripped in {"libressl", "curl_ssl_libressl"}:
             continue
@@ -225,7 +227,7 @@
         line = re.sub(r'[ \t]+"$', '"', line)
         lines.append(line)
 
-    new_text = "\n".join(lines) + ("\n" if text.endswith("\n") else "")
+    new_text = "\n".join(lines)
     if new_text != text:
         path.write_text(new_text)