[jenkins] 02/03: Fixed the compatibility with libjnr-posix-java >= 3.0

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Wed Jul 15 12:39:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository jenkins.

commit 40933ec006c4c2e57392b7cfd050144e556301ee
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Wed Jul 15 14:03:11 2015 +0200

    Fixed the compatibility with libjnr-posix-java >= 3.0
---
 debian/changelog                                   |   1 +
 debian/control                                     |   2 +-
 debian/maven.ignoreRules                           |   3 +
 debian/maven.rules                                 |   3 -
 .../0012-jnr-posix-upgrade.patch                   | 233 +++++++++------------
 5 files changed, 100 insertions(+), 142 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c5aff68..83d3c9b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 jenkins (1.565.3-5) UNRELEASED; urgency=medium
 
   * Team upload.
+  * Fixed the compatibility with libjnr-posix-java >= 3.0
   * Fixed the compatibility with libjbcrypt-java >= 0.4
 
  -- Emmanuel Bourg <ebourg at apache.org>  Wed, 15 Jul 2015 11:52:02 +0200
diff --git a/debian/control b/debian/control
index c2c591b..88f0332 100644
--- a/debian/control
+++ b/debian/control
@@ -68,7 +68,7 @@ Build-Depends-Indep:
  libjfreechart-java,
  libjmdns-java,
  libjna-java,
- libjnr-posix-java,
+ libjnr-posix-java (>= 3.0),
  libjson-java,
  libjsr305-java,
  libjstl1.1-java,
diff --git a/debian/maven.ignoreRules b/debian/maven.ignoreRules
index c4e145a..9e76f39 100644
--- a/debian/maven.ignoreRules
+++ b/debian/maven.ignoreRules
@@ -95,3 +95,6 @@ org.jenkins-ci.modules systemd-slave-installer * * * *
 # Drop animal-sniffer plugin usage
 org.codehaus.mojo animal-sniffer-maven-plugin * * * *
 # TODO: To be packaged
+
+# Ignore the old jna-posix
+org.jruby.ext.posix jna-posix * * * *
diff --git a/debian/maven.rules b/debian/maven.rules
index 8022d39..7f90dfd 100644
--- a/debian/maven.rules
+++ b/debian/maven.rules
@@ -54,9 +54,6 @@ s/org.jvnet.hudson/org.jenkins-ci/ commons-jelly-tags-define * s/.*/debian/ * *
 s/org.jvnet.hudson/org.jenkins-ci/ task-reactor * s/.*/debian/ * *
 # JSTL 1.1 
 javax.servlet jstl * s/1\.1\..*/1.1/ * *
-# Remap for rename jna->jnr in Debian
-org.jruby.ext.posix s/jna-posix/jnr-posix/ * s/.*/debian/ * *
-s/com.github.jnr/org.jruby.ext.posix/ jnr-posix * s/.*/debian/ * *
 # Update to servlet3.1
 javax.servlet s/servlet-api/javax.servlet-api/ * s/.*/3.1/ * *
 # Updates for 1.447.1
diff --git a/debian/patches/dependency-upgrades/0012-jnr-posix-upgrade.patch b/debian/patches/dependency-upgrades/0012-jnr-posix-upgrade.patch
index b36f671..7d0d73d 100644
--- a/debian/patches/dependency-upgrades/0012-jnr-posix-upgrade.patch
+++ b/debian/patches/dependency-upgrades/0012-jnr-posix-upgrade.patch
@@ -1,64 +1,46 @@
 From: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Date: Sun, 11 Aug 2013 10:41:39 +0100
 Subject: jnr-posix-upgrade
