aboutsummaryrefslogtreecommitdiffstats
path: root/testing/csync2
diff options
context:
space:
mode:
authorPablo Castorino <pcastorino@mendoza-conicet.gob.ar>2010-11-12 13:45:14 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-11-13 14:50:46 +0000
commit8663c11aac12a37145e00262d370d946e88065d6 (patch)
treef2ddbe6ba897ba5d41bc0ccdfefe57aa1a8599ed /testing/csync2
parent42d434f386af7bc200d41ecd602afb065b018290 (diff)
downloadaports-8663c11aac12a37145e00262d370d946e88065d6.tar.bz2
aports-8663c11aac12a37145e00262d370d946e88065d6.tar.xz
testing/csync2: new aport
Diffstat (limited to 'testing/csync2')
-rw-r--r--testing/csync2/01-csync2-sqlite3.patch518
-rw-r--r--testing/csync2/02-csync2-1.34-gnutls_pkgconfig.patch24
-rw-r--r--testing/csync2/APKBUILD44
3 files changed, 586 insertions, 0 deletions
diff --git a/testing/csync2/01-csync2-sqlite3.patch b/testing/csync2/01-csync2-sqlite3.patch
new file mode 100644
index 0000000000..364dcca792
--- /dev/null
+++ b/testing/csync2/01-csync2-sqlite3.patch
@@ -0,0 +1,518 @@
+diff -ruN csync2-1.34.vanilla/action.c csync2-1.34/action.c
+--- csync2-1.34.vanilla/action.c 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/action.c 2008-06-12 15:36:47.000000000 +0200
+@@ -69,7 +69,7 @@
+ "SELECT filename from action WHERE command = '%s' "
+ "and logfile = '%s'", command, logfile)
+ {
+- textlist_add(&tl, SQL_V[0], 0);
++ textlist_add(&tl, SQL_V(0), 0);
+ } SQL_END;
+
+ mark = strstr(command_clr, "%%");
+@@ -130,7 +130,7 @@
+ SQL_BEGIN("Checking for sceduled commands",
+ "SELECT command, logfile FROM action GROUP BY command, logfile")
+ {
+- textlist_add2(&tl, SQL_V[0], SQL_V[1], 0);
++ textlist_add2(&tl, SQL_V(0), SQL_V(1), 0);
+ } SQL_END;
+
+ for (t = tl; t != 0; t = t->next)
+diff -ruN csync2-1.34.vanilla/check.c csync2-1.34/check.c
+--- csync2-1.34.vanilla/check.c 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/check.c 2008-06-12 15:36:47.000000000 +0200
+@@ -159,7 +159,7 @@
+ "SELECT filename from file where "
+ "filename = '%s' %s ORDER BY filename", url_encode(file), where_rec)
+ {
+- const char *filename = url_decode(SQL_V[0]);
++ const char *filename = url_decode(SQL_V(0));
+ if ( lstat_strict(prefixsubst(filename), &st) != 0 || csync_check_pure(filename) )
+ textlist_add(&tl, filename, 0);
+ } SQL_END;
+@@ -213,8 +213,9 @@
+
+ if ( check_type>0 && lstat_strict(prefixsubst(file), &st) != 0 ) {
+ if ( ignnoent ) return 0;
++ perror("blup");
+ csync_fatal("This should not happen: "
+- "Can't stat %s.\n", file);
++ "Can't stat %s %s %d %d %d.\n", prefixsubst(file), file,stat(file,&st),lstat_strict(file,&st),errno);
+ }
+
+ switch ( check_type )
+@@ -231,7 +232,7 @@
+ "filename = '%s'", url_encode(file))
+ {
+ if ( !csync_cmpchecktxt(checktxt,
+- url_decode(SQL_V[0])) ) {
++ url_decode(SQL_V(0))) ) {
+ csync_debug(2, "File has changed: %s\n", file);
+ this_is_dirty = 1;
+ }
+diff -ruN csync2-1.34.vanilla/config.h.in csync2-1.34/config.h.in
+--- csync2-1.34.vanilla/config.h.in 2007-07-24 23:04:24.000000000 +0200
++++ csync2-1.34/config.h.in 2008-06-12 15:36:47.000000000 +0200
+@@ -6,8 +6,8 @@
+ /* Define to 1 if you have the `rsync' library (-lrsync). */
+ #undef HAVE_LIBRSYNC
+
+-/* Define to 1 if you have the `sqlite' library (-lsqlite). */
+-#undef HAVE_LIBSQLITE
++/* Define to 1 if you have the `sqlite3' library (-lsqlite3). */
++#undef HAVE_LIBSQLITE3
+
+ /* Name of package */
+ #undef PACKAGE
+diff -ruN csync2-1.34.vanilla/configure csync2-1.34/configure
+--- csync2-1.34.vanilla/configure 2007-07-24 23:04:25.000000000 +0200
++++ csync2-1.34/configure 2008-06-12 15:36:47.000000000 +0200
+@@ -3671,13 +3671,13 @@
+
+ else
+
+-{ echo "$as_me:$LINENO: checking for sqlite_exec in -lsqlite" >&5
+-echo $ECHO_N "checking for sqlite_exec in -lsqlite... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_sqlite_sqlite_exec+set}" = set; then
++{ echo "$as_me:$LINENO: checking for sqlite3_exec in -lsqlite3" >&5
++echo $ECHO_N "checking for sqlite3_exec in -lsqlite3... $ECHO_C" >&6; }
++if test "${ac_cv_lib_sqlite3_sqlite3_exec+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lsqlite $LIBS"
++LIBS="-lsqlite3 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -3691,11 +3691,11 @@
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+-char sqlite_exec ();
++char sqlite3_exec ();
+ int
+ main ()
+ {
+-return sqlite_exec ();
++return sqlite3_exec ();
+ ;
+ return 0;
+ }
+@@ -3718,30 +3718,30 @@
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+- ac_cv_lib_sqlite_sqlite_exec=yes
++ ac_cv_lib_sqlite3_sqlite3_exec=yes
+ else
+ echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+- ac_cv_lib_sqlite_sqlite_exec=no
++ ac_cv_lib_sqlite3_sqlite3_exec=no
+ fi
+
+ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite_sqlite_exec" >&5
+-echo "${ECHO_T}$ac_cv_lib_sqlite_sqlite_exec" >&6; }
+-if test $ac_cv_lib_sqlite_sqlite_exec = yes; then
++{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_exec" >&5
++echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_exec" >&6; }
++if test $ac_cv_lib_sqlite3_sqlite3_exec = yes; then
+ cat >>confdefs.h <<_ACEOF
+-#define HAVE_LIBSQLITE 1
++#define HAVE_LIBSQLITE3 1
+ _ACEOF
+
+- LIBS="-lsqlite $LIBS"
++ LIBS="-lsqlite3 $LIBS"
+
+ else
+- { { echo "$as_me:$LINENO: error: libsqlite is required" >&5
+-echo "$as_me: error: libsqlite is required" >&2;}
++ { { echo "$as_me:$LINENO: error: libsqlite3 is required" >&5
++echo "$as_me: error: libsqlite3 is required" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+diff -ruN csync2-1.34.vanilla/configure.ac csync2-1.34/configure.ac
+--- csync2-1.34.vanilla/configure.ac 2007-07-24 23:04:19.000000000 +0200
++++ csync2-1.34/configure.ac 2008-06-12 15:36:47.000000000 +0200
+@@ -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"])
+
+diff -ruN csync2-1.34.vanilla/conn.c csync2-1.34/conn.c
+--- csync2-1.34.vanilla/conn.c 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/conn.c 2008-06-12 15:36:47.000000000 +0200
+@@ -181,7 +181,7 @@
+ "SELECT certdata FROM x509_cert WHERE peername = '%s'",
+ url_encode(peername))
+ {
+- if (!strcmp(SQL_V[0], certdata))
++ if (!strcmp(SQL_V(0), certdata))
+ cert_is_ok = 1;
+ else
+ cert_is_ok = 0;
+diff -ruN csync2-1.34.vanilla/csync2.c csync2-1.34/csync2.c
+--- csync2-1.34.vanilla/csync2.c 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/csync2.c 2008-06-12 15:36:47.000000000 +0200
+@@ -582,8 +582,8 @@
+ SQL_BEGIN("Check all hints",
+ "SELECT filename, recursive FROM hint")
+ {
+- textlist_add(&tl, url_decode(SQL_V[0]),
+- atoi(SQL_V[1]));
++ textlist_add(&tl, url_decode(SQL_V(0)),
++ atoi(SQL_V(1)));
+ } SQL_END;
+
+ for (t = tl; t != 0; t = t->next) {
+@@ -659,7 +659,7 @@
+ "SELECT filename FROM file WHERE filename = '%s' %s",
+ url_encode(realname), where_rec)
+ {
+- char *filename = strdup(url_encode(SQL_V[0]));
++ char *filename = strdup(url_encode(SQL_V(0)));
+ csync_mark(filename, 0, 0);
+ free(filename);
+ } SQL_END;
+@@ -695,7 +695,7 @@
+ SQL_BEGIN("DB Dump - Hint",
+ "SELECT recursive, filename FROM hint ORDER BY filename")
+ {
+- printf("%s\t%s\n", SQL_V[0], url_decode(SQL_V[1]));
++ printf("%s\t%s\n", SQL_V(0), url_decode(SQL_V(1)));
+ retval = -1;
+ } SQL_END;
+ break;
+@@ -705,8 +705,8 @@
+ SQL_BEGIN("DB Dump - File",
+ "SELECT checktxt, filename FROM file ORDER BY filename")
+ {
+- if (csync_find_next(0, url_decode(SQL_V[1]))) {
+- printf("%s\t%s\n", url_decode(SQL_V[0]), url_decode(SQL_V[1]));
++ if (csync_find_next(0, url_decode(SQL_V(1)))) {
++ printf("%s\t%s\n", url_decode(SQL_V(0)), url_decode(SQL_V(1)));
+ retval = -1;
+ }
+ } SQL_END;
+@@ -717,8 +717,8 @@
+ SQL_BEGIN("DB Dump - File",
+ "SELECT checktxt, filename FROM file ORDER BY filename")
+ {
+- if ( csync_match_file_host(url_decode(SQL_V[1]), argv[optind], argv[optind+1], 0) ) {
+- printf("%s\t%s\n", url_decode(SQL_V[0]), url_decode(SQL_V[1]));
++ if ( csync_match_file_host(url_decode(SQL_V(1)), argv[optind], argv[optind+1], 0) ) {
++ printf("%s\t%s\n", url_decode(SQL_V(0)), url_decode(SQL_V(1)));
+ retval = -1;
+ }
+ } SQL_END;
+@@ -769,9 +769,9 @@
+ SQL_BEGIN("DB Dump - Dirty",
+ "SELECT force, myname, peername, filename FROM dirty ORDER BY filename")
+ {
+- if (csync_find_next(0, url_decode(SQL_V[3]))) {
+- printf("%s\t%s\t%s\t%s\n", atoi(SQL_V[0]) ? "force" : "chary",
+- url_decode(SQL_V[1]), url_decode(SQL_V[2]), url_decode(SQL_V[3]));
++ if (csync_find_next(0, url_decode(SQL_V(3)))) {
++ printf("%s\t%s\t%s\t%s\n", atoi(SQL_V(0)) ? "force" : "chary",
++ url_decode(SQL_V(1)), url_decode(SQL_V(2)), url_decode(SQL_V(3)));
+ retval = -1;
+ }
+ } SQL_END;
+diff -ruN csync2-1.34.vanilla/csync2.h csync2-1.34/csync2.h
+--- csync2-1.34.vanilla/csync2.h 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/csync2.h 2008-06-12 15:36:47.000000000 +0200
+@@ -22,6 +22,7 @@
+ #define CSYNC2_H 1
+
+ #define _GNU_SOURCE
++#define _FILE_OFFSET_BITS 64
+
+ #include "config.h"
+ #include <stdio.h>
+@@ -91,19 +92,24 @@
+ extern int csync_db_next(void *vmx, const char *err,
+ int *pN, const char ***pazValue, const char ***pazColName);
+ extern void csync_db_fin(void *vmx, const char *err);
++extern void * csync_db_colblob(void *stmtx,int col);
++
+
+ #define SQL(e, s, ...) csync_db_sql(e, s, ##__VA_ARGS__)
+
++#define SQL_V(col) \
++ (csync_db_colblob(SQL_VM,col))
++
+ #define SQL_BEGIN(e, s, ...) \
+ { \
+ char *SQL_ERR = e; \
+ void *SQL_VM = csync_db_begin(SQL_ERR, s, ##__VA_ARGS__); \
+ int SQL_COUNT = 0; \
+ while (1) { \
+- const char **SQL_V, **SQL_N; \
++ const char **notSQL_V, **notSQL_N; \
+ int SQL_C; \
+ if ( !csync_db_next(SQL_VM, SQL_ERR, \
+- &SQL_C, &SQL_V, &SQL_N) ) break; \
++ &SQL_C, &notSQL_V, &notSQL_N) ) break; \
+ SQL_COUNT++;
+
+ #define SQL_FIN }{
+diff -ruN csync2-1.34.vanilla/daemon.c csync2-1.34/daemon.c
+--- csync2-1.34.vanilla/daemon.c 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/daemon.c 2008-06-12 15:36:47.000000000 +0200
+@@ -443,8 +443,8 @@
+ strcmp(tag[2], "-") ? url_encode(tag[2]) : "",
+ strcmp(tag[2], "-") ? "'" : "")
+ {
+- if ( csync_match_file_host(url_decode(SQL_V[1]), tag[1], peer, (const char **)&tag[3]) )
+- conn_printf("%s\t%s\n", SQL_V[0], SQL_V[1]);
++ if ( csync_match_file_host(url_decode(SQL_V(1)), tag[1], peer, (const char **)&tag[3]) )
++ conn_printf("%s\t%s\n", SQL_V(0), SQL_V(1));
+ } SQL_END;
+ break;
+
+diff -ruN csync2-1.34.vanilla/db.c csync2-1.34/db.c
+--- csync2-1.34.vanilla/db.c 2007-07-24 23:04:18.000000000 +0200
++++ csync2-1.34/db.c 2008-06-12 15:36:47.000000000 +0200
+@@ -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,46 @@
+
+ void csync_db_open(const char *file)
+ {
+- db = sqlite_open(file, 0, 0);
+- if ( db == 0 )
+- csync_fatal("Can't open database: %s\n", file);
++ int r;
++ //db = sqlite_open(file, 0, 0);
++ r=sqlite3_open(file, &db);
++ if ( db == 0 || r)
++ csync_fatal("Can't open database: %s, result %d\n", file,r);
+
+ /* 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 +180,7 @@
+ SQL("COMMIT TRANSACTION", "COMMIT TRANSACTION");
+ tqueries_counter = -10;
+ }
+- sqlite_close(db);
++ sqlite3_close(db);
+ begin_commit_recursion--;
+ db = 0;
+ }
+@@ -199,7 +201,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 +218,8 @@
+
+ void* csync_db_begin(const char *err, const char *fmt, ...)
+ {
+- sqlite_vm *vm;
++ //sqlite_vm *vm;
++ sqlite3_stmt *stmt;
+ char *sql;
+ va_list ap;
+ int rc, busyc = 0;
+@@ -231,7 +234,7 @@
+ csync_debug(2, "SQL: %s\n", sql);
+
+ while (1) {
+- rc = sqlite_compile(db, sql, 0, &vm, 0);
++ rc = sqlite3_prepare(db, sql, 0, &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 +245,21 @@
+ 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;
++ //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 = 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");
+@@ -267,16 +272,21 @@
+
+ return rc == SQLITE_ROW;
+ }
++void * csync_db_colblob(void *stmtx,int col) {
++ sqlite3_stmt *stmt = stmtx;
++ return sqlite3_column_blob(stmt,col);
++}
+
+-void csync_db_fin(void *vmx, const char *err)
++void csync_db_fin(void *stmtx, const char *err)
+ {
+- sqlite_vm *vm = vmx;
++ //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");
+--- src/csync2-1.34/update.c
++++ new/update.c
+@@ -545,12 +545,12 @@
+ "SELECT filename, myname, force FROM dirty WHERE peername = '%s' "
+ "ORDER by filename ASC", url_encode(peername))
+ {
+- const char *filename = url_decode(SQL_V[0]);
++ const char *filename = url_decode(SQL_V(0));
+ int i, use_this = patnum == 0;
+ for (i=0; i<patnum && !use_this; i++)
+ if ( compare_files(filename, patlist[i], recursive) ) use_this = 1;
+ if (use_this)
+- textlist_add2(&tl, filename, url_decode(SQL_V[1]), atoi(SQL_V[2]));
++ textlist_add2(&tl, filename, url_decode(SQL_V(1)), atoi(SQL_V(2)));
+ } SQL_END;
+
+ /* just return if there are no files to update */
+@@ -626,7 +626,7 @@
+ SQL_BEGIN("Get hosts from dirty table",
+ "SELECT peername FROM dirty GROUP BY peername ORDER BY random()")
+ {
+- textlist_add(&tl, url_decode(SQL_V[0]), 0);
++ textlist_add(&tl, url_decode(SQL_V(0)), 0);
+ } SQL_END;
+
+ for (t = tl; t != 0; t = t->next) {
+@@ -798,7 +798,7 @@
+ filename ? url_encode(filename) : "",
+ filename ? "'" : "")
+ {
+- char *l_file = strdup(url_decode(SQL_V[1])), *l_checktxt = strdup(url_decode(SQL_V[0]));
++ char *l_file = strdup(url_decode(SQL_V(1))), *l_checktxt = strdup(url_decode(SQL_V(0)));
+ if ( csync_match_file_host(l_file, myname, peername, 0) ) {
+ if ( remote_eof ) {
+ got_remote_eof:
+@@ -936,17 +936,17 @@
+ const struct csync_group *g = 0;
+ const struct csync_group_host *h;
+
+- const char *filename = url_decode(SQL_V[0]);
++ const char *filename = url_decode(SQL_V(0));
+
+ while ((g=csync_find_next(g, filename)) != 0) {
+- if (!strcmp(g->myname, SQL_V[1]))
++ if (!strcmp(g->myname, SQL_V(1)))
+ for (h = g->host; h; h = h->next) {
+- if (!strcmp(h->hostname, SQL_V[2]))
++ if (!strcmp(h->hostname, SQL_V(2)))
+ goto this_dirty_record_is_ok;
+ }
+ }
+
+- textlist_add2(&tl, SQL_V[0], SQL_V[2], 0);
++ textlist_add2(&tl, SQL_V(0), SQL_V(2), 0);
+
+ this_dirty_record_is_ok:
+ ;
+@@ -962,8 +962,8 @@
+ SQL_BEGIN("Query file DB",
+ "SELECT filename FROM file")
+ {
+- if (!csync_find_next(0, url_decode(SQL_V[0])))
+- textlist_add(&tl, SQL_V[0], 0);
++ if (!csync_find_next(0, url_decode(SQL_V(0))))
++ textlist_add(&tl, SQL_V(0), 0);
+ } SQL_END;
+ for (t = tl; t != 0; t = t->next) {
+ csync_debug(1, "Removing %s from file db.\n", t->value);
diff --git a/testing/csync2/02-csync2-1.34-gnutls_pkgconfig.patch b/testing/csync2/02-csync2-1.34-gnutls_pkgconfig.patch
new file mode 100644
index 0000000000..b9e1d2726e
--- /dev/null
+++ b/testing/csync2/02-csync2-1.34-gnutls_pkgconfig.patch
@@ -0,0 +1,24 @@
+--- old/configure.ac
++++ new/configure.ac
+@@ -59,16 +59,11 @@
+ if test "$enable_gnutls" != no
+ then
+
+- # Check for gnuTLS.
+- AM_PATH_LIBGNUTLS(1.0.0, , [ AC_MSG_ERROR([[gnutls not found; install gnutls, gnutls-openssl and libtasn1 packages for your system or run configure with --disable-gnutls]]) ])
+-
+- # This is a bloody hack for fedora core
+- CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+- LIBS="$LIBS $LIBGNUTLS_LIBS -ltasn1"
+-
+- # Check gnuTLS SSL compatibility lib.
+- AC_CHECK_LIB([gnutls-openssl], [SSL_new], , [AC_MSG_ERROR([[gnutls-openssl not found; install gnutls, gnutls-openssl and libtasn1 packages for your system or run configure with --disable-gnutls]])])
+-
++ PKG_CHECK_MODULES(LIBGNUTLS, gnutls, [
++ CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gnutls libssl`"
++ LIBS="$LIBS `$PKG_CONFIG --libs gnutls libssl` -DHAVE_LIBGNUTLS_OPENSSL"
++ ])
++
+ fi
+
+ AC_CONFIG_FILES([Makefile])
diff --git a/testing/csync2/APKBUILD b/testing/csync2/APKBUILD
new file mode 100644
index 0000000000..6c4096a632
--- /dev/null
+++ b/testing/csync2/APKBUILD
@@ -0,0 +1,44 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=csync2
+pkgver=1.34
+pkgrel=0
+pkgdesc="a cluster synchronization tool"
+url="http://oss.linbit.com/csync2/"
+license="GPL-2+"
+depends=
+makedepends="librsync-dev gnutls-dev sqlite-dev autoconf automake"
+install=
+subpackages="$pkgname-doc"
+source="http://oss.linbit.com/csync2/csync2-$pkgver.tar.gz
+ 01-csync2-sqlite3.patch
+ 02-csync2-1.34-gnutls_pkgconfig.patch
+ "
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$_builddir"
+ for i in ../*.patch; do
+ msg "Applying $i"
+ patch -p1 -i $i || return 1
+ done
+ autoreconf --install --force
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="efc8a3548996b79cef2ad76af5e93cd8 csync2-1.34.tar.gz
+35ba1bb1aafd87741c7ef55bdfb2e212 01-csync2-sqlite3.patch
+31b2ed6a7bb424ccdbf1486223eca323 02-csync2-1.34-gnutls_pkgconfig.patch"