File openssl_binary_detection.patch of Package nodejs16

Allow non-standard openssl binary names

Index: node-v14.15.1/test/common/index.js
===================================================================
--- node-v14.15.1.orig/test/common/index.js
+++ node-v14.15.1/test/common/index.js
@@ -797,20 +797,28 @@ const common = {
   get opensslCli() {
     if (opensslCli !== null) return opensslCli;
 
+    let cli_candidates = [];
+
     if (process.config.variables.node_shared_openssl) {
       // Use external command
-      opensslCli = 'openssl';
+      cli_candidates = cli_candidates.concat(['openssl-1_1', 'openssl']);
     } else {
       // Use command built from sources included in Node.js repository
-      opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
+      cli_candidates.push(path.join(path.dirname(process.execPath), 'openssl-cli'));
     }
 
-    if (exports.isWindows) opensslCli += '.exe';
+    let checkOpensslCli = function(opensslCli) {
+        if (exports.isWindows) opensslCli += '.exe';
+        const opensslCmd = spawnSync(opensslCli, ['version']);
+        if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) {
+            // OpenSSL command cannot be executed
+            opensslCli = false;
+        }
+        return opensslCli;
+    };
 
-    const opensslCmd = spawnSync(opensslCli, ['version']);
-    if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) {
-      // OpenSSL command cannot be executed
-      opensslCli = false;
+    for (let i=0; i<cli_candidates.length && !opensslCli; i=i+1) {
+        opensslCli = checkOpensslCli(cli_candidates[i]);
     }
     return opensslCli;
   },
openSUSE Build Service is sponsored by