-
----
- core/pom.xml                                     | 5 +++++
- core/src/main/java/hudson/os/PosixAPI.java       | 7 +++----
- core/src/main/java/hudson/os/PosixException.java | 8 ++++----
- 3 files changed, 12 insertions(+), 8 deletions(-)
-
---- a/core/pom.xml
-+++ b/core/pom.xml
-@@ -105,6 +105,11 @@
-       <version>3.0.1</version>
-     </dependency>
-     <dependency>
-+      <groupId>org.jruby.extras</groupId>
-+      <artifactId>jffi</artifactId>
-+      <version>0.6.5</version>
-+    </dependency>
-+    <dependency>
-       <groupId>org.kohsuke</groupId>
-       <artifactId>trilead-putty-extension</artifactId>
-       <version>1.2</version>
---- a/core/src/main/java/hudson/os/PosixAPI.java
-+++ b/core/src/main/java/hudson/os/PosixAPI.java
-@@ -5,10 +5,10 @@
- import java.io.PrintStream;
- import java.util.Map;
- import java.util.logging.Logger;
--import jnr.constants.platform.Errno;
--import jnr.posix.POSIX;
--import jnr.posix.POSIXFactory;
--import jnr.posix.util.DefaultPOSIXHandler;
-+import org.jruby.ext.posix.POSIX;
-+import org.jruby.ext.posix.POSIXFactory;
-+import org.jruby.ext.posix.POSIXHandler;
-+import com.kenai.constantine.platform.Errno;
+--- a/core/src/main/java/hudson/os/PosixException.java
++++ b/core/src/main/java/hudson/os/PosixException.java
+@@ -1,6 +1,6 @@
+ package hudson.os;
+ 
+-import org.jruby.ext.posix.POSIX.ERRORS;
++import jnr.constants.platform.Errno;
  
  /**
-  * POSIX API wrapper.
-@@ -16,59 +16,28 @@
+  * Indicates an error during POSIX API call.
+@@ -8,16 +8,16 @@
   * @author Kohsuke Kawaguchi
   */
