File csync2-sqlite3-wip.patch of Package csync2
Index: csync2.spec
===================================================================
--- csync2.spec (revision 393)
+++ csync2.spec (working copy)
@@ -23,7 +23,7 @@
# norootforbuild
# neededforbuild openssl openssl-devel
-BuildRequires: sqlite-devel sqlite librsync openssl-devel librsync-devel
+BuildRequires: sqlite-devel sqlite librsync openssl-devel librsync-devel byacc flex
Name: csync2
License: GPL
@@ -83,12 +83,17 @@
%defattr(-,root,root)
%doc ChangeLog README NEWS INSTALL TODO AUTHORS
%{_sbindir}/csync2
+%{_sbindir}/csync2-compare
%{_var}/lib/csync2
-%{_mandir}/man1/csync2.1.gz
+%{_mandir}/man1/csync2.1
%config(noreplace) %{_sysconfdir}/xinetd.d/csync2
%config(noreplace) %{_sysconfdir}/csync2.cfg
%changelog
+* Mon Nov 26 2007 Ask Bjoern Hansen <ask@develooper.com>
+- Add more BuildRequires
+- Tiny cleanups
+
* Tue Dec 06 2005 Clifford Wolf <clifford.wolf@linbit.com>
- Some fixes and cleanups for RPM 4.4.1
Index: configure.ac
===================================================================
--- configure.ac (revision 393)
+++ configure.ac (working copy)
@@ -47,7 +47,7 @@
AS_HELP_STRING([--with-libsqlite-source=source-tar-file],
[build this libsqlite and link statically against it (hack! hack!)]),
AC_SUBST([libsqlite_source_file], $withval),
- AC_CHECK_LIB([sqlite], [sqlite_exec], , [AC_MSG_ERROR(libsqlite is required)])
+ AC_CHECK_LIB([sqlite3], [sqlite3_exec], , [AC_MSG_ERROR(libsqlite3 is required)])
)
AM_CONDITIONAL([PRIVATE_LIBSQLITE], [test -n "$libsqlite_source_file"])
Index: db.c
===================================================================
--- db.c (revision 393)
+++ db.c (working copy)
@@ -19,7 +19,7 @@
*/
#include "csync2.h"
-#include <sqlite.h>
+#include <sqlite3.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -33,7 +33,7 @@
int db_blocking_mode = 1;
int db_sync_mode = 1;
-static sqlite *db = 0;
+static sqlite3 *db = 0;
static int get_dblock_timeout()
{
@@ -128,44 +128,44 @@
void csync_db_open(const char *file)
{
- db = sqlite_open(file, 0, 0);
+ sqlite3_open(file, &db);
if ( db == 0 )
csync_fatal("Can't open database: %s\n", file);
/* ignore errors on table creation */
in_sql_query++;
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE file ("
" filename, checktxt,"
" UNIQUE ( filename ) ON CONFLICT REPLACE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE dirty ("
" filename, force, myname, peername,"
" UNIQUE ( filename, peername ) ON CONFLICT IGNORE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE hint ("
" filename, recursive,"
" UNIQUE ( filename, recursive ) ON CONFLICT IGNORE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE action ("
" filename, command, logfile,"
" UNIQUE ( filename, command ) ON CONFLICT IGNORE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE x509_cert ("
" peername, certdata,"
" UNIQUE ( peername ) ON CONFLICT IGNORE"
")",
0, 0, 0);
if (!db_sync_mode)
- sqlite_exec(db, "PRAGMA synchronous = OFF", 0, 0, 0);
+ sqlite3_exec(db, "PRAGMA synchronous = OFF", 0, 0, 0);
in_sql_query--;
}
@@ -178,7 +178,7 @@
SQL("COMMIT TRANSACTION", "COMMIT TRANSACTION");
tqueries_counter = -10;
}
- sqlite_close(db);
+ sqlite3_close(db);
begin_commit_recursion--;
db = 0;
}
@@ -199,7 +199,7 @@
csync_debug(2, "SQL: %s\n", sql);
while (1) {
- rc = sqlite_exec(db, sql, 0, 0, 0);
+ rc = sqlite3_exec(db, sql, 0, 0, 0);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
@@ -216,7 +216,7 @@
void* csync_db_begin(const char *err, const char *fmt, ...)
{
- sqlite_vm *vm;
+ sqlite3_stmt *stmt;
char *sql;
va_list ap;
int rc, busyc = 0;
@@ -231,7 +231,7 @@
csync_debug(2, "SQL: %s\n", sql);
while (1) {
- rc = sqlite_compile(db, sql, 0, &vm, 0);
+ rc = sqlite3_prepare(db, sql, 1024, &stmt, 0);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
@@ -242,19 +242,19 @@
csync_fatal("Database Error: %s [%d]: %s\n", err, rc, sql);
free(sql);
- return vm;
+ return stmt;
}
-int csync_db_next(void *vmx, const char *err,
+int csync_db_next(void *stmtx, const char *err,
int *pN, const char ***pazValue, const char ***pazColName)
{
- sqlite_vm *vm = vmx;
+ sqlite3_stmt *stmt = stmtx;
int rc, busyc = 0;
csync_debug(4, "Trying to fetch a row from the database.\n");
while (1) {
- rc = sqlite_step(vm, pN, pazValue, pazColName);
+ rc = sqlite3_step(stmt);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
@@ -268,15 +268,15 @@
return rc == SQLITE_ROW;
}
-void csync_db_fin(void *vmx, const char *err)
+void csync_db_fin(void *stmtx, const char *err)
{
- sqlite_vm *vm = vmx;
+ sqlite3_stmt *stmt = stmtx;
int rc, busyc = 0;
csync_debug(2, "SQL Query finished.\n");
while (1) {
- rc = sqlite_finalize(vm, 0);
+ rc = sqlite3_finalize(stmt);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
Index: Makefile.am
===================================================================
--- Makefile.am (revision 393)
+++ Makefile.am (working copy)
@@ -43,8 +43,8 @@
if PRIVATE_LIBSQLITE
BUILT_SOURCES += private_libsqlite
- AM_CFLAGS += -I$(shell test -f libsqlite.dir && cat libsqlite.dir || echo ==libsqlite==)
- AM_LDFLAGS += -L$(shell test -f libsqlite.dir && cat libsqlite.dir || echo ==libsqlite==)
+ AM_CFLAGS += -I$(shell test -f libsqlite.dir && cat libsqlite.dir || echo ==libsqlite3==)
+ AM_LDFLAGS += -L$(shell test -f libsqlite.dir && cat libsqlite.dir || echo ==libsqlite3==)
LIBS += -lprivatesqlite
endif