[pkg-java] r11103 - in trunk/emma-coverage: . core/java13/com/vladium/util/exit debian debian/patches

Onkar Shinde onkarshinde-guest at alioth.debian.org
Mon Nov 23 15:36:14 UTC 2009


Author: onkarshinde-guest
Date: 2009-11-23 15:36:14 +0000 (Mon, 23 Nov 2009)
New Revision: 11103

Added:
   trunk/emma-coverage/debian/patches/
   trunk/emma-coverage/debian/patches/01_build_fixes.diff
   trunk/emma-coverage/debian/patches/series
Removed:
   trunk/emma-coverage/debian/dirs
Modified:
   trunk/emma-coverage/build.xml
   trunk/emma-coverage/core/java13/com/vladium/util/exit/ExitHookManager.java
   trunk/emma-coverage/debian/ant.properties
   trunk/emma-coverage/debian/changelog
   trunk/emma-coverage/debian/control
   trunk/emma-coverage/debian/rules
Log:
default-jdk/jre conversion and other fixes

Modified: trunk/emma-coverage/build.xml
===================================================================
--- trunk/emma-coverage/build.xml	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/build.xml	2009-11-23 15:36:14 UTC (rev 11103)
@@ -142,7 +142,7 @@
   </target>
 
 
-  <target name="timestamp" depends="init, -timestamp.2, -timestamp.3, -timestamp.4, -timestamp.5">
+  <target name="timestamp" depends="init, -timestamp.1, -timestamp.2, -timestamp.3, -timestamp.4, -timestamp.5">
   </target>
 
   <target name="-timestamp.1" depends="init" unless="build.is.dirty" >

Modified: trunk/emma-coverage/core/java13/com/vladium/util/exit/ExitHookManager.java
===================================================================
--- trunk/emma-coverage/core/java13/com/vladium/util/exit/ExitHookManager.java	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/core/java13/com/vladium/util/exit/ExitHookManager.java	2009-11-23 15:36:14 UTC (rev 11103)
@@ -11,6 +11,9 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
+
 import com.vladium.util.IJREVersion;
 import com.vladium.util.Property;
 import com.vladium.emma.IAppConstants;
@@ -33,7 +36,18 @@
     {
         if (s_singleton == null)
         {
-            s_singleton = new JRE13ExitHookManager ();
+            if (JRE_1_3_PLUS)
+            {
+                s_singleton = new JRE13ExitHookManager ();
+            }
+            else if (JRE_SUN_SIGNAL_COMPATIBLE)
+            {
+                s_singleton = new SunJREExitHookManager ();
+            }
+            else
+            {
+                throw new UnsupportedOperationException ("no shutdown hook manager available [JVM: " + Property.getSystemFingerprint () + "]");
+            }
         }
         
         return s_singleton;
@@ -109,8 +123,130 @@
         private final Map /* Runnable->Thread */ m_exitThreadMap;
         
     } // end of nested class
+    
+    
+    private static final class SunJREExitHookManager extends ExitHookManager
+    {
+        public synchronized boolean addExitHook (final Runnable runnable)
+        {
+            if ((runnable != null) && ! m_signalHandlerMap.containsKey (runnable))
+            {
+                final INTSignalHandler handler = new INTSignalHandler (runnable);
+                
+                try
+                {
+                    handler.register ();
+                    m_signalHandlerMap.put (runnable, handler); // TODO: use identity here
+                    
+                    return true;
+                }
+                catch (Throwable t)
+                {
+                    System.out.println ("exception caught while adding a shutdown hook:");
+                    t.printStackTrace (System.out);
+                }
+            }
+            
+            return false;
+        }
         
+        public synchronized boolean removeExitHook (final Runnable runnable)
+        {
+            if (runnable != null)
+            {
+                final INTSignalHandler handler = (INTSignalHandler) m_signalHandlerMap.get (runnable);  // TODO: use identity here
+                if (handler != null)
+                {
+                    try
+                    {
+                        handler.unregister ();
+                        m_signalHandlerMap.remove (runnable);
+                        
+                        return true;
+                    }
+                    catch (Exception e)
+                    {
+                        System.out.println ("exception caught while removing a shutdown hook:");
+                        e.printStackTrace (System.out);
+                    }
+                }
+            }
+            
+            return false;
+        }
+        
+        SunJREExitHookManager ()
+        {
+            m_signalHandlerMap = new HashMap ();
+        }
+        
+        
+        private final Map /* Runnable->INTSignalHandler */ m_signalHandlerMap;
+        
+    } // end of nested class
+    
+    
+    private static final class INTSignalHandler implements SignalHandler
+    {
+        public synchronized void handle (final Signal signal)
+        {
+            if (m_runnable != null)
+            {
+                try
+                {
+                    m_runnable.run ();
+                }
+                catch (Throwable ignore) {}
+            }
+            m_runnable = null;
+            
+            if ((m_previous != null) && (m_previous != SIG_DFL) && (m_previous != SIG_IGN))
+            {
+                try
+                {
+                    // this does not work:
+                    //Signal.handle (signal, m_previous);
+                    //Signal.raise (signal);
+                    
+                    m_previous.handle (signal);
+                }
+                catch (Throwable ignore) {}
+            }
+            else
+            {
+                System.exit (0);
+            }
+        }
+        
+        INTSignalHandler (final Runnable runnable)
+        {
+            m_runnable = runnable;
+        }
+       
+        synchronized void register ()
+        {
+            m_previous = Signal.handle (new Signal ("INT"), this);
+        }
+        
+        synchronized void unregister ()
+        {
+//            if (m_previous != null)
+//            {
+//                Signal.handle (new Signal ("INT"), m_previous);
+//                m_previous = null;
+//            }
+
+            m_runnable = null;
+        }
+
+
+        private Runnable m_runnable;
+        private SignalHandler m_previous;
+        
+    } // end of nested class
+    
+    
     private static ExitHookManager s_singleton;
     
 } // end of class
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
\ No newline at end of file

