Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Some fixes.
Vsevolod Stakhov committed 11 years ago
commit 4e6393059b823f80c86ccb9f0def1ba7171d0e64
parent ab0f86e
6 files changed +29 -25
modified configure.ac
@@ -237,7 +237,7 @@ m4_define([repos_ldadd_static], [])

dnl Add ldadd for repo
m4_define([repos_add_ldadd], [
-
	m4_append([$1], [m4_join([], [repo/], 
+
	m4_append([$1], [m4_join([], [$(top_builddir)/libpkg/repo/], 
		[$3], [/librepo_], 
		[$3], [$2.la ])])
])
@@ -252,8 +252,8 @@ m4_map([m4_curry([repos_add_ldadd], [repos_ldadd_static], [_static])], [repos])
m4_map([m4_curry([repos_add_makefile], [repos_makefiles])], [repos])

REPOS="m4_expand([repos])"
-
REPOS_LDADD="m4_normalize(m4_expand([repos_ldadd]))"
-
REPOS_LDADD_STATIC="m4_normalize(m4_expand([repos_ldadd_static]))"
+
REPOS_LDADD='m4_normalize(m4_expand([repos_ldadd]))'
+
REPOS_LDADD_STATIC='m4_normalize(m4_expand([repos_ldadd_static]))'
AC_SUBST([REPOS])
AC_SUBST([REPOS_LDADD])
AC_SUBST([REPOS_LDADD_STATIC])
modified libpkg/pkg.h.in
@@ -1047,7 +1047,7 @@ bool pkgdb_case_sensitive(void);
 */
struct pkgdb_it * pkgdb_query(struct pkgdb *db, const char *pattern,
    match_t type);
-
struct pkgdb_it * pkg_repo_query(struct pkgdb *db, const char *pattern,
+
struct pkgdb_it * pkgdb_repo_query(struct pkgdb *db, const char *pattern,
    match_t type, const char *reponame);
struct pkgdb_it * pkgdb_repo_search(struct pkgdb *db, const char *pattern,
    match_t type, pkgdb_field field, pkgdb_field sort, const char *reponame);
modified libpkg/pkgdb.c
@@ -77,13 +77,7 @@

#define DBVERSION (DB_SCHEMA_MAJOR * 1000 + DB_SCHEMA_MINOR)

-
static void pkgdb_regex(sqlite3_context *, int, sqlite3_value **);
-
static void pkgdb_split_uid(sqlite3_context *, int, sqlite3_value **);
-
static void pkgdb_split_version(sqlite3_context *, int, sqlite3_value **);
-
static void pkgdb_regex_delete(void *);
static int pkgdb_upgrade(struct pkgdb *);
-
static int sqlcmd_init(sqlite3 *db, __unused const char **err,
-
    __unused const void *noused);
static int prstmt_initialize(struct pkgdb *db);
/* static int run_prstmt(sql_prstmt_index s, ...); */
static void prstmt_finalize(struct pkgdb *db);
@@ -92,7 +86,7 @@ static int pkgdb_insert_scripts(struct pkg *pkg, int64_t package_id, sqlite3 *s)

extern int sqlite3_shell(int, char**);

-
static void
+
void
pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
	const unsigned char	*regex = NULL;
@@ -165,19 +159,19 @@ pkgdb_split_common(sqlite3_context *ctx, int argc, sqlite3_value **argv,
	}
}

-
static void
+
void
pkgdb_split_uid(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
	pkgdb_split_common(ctx, argc, argv, '~', "name", "origin");
}

-
static void
+
void
pkgdb_split_version(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
	pkgdb_split_common(ctx, argc, argv, '-', "name", "version");
}

-
static void
+
void
pkgdb_regex_delete(void *p)
{
	regex_t	*re = (regex_t *)p;
@@ -186,7 +180,7 @@ pkgdb_regex_delete(void *p)
	free(re);
}

-
static void
+
void
pkgdb_now(sqlite3_context *ctx, int argc, __unused sqlite3_value **argv)
{
	if (argc != 0) {
@@ -198,7 +192,7 @@ pkgdb_now(sqlite3_context *ctx, int argc, __unused sqlite3_value **argv)
	sqlite3_result_int64(ctx, (int64_t)time(NULL));
}

-
static void
+
void
pkgdb_myarch(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
	const unsigned char	*arch = NULL;
@@ -963,7 +957,7 @@ pkgdb_open_all(struct pkgdb **db_p, pkgdb_t type, const char *reponame)
		}

		/* Create our functions */
-
		sqlcmd_init(db->sqlite, NULL, NULL);
+
		pkgdb_sqlcmd_init(db->sqlite, NULL, NULL);

		if (pkgdb_upgrade(db) != EPKG_OK) {
			pkgdb_close(db);
@@ -2715,8 +2709,8 @@ pkgdb_file_set_cksum(struct pkgdb *db, struct pkg_file *file,
 * create our custom functions in the sqlite3 connection.
 * Used both in the shell and pkgdb_open
 */
-
static int
-
sqlcmd_init(sqlite3 *db, __unused const char **err, 
+
int
+
pkgdb_sqlcmd_init(sqlite3 *db, __unused const char **err, 
	    __unused const void *noused)
{
	sqlite3_create_function(db, "now", 0, SQLITE_ANY, NULL,
@@ -2748,7 +2742,7 @@ pkgshell_open(const char **reponame)
	char		 localpath[MAXPATHLEN];
	const char	*dbdir;

-
	sqlite3_auto_extension((void(*)(void))sqlcmd_init);
+
	sqlite3_auto_extension((void(*)(void))pkgdb_sqlcmd_init);

	dbdir = pkg_object_string(pkg_config_get("PKG_DBDIR"));

modified libpkg/private/pkgdb.h
@@ -156,4 +156,15 @@ int pkgdb_end_solver(struct pkgdb *db);
 */
int pkgdb_check_access(unsigned mode, const char* dbdir, const char *dbname);

+
/*
+
 * SQLite utility functions
+
 */
+
void pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv);
+
void pkgdb_regex_delete(void *p);
+
void pkgdb_split_uid(sqlite3_context *ctx, int argc, sqlite3_value **argv);
+
void pkgdb_split_version(sqlite3_context *ctx, int argc, sqlite3_value **argv);
+
void pkgdb_now(sqlite3_context *ctx, int argc, __unused sqlite3_value **argv);
+
void pkgdb_myarch(sqlite3_context *ctx, int argc, sqlite3_value **argv);
+
int pkgdb_sqlcmd_init(sqlite3 *db, const char **err, const void *noused);
+

#endif
modified libpkg/repo/binary/init.c
@@ -479,6 +479,8 @@ pkg_repo_binary_init(struct pkg_repo *repo)
	if (retcode != EPKG_OK)
		return (retcode);

+
	pkgdb_sqlcmd_init(sqlite, NULL, NULL);
+

	repo->priv = sqlite;

	return (EPKG_OK);
@@ -497,10 +499,6 @@ pkg_repo_binary_close(struct pkg_repo *repo, bool commit)
		if (pkgdb_transaction_commit(sqlite, NULL) != SQLITE_OK)
			retcode = EPKG_FATAL;
	}
-
	else {
-
		if (pkgdb_transaction_rollback(sqlite, NULL) != SQLITE_OK)
-
				retcode = EPKG_FATAL;
-
	}

	pkg_repo_binary_finalize_prstatements();
	sqlite3_free(sqlite);
modified src/Makefile.am
@@ -44,7 +44,8 @@ pkg_CFLAGS= -I$(top_srcdir)/libpkg \
			-I$(top_srcdir)/external/expat/lib \
			-DGITHASH=\"$(GIT_HEAD)\"
pkg_static_SOURCES=
-
pkg_static_LDADD=	$(top_builddir)/libpkg/libpkg_static.la \
+
pkg_static_LDADD= @REPOS_LDADD_STATIC@ \	
+
			$(top_builddir)/libpkg/libpkg_static.la \
			$(top_builddir)/external/libexpat_static.la \
			$(pkg_OBJECTS) \
			@LIBJAIL_LIB@ \