Add nuxwdog patch from PKI
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
This commit is contained in:
parent
ffb356ed5b
commit
034c971959
94
jss-pki-sync-netscape-security-util-Utils.patch
Normal file
94
jss-pki-sync-netscape-security-util-Utils.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From a5b0caf63837acfd876ee15e3823fbfdf5685432 Mon Sep 17 00:00:00 2001
|
||||
From: Dinesh Prasanth M K <dmoluguw@redhat.com>
|
||||
Date: Wed, 30 Jan 2019 12:31:29 -0500
|
||||
Subject: [PATCH] Add exec method to execute shell commands with input
|
||||
|
||||
- This is an effort to move duplicate code from PKI code
|
||||
base to JSS code base
|
||||
|
||||
- This chunk of code was originally introduced in PKI
|
||||
code: https://github.com/dogtagpki/pki/pull/131
|
||||
|
||||
- This PR is a joined effort of:
|
||||
https://github.com/dogtagpki/pki/pull/122
|
||||
|
||||
Signed-off-by: Dinesh Prasanth M K <dmoluguw@redhat.com>
|
||||
---
|
||||
.../jss/netscape/security/util/Utils.java | 57 +++++++++++++++++++
|
||||
1 file changed, 57 insertions(+)
|
||||
|
||||
diff --git a/org/mozilla/jss/netscape/security/util/Utils.java b/org/mozilla/jss/netscape/security/util/Utils.java
|
||||
index b1a3c341..b45381ae 100644
|
||||
--- a/org/mozilla/jss/netscape/security/util/Utils.java
|
||||
+++ b/org/mozilla/jss/netscape/security/util/Utils.java
|
||||
@@ -25,6 +25,7 @@
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
+import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
@@ -96,6 +97,62 @@ public static boolean exec(String cmd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ public static String readFromStream(InputStream inputStream) throws IOException {
|
||||
+ StringBuilder sb = new StringBuilder();
|
||||
+ BufferedReader br = null;
|
||||
+ try {
|
||||
+ br = new BufferedReader(new InputStreamReader(inputStream));
|
||||
+ String line = null;
|
||||
+ while ((line = br.readLine()) != null) {
|
||||
+ sb.append(line + System.getProperty("line.separator"));
|
||||
+ }
|
||||
+ } finally {
|
||||
+ br.close();
|
||||
+ }
|
||||
+ return sb.toString().trim();
|
||||
+ }
|
||||
+
|
||||
+ public static void writeToStream(OutputStream outputStream, String input) throws IOException {
|
||||
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));
|
||||
+ writer.write(input);
|
||||
+ writer.flush();
|
||||
+ writer.close();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Utility method to execute system commands
|
||||
+ *
|
||||
+ * @param cmd The command to be executed and its arguments
|
||||
+ * @param input The stdin input to be passed to the cmd
|
||||
+ * @return stdout or stderr of the command executed
|
||||
+ * @throws IOException
|
||||
+ * @throws InterruptedException
|
||||
+ */
|
||||
+ public static String exec(String[] cmd, String input) throws IOException, InterruptedException {
|
||||
+
|
||||
+ ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||
+
|
||||
+ Process p = pb.start();
|
||||
+
|
||||
+ if (input != null) {
|
||||
+ writeToStream(p.getOutputStream(), input);
|
||||
+ }
|
||||
+
|
||||
+ p.waitFor();
|
||||
+
|
||||
+ String output;
|
||||
+ if (p.exitValue() == 0) {
|
||||
+ output = readFromStream(p.getInputStream());
|
||||
+ } else {
|
||||
+ output = readFromStream(p.getErrorStream());
|
||||
+ }
|
||||
+ p.destroy();
|
||||
+
|
||||
+ return output;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
public static String SpecialURLDecode(String s) {
|
||||
if (s == null)
|
||||
return null;
|
||||
12
jss.spec
12
jss.spec
@ -7,7 +7,7 @@ URL: http://www.dogtagpki.org/wiki/JSS
|
||||
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
||||
|
||||
Version: 4.5.2
|
||||
Release: 2%{?_timestamp}%{?_commit_id}%{?dist}
|
||||
Release: 3%{?_timestamp}%{?_commit_id}%{?dist}
|
||||
# global _phase -a1
|
||||
|
||||
# To generate the source tarball:
|
||||
@ -26,6 +26,7 @@ Source: https://github.com/dogtagpki/%{name}/archive/v%{version}%{?_phas
|
||||
# <version tag> \
|
||||
# > jss-VERSION-RELEASE.patch
|
||||
# Patch: jss-VERSION-RELEASE.patch
|
||||
Patch1: jss-pki-sync-netscape-security-util-Utils.patch
|
||||
|
||||
################################################################################
|
||||
# Build Dependencies
|
||||
@ -38,8 +39,8 @@ BuildRequires: cmake
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: nspr-devel >= 4.13.1
|
||||
BuildRequires: nss-devel >= 3.28.4-6
|
||||
BuildRequires: nss-tools >= 3.28.4-6
|
||||
BuildRequires: nss-devel >= 3.30
|
||||
BuildRequires: nss-tools >= 3.30
|
||||
BuildRequires: java-devel
|
||||
BuildRequires: jpackage-utils
|
||||
BuildRequires: slf4j
|
||||
@ -56,7 +57,7 @@ BuildRequires: apache-commons-codec
|
||||
BuildRequires: perl-interpreter
|
||||
%endif
|
||||
|
||||
Requires: nss >= 3.28.4-6
|
||||
Requires: nss >= 3.30
|
||||
Requires: java-headless
|
||||
Requires: jpackage-utils
|
||||
Requires: slf4j
|
||||
@ -157,6 +158,9 @@ cp -p *.txt $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
|
||||
|
||||
################################################################################
|
||||
%changelog
|
||||
* Fri Feb 01 2019 Dogtag PKI Team <pki-devel@redhat.com> 4.5.2-3
|
||||
- Include nuxwdog patch for netscape.security.util.Utils from PKI
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.5.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user