-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openssl: convert bash script to python
More portable. Signed-off-by: Rosen Penev <[email protected]>
- Loading branch information
Showing
5 changed files
with
74 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2285,6 +2285,7 @@ | |
"openssl" | ||
], | ||
"versions": [ | ||
"3.0.8-2", | ||
"3.0.8-1", | ||
"3.0.7-2", | ||
"3.0.7-1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
|
||
# Change to the directory of the Bash script | ||
script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
os.chdir(script_dir) | ||
|
||
# Node.js version should bundle OpenSSL of matching version to one specified in wrap file | ||
node_version = "v19.7.0" | ||
openssl_version = os.environ.get("OPENSSL_VERSION") | ||
|
||
if openssl_version is None: | ||
with open("../../openssl.wrap") as wrap_file: | ||
for line in wrap_file: | ||
if "directory = " in line: | ||
openssl_version = line.strip().split()[-1] | ||
break | ||
|
||
# Clone the Node.js repository | ||
subprocess.run(["git", "clone", "--depth", "1", "-b", node_version, "https://github.com/nodejs/node.git"]) | ||
|
||
# Remove the generated-config directory | ||
subprocess.run(["rm", "-rf", "generated-config"]) | ||
|
||
# Change directory to Node.js deps/openssl | ||
os.chdir("node/deps/openssl") | ||
|
||
# Apply the patch to generate meson.build for different targets | ||
subprocess.run(["patch", "-u", "config/generate_gypi.pl", "-i", "../../../generate_gypi.pl.patch"]) | ||
|
||
# Copy meson.build template file | ||
subprocess.run(["cp", "../../../meson.build.tmpl", "config/"]) | ||
|
||
# Clone the upstream OpenSSL repository | ||
subprocess.run(["rm", "-rf", "openssl"]) | ||
subprocess.run(["git", "clone", "--depth", "1", "--branch", "openssl-" + openssl_version, "https://github.com/openssl/openssl.git"]) | ||
|
||
# Remove the config/archs directory | ||
subprocess.run(["rm", "-rf", "config/archs"]) | ||
|
||
# Run the make command with LANG set to C | ||
os.environ['LANG'] = 'C' | ||
subprocess.run(["make", "-C", "config"]) | ||
|
||
# Copy generated files back into the correct place | ||
find_cmd = 'mkdir -p ../../../generated-$(dirname "$1"); cp "$1" ../../../generated-"$1"' | ||
subprocess.run(["find", "config/archs", "-name", "meson.build", "-exec", "sh", "-c", find_cmd, "_ignored", "{}", ";"]) | ||
subprocess.run(["find", "config/archs", "-name", "*.asm", "-exec", "sh", "-c", find_cmd, "_ignored", "{}", ";"]) | ||
subprocess.run(["find", "config/archs", "-name", "*.c", "-exec", "sh", "-c", find_cmd, "_ignored", "{}", ";"]) | ||
subprocess.run(["find", "config/archs", "-name", "*.h", "-exec", "sh", "-c", find_cmd, "_ignored", "{}", ";"]) | ||
subprocess.run(["find", "config/archs", "-iname", "*.s", "-exec", "sh", "-c", find_cmd, "_ignored", "{}", ";"]) | ||
|
||
# AIX is not supported by Meson | ||
subprocess.run(["rm", "-rf", "../../../generated-config/archs/aix*"]) | ||
|
||
# 32-bit s390x supported in Meson | ||
subprocess.run(["rm", "-rf", "../../../generated-config/archs/linux32-s390x"]) | ||
|
||
# Remove build info files | ||
subprocess.run(["rm", "-rf", "../../../generated-config/archs/*/asm_avx2"]) | ||
subprocess.run(["rm", "-rf", "../../../generated-config/archs/*/*/crypto/buildinf.h"]) | ||
|
||
# Change back to the original directory | ||
os.chdir(script_dir) | ||
|
||
# Remove the Node.js directory | ||
subprocess.run(["rm", "-rf", "node"]) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters