rpms/javasqlite/EL-5 javasqlite-20080420-loadfail.patch, NONE, 1.1 javasqlite-20080420-tests.patch, NONE, 1.1 javasqlite.spec, 1.1, 1.2

Ville Skyttä scop at fedoraproject.org
Thu Sep 11 19:10:03 UTC 2008


Author: scop

Update of /cvs/pkgs/rpms/javasqlite/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15739

Modified Files:
	javasqlite.spec 
Added Files:
	javasqlite-20080420-loadfail.patch 
	javasqlite-20080420-tests.patch 
Log Message:
* Sat Sep  6 2008 Ville Skyttä <ville.skytta at iki.fi> - 20080420-1.1
- Include JDBC 3 (Java 1.4.x, 1.5.x) drivers.
- Work around build setup issues #460761 and #460783.
- Patch to output error message if loading the lib from a specified
  SQLite.library.path fails.
- Patch test suite to exit with non-zero status on failures.


javasqlite-20080420-loadfail.patch:

--- NEW FILE javasqlite-20080420-loadfail.patch ---
diff -up javasqlite-20080420/SQLite/Database.java~ javasqlite-20080420/SQLite/Database.java
--- javasqlite-20080420/SQLite/Database.java~	2008-01-29 10:48:21.000000000 +0200
+++ javasqlite-20080420/SQLite/Database.java	2008-08-30 23:44:00.000000000 +0300
@@ -721,6 +721,7 @@ public class Database {
 		    String mapped = (String) mapLibraryName.invoke(null, args);
 		    System.load(path + java.io.File.separator + mapped);
 		} catch (Throwable t) {
+		    System.err.println("Unable to load sqlite from SQLite.library.path=" + path + ", trying system default: " + t);
 		    System.loadLibrary("sqlite_jni");
 		}
 	    }

javasqlite-20080420-tests.patch:

--- NEW FILE javasqlite-20080420-tests.patch ---
diff -up javasqlite-20080420/Makefile.in~ javasqlite-20080420/Makefile.in
--- javasqlite-20080420/Makefile.in~	2008-04-07 08:23:47.000000000 +0300
+++ javasqlite-20080420/Makefile.in	2008-08-30 23:49:36.000000000 +0300
@@ -150,6 +150,8 @@ test:
 	$(JAVAC) -classpath sqlite.jar:$(PWD) test.java
 	$(JAVA_RUN) -classpath sqlite.jar:$(PWD) \
 	    -DSQLite.library.path=$(PWD)/.libs test
+
+test2:	test
 	$(JAVA_RUN) -classpath sqlite.jar:$(PWD) \
 	    -DSQLite.library.path=$(PWD)/.libs test db2
 
diff -up javasqlite-20080420/test3.java~ javasqlite-20080420/test3.java
--- javasqlite-20080420/test3.java~	2008-04-05 10:30:10.000000000 +0300
+++ javasqlite-20080420/test3.java	2008-08-30 23:48:47.000000000 +0300
@@ -77,6 +77,7 @@ public class test3 implements SQLite.Tra
     }
 
     public static void main(String args[]) {
+        boolean error = true;
         test3 T = new test3();
 	System.out.println("LIB version: " + SQLite.Database.version());
 	SQLite.Database db = new SQLite.Database();
@@ -145,6 +146,7 @@ public class test3 implements SQLite.Tra
 	    T.do_exec(db, "drop table TEST3");
 	    T.do_exec(db, "drop table B");
 	    T.do_select(db, "select * from sqlite_master");
+	    error = false;
 	} catch (java.lang.Exception e) {
 	    System.err.println("error: " + e);
 	    e.printStackTrace();
@@ -159,9 +161,13 @@ public class test3 implements SQLite.Tra
 		db.close();
 	    } catch(java.lang.Exception e) {
 		System.err.println("error: " + e);
+		error = true;
 	    } finally {
 		System.err.println("done.");
 	    }
 	}
+	if (error) {
+	    System.exit(1);
+	}
     }
 }
diff -up javasqlite-20080420/test.java~ javasqlite-20080420/test.java
--- javasqlite-20080420/test.java~	2007-06-29 12:52:46.000000000 +0300
+++ javasqlite-20080420/test.java	2008-08-30 23:48:47.000000000 +0300
@@ -69,6 +69,7 @@ public class test implements SQLite.Call
     }
 
     public static void main(String args[]) {
+	boolean error = true;
 	System.out.println("LIB version: " + SQLite.Database.version());
 	SQLite.Database db = new SQLite.Database();
 	try {
@@ -114,6 +115,7 @@ public class test implements SQLite.Call
 		}
 	    } while (vm.compile());
 	    db.close();
+	    error = false;
 	    System.out.println("An exception is expected from now on.");
 	    System.out.println("==== local callback ====");
 	    db.exec("select * from sqlite_master", new test());