- public class PosixAPI {
--
--    private static POSIX posix;
--    
--    /**
--     * Load the JNR implementation of the POSIX APIs for the current platform.
--     * Runtime exceptions will be of type {@link PosixException}.
--     * @return some implementation (even on Windows or unsupported Unix)
--     * @since 1.518
--     */
--    public static synchronized POSIX jnr() {
--        if (posix == null) {
--            posix = POSIXFactory.getPOSIX(new DefaultPOSIXHandler() {
--                @Override public void error(Errno error, String extraData) {
+ public class PosixException extends RuntimeException {
+-    private final ERRORS errors;
++    private final Errno errors;
+ 
+-    public PosixException(String message, ERRORS errors) {
++    public PosixException(String message, Errno errors) {
+         super(message);
+         this.errors = errors;
+     }
+ 
+     /** @deprecated Leaks reference to deprecated jna-posix API. */
+     @Deprecated
+-    public ERRORS getErrorCode() {
++    public Errno getErrorCode() {
+         return errors;
+     }
+ 
+--- a/core/src/main/java/hudson/os/PosixAPI.java
++++ b/core/src/main/java/hudson/os/PosixAPI.java
+@@ -29,17 +29,10 @@
+         if (posix == null) {
+             posix = POSIXFactory.getPOSIX(new DefaultPOSIXHandler() {
+                 @Override public void error(Errno error, String extraData) {
 -                    throw new PosixException("native error " + error.description() + " " + extraData, convert(error));
--                }
--                @Override public void error(Errno error, String methodName, String extraData) {
++                    throw new PosixException("native error " + error.description() + " " + extraData, error);
+                 }
+                 @Override public void error(Errno error, String methodName, String extraData) {
 -                    throw new PosixException("native error calling " + methodName + ": " + error.description() + " " + extraData, convert(error));
 -                }
 -                private org.jruby.ext.posix.POSIX.ERRORS convert(Errno error) {
@@ -67,33 +49,25 @@ Subject: jnr-posix-upgrade
 -                    } catch (IllegalArgumentException x) {
 -                        return org.jruby.ext.posix.POSIX.ERRORS.EIO; // PosixException.message has real error anyway
 -                    }
--                }
--            }, true);
--        }
-+    public static POSIX jnr() {
-         return posix;
-     }
- 
-     /**
--     * @deprecated use {@link #jnr} and {@link POSIX#isNative}
-+     * @deprecated as of 1.448
-+     *      Use {@link #supportsNative()}.
++                    throw new PosixException("native error calling " + methodName + ": " + error.description() + " " + extraData, error);
+                 }
+             }, true);
+         }
+@@ -51,7 +44,7 @@
       */
--    @Deprecated
+     @Deprecated
      public boolean isNative() {
-         return supportsNative();
+-        return supportsNative();
++        return jnr().isNative();
      }
  
      /**
--     * @deprecated use {@link #jnr} and {@link POSIX#isNative}
-+     * Determine if the jna-posix library could not provide native support, and
-+     * used a fallback java implementation which does not support many operations.
+@@ -59,65 +52,7 @@
       */
--    @Deprecated
+     @Deprecated
      public static boolean supportsNative() {
 -        return !(jnaPosix instanceof org.jruby.ext.posix.JavaPOSIX);
-+        return posix.isNative();
-     }
+-    }
 -
 -    private static org.jruby.ext.posix.POSIX jnaPosix;
 -    /** @deprecated Use {@link #jnr} instead. */
@@ -102,73 +76,56 @@ Subject: jnr-posix-upgrade
 -        if (jnaPosix == null) {
 -            jnaPosix = org.jruby.ext.posix.POSIXFactory.getPOSIX(new org.jruby.ext.posix.POSIXHandler() {
 -        public void error(org.jruby.ext.posix.POSIX.ERRORS errors, String s) {
-+    
-+    private static final POSIX posix = POSIXFactory.getPOSIX(new POSIXHandler() {
-+        public void error(Errno errors, String s) {
-             throw new PosixException(s,errors);
-         }
- 
-@@ -116,9 +85,6 @@
-             return System.err;
-         }
-     }, true);
+-            throw new PosixException(s,errors);
+-        }
+-
+-        public void unimplementedError(String s) {
+-            throw new UnsupportedOperationException(s);
+-        }
+-
+-        public void warn(WARNING_ID warning_id, String s, Object... objects) {
+-            LOGGER.fine(s);
+-        }
+-
+-        public boolean isVerbose() {
+-            return true;
+-        }
+-
+-        public File getCurrentWorkingDirectory() {
+-            return new File(".").getAbsoluteFile();
+-        }
+-
+-        public String[] getEnv() {
+-            Map<String,String> envs = System.getenv();
+-            String[] envp = new String[envs.size()];
+-            
+-            int i = 0;
+-            for (Map.Entry<String,String> e : envs.entrySet()) {
+-                envp[i++] = e.getKey()+'+'+e.getValue();
+-            }
+-            return envp;
+-        }
+-
+-        public InputStream getInputStream() {
+-            return System.in;
+-        }
+-
+-        public PrintStream getOutputStream() {
+-            return System.out;
+-        }
+-
+-        public int getPID() {
+-            // TODO
+-            return 0;
+-        }
+-
+-        public PrintStream getErrorStream() {
+-            return System.err;
+-        }
+-    }, true);
 -        }
 -        return jnaPosix;
--    }
- 
-     private static final Logger LOGGER = Logger.getLogger(PosixAPI.class.getName());
- }
---- a/core/src/main/java/hudson/os/PosixException.java
-+++ b/core/src/main/java/hudson/os/PosixException.java
-@@ -1,6 +1,6 @@
- package hudson.os;
- 
--import org.jruby.ext.posix.POSIX.ERRORS;
-+import com.kenai.constantine.platform.Errno;
- 
- /**
-  * Indicates an error during POSIX API call.
-@@ -8,16 +8,16 @@
-  * @author Kohsuke Kawaguchi
-  */
- public class PosixException extends RuntimeException {
--    private final ERRORS errors;
-+    private final Errno errors;
- 
--    public PosixException(String message, ERRORS errors) {
-+    public PosixException(String message, Errno errors) {
-         super(message);
-         this.errors = errors;
-     }
- 
-     /** @deprecated Leaks reference to deprecated jna-posix API. */
-     @Deprecated
--    public ERRORS getErrorCode() {
-+    public Errno getErrorCode() {
-         return errors;
++        return jnr().isNative();
      }
  
---- a/core/src/main/java/hudson/util/jna/GNUCLibrary.java
-+++ b/core/src/main/java/hudson/util/jna/GNUCLibrary.java
-@@ -31,7 +31,7 @@
- import com.sun.jna.NativeLong;
- import com.sun.jna.ptr.IntByReference;
- import hudson.os.PosixAPI;
--import jnr.posix.POSIX;
-+import org.jruby.ext.posix.POSIX;
- import org.jvnet.libpam.impl.CLibrary.passwd;
- 
- /**
---- a/core/src/main/java/hudson/Util.java
-+++ b/core/src/main/java/hudson/Util.java
-@@ -39,8 +39,8 @@
- import org.apache.tools.ant.taskdefs.Chmod;
- import org.apache.tools.ant.taskdefs.Copy;
- import org.apache.tools.ant.types.FileSet;
--import jnr.posix.FileStat;
--import jnr.posix.POSIX;
-+import org.jruby.ext.posix.FileStat;
-+import org.jruby.ext.posix.POSIX;
- 
- import javax.crypto.SecretKey;
- import javax.crypto.spec.SecretKeySpec;
+     private static final Logger LOGGER = Logger.getLogger(PosixAPI.class.getName());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jenkins.git



More information about the pkg-java-commits mailing list