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)