File: port_file_plugin_to_db4o_8.0.patch

package info (click to toggle)
tangerine 0.3.4-6.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 2,552 kB
  • sloc: sh: 11,023; cs: 5,910; ansic: 366; makefile: 357
file content (70 lines) | stat: -rw-r--r-- 2,633 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From: Chow Loong Jin <hyperair@debian.org>
Description: Detect and port to DB4O 8.0
Origin: https://bazaar.launchpad.net/~tangerine-developers/tangerine/trunk/diff/45
Applied-Upstream: yes
Index: tangerine/configure.ac
===================================================================
--- tangerine.orig/configure.ac	2012-01-09 02:52:25.496615680 +0800
+++ tangerine/configure.ac	2012-01-18 12:51:48.873943532 +0800
@@ -142,8 +142,15 @@
         file_beagle=$enableval,
         enable_file=auto)
 
-if test "x$enable_file" != "xno"; then 
-        PKG_CHECK_MODULES([DB4O], [db4o], HAVE_DB4O=yes, HAVE_DB4O=no)
+if test "x$enable_file" != "xno"; then
+        PKG_CHECK_MODULES([DB4O], [db4o >= 8.0], [HAVE_DB4O_8=yes], [HAVE_DB4O_8=no])
+        AM_CONDITIONAL([HAVE_DB4O_8], [test "$HAVE_DB4O_8" = "yes"])
+
+        if test "$HAVE_DB4O_8" = "yes"; then
+				HAVE_DB4O=yes
+        else
+				PKG_CHECK_MODULES([DB4O], [db4o], HAVE_DB4O=yes, HAVE_DB4O=no)
+        fi
 
         if test "x$enable_file" = "xyes" -a "x$HAVE_DB4O" = "xno"; then
 				AC_MSG_ERROR([File support explicitly requested, but dependencies not met])
Index: tangerine/plugins/File/Makefile.am
===================================================================
--- tangerine.orig/plugins/File/Makefile.am	2010-06-21 16:21:19.000000000 +0800
+++ tangerine/plugins/File/Makefile.am	2012-01-18 12:51:48.907277043 +0800
@@ -1,6 +1,11 @@
 # Simple component buildsystem
 if HAVE_DB4O
 include $(top_srcdir)/build.plugins.rules.mk
+
+if HAVE_DB4O_8
+MCS_FLAGS += -d:HAVE_DB4O_8
+endif
+
 else
 EXTRA_DIST = $(FILES)
 endif
Index: tangerine/plugins/File/src/FilePlugin.cs
===================================================================
--- tangerine.orig/plugins/File/src/FilePlugin.cs	2012-01-09 02:52:25.536615906 +0800
+++ tangerine/plugins/File/src/FilePlugin.cs	2012-01-18 12:51:48.920610450 +0800
@@ -127,7 +127,11 @@
                 odb = Db4oFactory.OpenFile (Path.Combine (Daemon.ConfigDirectory, "tracks.db"));
             }
 
+#if HAVE_DB4O_8
+            IObjectSet result = odb.QueryByExample (typeof (Track));
+#else
             IObjectSet result = odb.Get (typeof (Track));
+#endif
             log.DebugFormat ("{0} songs in database", result.Count);
             
             foreach (Track song in result) {
@@ -261,7 +265,11 @@
                 if (UpdateTrack (track, file)) {
                     db.AddTrack (track);   
                     trackHash[file] = track;
+#if HAVE_DB4O_8
+                    odb.Store (track);
+#else
                     odb.Set (track);
+#endif
                 }
             } catch {
             }