@@ -128,6 +130,9 @@ public class test implements SQLite.Call
 	    } finally {
 		System.err.println("done.");
 	    }
+	    if (error) {
+		System.exit(1);
+	    }
 	}
 	
     }


Index: javasqlite.spec
===================================================================
RCS file: /cvs/pkgs/rpms/javasqlite/EL-5/javasqlite.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- javasqlite.spec	17 May 2008 13:16:26 -0000	1.1
+++ javasqlite.spec	11 Sep 2008 19:09:33 -0000	1.2
@@ -1,22 +1,22 @@
-# TODO: build JDBC 3 driver too (not doable with gcj 1.5.0 - it apparently
-#       has java 1.6 (JDBC 4) class libs???)
-
-
 Name:           javasqlite
 Version:        20080420
-Release:        1%{?dist}
+Release:        1%{?dist}.1
 Summary:        SQLite Java Wrapper/JDBC Driver
 
 Group:          Development/Libraries
 License:        BSD
 URL:            http://www.ch-werner.de/javasqlite/
 Source0:        http://www.ch-werner.de/javasqlite/%{name}-%{version}.tar.gz
-# jnipath: Fedora specific, no need to send upstream
+# jnipath: Fedora specific, no need to send upstream.
 Patch0:         %{name}-20080315-jnipath.patch
+# loadfail, tests: Sent upstream 20080830.
+Patch1:         %{name}-20080420-loadfail.patch
+Patch2:         %{name}-20080420-tests.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  sqlite-devel
-BuildRequires:  java-devel
+BuildRequires:  java-devel = 1:1.6.0
+BuildRequires:  java-devel = 1.4.2
 BuildRequires:  java-javadoc
 Requires:       jre
 
@@ -37,16 +37,32 @@
 %prep
 %setup -q
 sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH0} | patch -p1
+%patch1 -p1
+%patch2 -p1
 sed -i -e 's/\r//g' doc/ajhowto.txt
 f=ChangeLog ; iconv -f iso-8859-1 -t utf-8 $f > $f.utf8 ; mv $f.utf8 $f
 
 
 %build
+
+origpath="$PATH"
+
+# Pass #1: JDBC 3 driver and common files with 1.4.2
+export PATH="%{_jvmdir}/java-1.4.2/bin:$origpath" # bug 460761
+%configure --with-jdk=%{_jvmdir}/java-1.4.2
+make %{?_smp_mflags} sqlite.jar JAVAC_FLAGS="-source 1.4"
+
+# Pass #2: JDBC 4 driver and the rest with 1.6.0
+export PATH="%{_jvmdir}/java-1.6.0/bin:$origpath" # bug 460761 (to be sure)
 %configure \
-    --with-jdk=%{_jvmdir}/java \
+    --with-jdk=%{_jvmdir}/java-1.6.0 \
     --with-jardir=%{_libdir}/%{name} \
     --libdir=%{_libdir}/%{name}
-make %{?_smp_mflags} JAVAC_FLAGS="-source 5"
+make %{?_smp_mflags}
+
+# Add JDBC 3 classes
+jar uf sqlite.jar SQLite/JDBC2x/*.class
+
 make javadoc JAVADOCLINK=%{_javadocdir}/java
 
 
@@ -63,7 +79,19 @@
 
 
 %check
-make test
+
+# LD_LIBRARY_PATH: prevent falling back to system installed library in case
+# loading the just built one fails, see static initializer in SQLite.Database.
+export LD_LIBRARY_PATH="$PWD/.libs:$LD_LIBRARY_PATH"
+
+origpath="$PATH"
+for javaver in 1.4.2 1.6.0 ; do
+    jdir=%{_jvmdir}/java-$javaver/bin
+    export PATH="$jdir:$origpath" # bug 460761
+    # test2 is for SQLite 2.x, which we don't support
+    # test3 uses zeroblob which is available in sqlite 3.4+ (EL-5 has 3.3.6)
+    make JAVA_RUN="$jdir/java" JAVAC="$jdir/javac" test
+done
 
 
 %files
@@ -78,6 +106,13 @@
 
 
 %changelog
+* Sat Sep  6 2008 Ville Skyttä <ville.skytta at iki.fi> - 20080420-1.1
+- Include JDBC 3 (Java 1.4.x, 1.5.x) drivers.
+- Work around build setup issues #460761 and #460783.
+- Patch to output error message if loading the lib from a specified
+  SQLite.library.path fails.
+- Patch test suite to exit with non-zero status on failures.
+
 * Tue Apr 22 2008 Ville Skyttä <ville.skytta at iki.fi> - 20080420-1
 - 20080420; all upstreamable patches applied upstream.
 




More information about the fedora-extras-commits mailing list