Modified: trunk/emma-coverage/debian/ant.properties
===================================================================
--- trunk/emma-coverage/debian/ant.properties	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/debian/ant.properties	2009-11-23 15:36:14 UTC (rev 11103)
@@ -1,2 +1,4 @@
 build.target=1.4
 build.target.ant.15.home=/usr/share/ant
+app.build.release.tag=debian
+app.bug.report.link=http://www.debian.org/Bugs/

Modified: trunk/emma-coverage/debian/changelog
===================================================================
--- trunk/emma-coverage/debian/changelog	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/debian/changelog	2009-11-23 15:36:14 UTC (rev 11103)
@@ -1,3 +1,21 @@
+emma-coverage (2.0.5312+dfsg-3) unstable; urgency=low
+
+  * debian/control
+    - default-jdk/jre conversion.
+    - Add cdbs build dependency.
+    - Add quilt dependency for patches.
+    - Fix Vcs-* headers.
+    - Move homepage from description to header.
+    - Update standards version to 3.8.3.
+  * debian/rules
+    - Use cdbs as build tool. Reduces file size a lot.
+    - Move some ant arguments with static values to ant.properties.
+    - Add mkdir command in install target. So debian/dirs is not needed now.
+  * debian/patches/01_build_fixes.diff
+    - Patch to fix compilation error.
+
+ -- Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>  Mon, 23 Nov 2009 16:16:57 +0530
+
 emma-coverage (2.0.5312+dfsg-2) unstable; urgency=low
 
   * Added xercesImpl.jar and xmlParserAPIs.jar to classpath.

Modified: trunk/emma-coverage/debian/control
===================================================================
--- trunk/emma-coverage/debian/control	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/debian/control	2009-11-23 15:36:14 UTC (rev 11103)
@@ -3,17 +3,16 @@
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Marcus Better <marcus at better.se>, Michael Koch <konqueror at gmx.de>
-Build-Depends: debhelper (>= 5.0.0), ant
-Build-Depends-Indep: java-gcj-compat-dev, ant-optional
-Standards-Version: 3.7.2
-Homepage: http://emma.sourceforge.net
+Build-Depends: debhelper (>= 5.0.0), cdbs, ant, quilt
+Build-Depends-Indep: default-jdk, ant-optional
+Standards-Version: 3.8.3
 Vcs-Svn: svn://svn.debian.org/pkg-java/trunk/emma-coverage
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/emma-coverage/
+Homepage: http://emma.sourceforge.net
 
 Package: libemma-java
 Architecture: all
-Depends: java-gcj-compat-dev | java2-runtime
-Suggests: java-virtual-machine
+Depends: ${misc:Depends}, default-jre-headless | java2-runtime-headless
 Description: Java code coverage tool
  EMMA is a toolkit for measuring and reporting Java code
  coverage. EMMA distinguishes itself from other tools by going after a

Deleted: trunk/emma-coverage/debian/dirs
===================================================================
--- trunk/emma-coverage/debian/dirs	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/debian/dirs	2009-11-23 15:36:14 UTC (rev 11103)
@@ -1 +0,0 @@
-usr/share/java

Added: trunk/emma-coverage/debian/patches/01_build_fixes.diff
===================================================================
--- trunk/emma-coverage/debian/patches/01_build_fixes.diff	                        (rev 0)
+++ trunk/emma-coverage/debian/patches/01_build_fixes.diff	2009-11-23 15:36:14 UTC (rev 11103)
@@ -0,0 +1,20 @@
+Index: emma-coverage-2.0.5312+dfsg/core/java12/com/vladium/emma/rt/InstrClassLoader.java
+===================================================================
+--- emma-coverage-2.0.5312+dfsg.orig/core/java12/com/vladium/emma/rt/InstrClassLoader.java	2009-11-23 17:56:47.000000000 +0530
++++ emma-coverage-2.0.5312+dfsg/core/java12/com/vladium/emma/rt/InstrClassLoader.java	2009-11-23 17:57:11.000000000 +0530
+@@ -343,7 +343,7 @@
+         // support ProtectionDomains with non-null class source URLs:
+         // [however, disable anything related to sealing or signing]
+         
+-        final CodeSource csrc = new CodeSource (srcURL, null);
++        final CodeSource csrc = new CodeSource (srcURL, (java.security.CodeSigner[])null);
+         
+         // allow getPackage() to return non-null on the class we are about to
+         // define (however, don't bother emulating the original manifest info since
+@@ -459,4 +459,4 @@
+     private static final URL [] EMPTY_URL_ARRAY = new URL [0];
+     
+ } // end of class
+-// ----------------------------------------------------------------------------
+\ No newline at end of file
++// ----------------------------------------------------------------------------

Added: trunk/emma-coverage/debian/patches/series
===================================================================
--- trunk/emma-coverage/debian/patches/series	                        (rev 0)
+++ trunk/emma-coverage/debian/patches/series	2009-11-23 15:36:14 UTC (rev 11103)
@@ -0,0 +1 @@
+01_build_fixes.diff

Modified: trunk/emma-coverage/debian/rules
===================================================================
--- trunk/emma-coverage/debian/rules	2009-11-23 10:25:34 UTC (rev 11102)
+++ trunk/emma-coverage/debian/rules	2009-11-23 15:36:14 UTC (rev 11103)
@@ -1,77 +1,31 @@
 #!/usr/bin/make -f
 
-VERSION         := $(shell head -1 debian/changelog | cut -f2 -d\( | cut -f1 -d\) | cut -f1 -d\- | cut -f1 -d\+)
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/ant.mk
+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+
+VERSION         := $(DEB_UPSTREAM_VERSION)
 VER_MAJOR       := $(shell echo $(VERSION) | cut -f1 -d.)
 VER_MINOR       := $(shell echo $(VERSION) | cut -f2 -d.)
-VER_BUILD       := $(shell echo $(VERSION) | cut -f3 -d.)
+VER_BUILD       := $(shell echo $(VERSION) | cut -f3 -d. | cut -f1 -d+)
 
-JAVA_HOME	:= /usr/lib/jvm/java-gcj
-DEB_JARS_BASE	:= /usr/share/java
-JAVACMD  	:= $(JAVA_HOME)/bin/java
+JAVA_HOME	:= /usr/lib/jvm/default-java
 
-DEB_JARS 	:= ant ant-launcher xmlParserAPIs xercesImpl
+DEB_JARS 	:= xmlParserAPIs xercesImpl
 
-DEB_CLASSPATH = $(shell for jar in $(DEB_JARS); do \
-		if [ -f "$$jar" ]; then echo -n "$${jar}:"; fi; \
-		if [ -f "$$jar".jar ]; then echo -n "$${jar}.jar:"; fi; \
-		if [ -f $(DEB_JARS_BASE)/"$$jar" ]; then echo -n "$(DEB_JARS_BASE)/$${jar}:"; fi; \
-		if [ -f $(DEB_JARS_BASE)/"$$jar".jar ]; then echo -n "$(DEB_JARS_BASE)/$${jar}.jar:"; fi; \
-		done; \
-		if [ -f "$(JAVA_HOME)/lib/tools.jar" ]; then echo -n "$(JAVA_HOME)/lib/tools.jar"; fi)
-
-ANT_ARGS	:= -propertyfile debian/ant.properties \
-		  -Dapp.major.version=$(VER_MAJOR) \
+DEB_ANT_ARGS	:= -Dapp.major.version=$(VER_MAJOR) \
 		  -Dapp.minor.version=$(VER_MINOR) \
 		  -Dapp.build.id=$(VER_BUILD) \
-		  -Dapp.build.release.tag=debian \
-		  "-Dapp.build.date=$(shell date -R)" \
-		  -Dapp.bug.report.link=http://www.debian.org/Bugs/
+		  "-Dapp.build.date=$(shell date -R)"
 
-ANT_INVOKE	:= $(JAVACMD) -classpath $(DEB_CLASSPATH) \
-		org.apache.tools.ant.Main $(ANT_ARGS)
-
 PKGNAME		:= emma
 LIBNAME		:= lib$(PKGNAME)-java
 INSTALL_DIR	:= $(CURDIR)/debian/$(LIBNAME)
 JAVALIB_DIR	:= $(INSTALL_DIR)/usr/share/java
 
-build: build-stamp
-build-stamp:
-	dh_testdir
-	$(ANT_INVOKE)
-	touch build-stamp
-
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp
-	$(ANT_INVOKE) clean
-	dh_clean
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k 
-	dh_installdirs
-
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs
-	dh_installdocs
-	dh_install
+install/libemma-java::
+	mkdir -p $(JAVALIB_DIR)
 	for j in '' _ant; do \
 	  install -m 644 dist/$(PKGNAME)$$j.jar $(JAVALIB_DIR)/$(PKGNAME)$$j-$(VERSION).jar; \
 	  ln -s $(PKGNAME)$$j-$(VERSION).jar $(JAVALIB_DIR)/$(PKGNAME)$$j.jar; \
 	done
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary-arch: build install
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install




More information about the pkg-java-commits mailing list