[Midnightbsd-cvs] src: create_pkg.c: We now break up the conflict and depend inputs when
ctriv at midnightbsd.org
ctriv at midnightbsd.org
Wed Sep 26 23:27:18 EDT 2007
Log Message:
-----------
We now break up the conflict and depend inputs when they are inserted into
the stub db.
Modified Files:
--------------
src/lib/libmport:
create_pkg.c (r1.4 -> r1.5)
-------------- next part --------------
Index: create_pkg.c
===================================================================
RCS file: /home/cvs/src/lib/libmport/create_pkg.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Llib/libmport/create_pkg.c -Llib/libmport/create_pkg.c -u -r1.4 -r1.5
--- lib/libmport/create_pkg.c
+++ lib/libmport/create_pkg.c
@@ -227,8 +227,9 @@
static int insert_conflicts(sqlite3 *db, mportPackageMeta *pack)
{
sqlite3_stmt *stmnt;
- char sql[] = "INSERT INTO depends (pkg, depend) VALUES (?,?)";
+ char sql[] = "INSERT INTO conflicts (pkg, conflict_pkg, conflict_version) VALUES (?,?,?)";
char **conflict = pack->conflicts;
+ char *version;
const char *rest = 0;
/* we're done if there are no conflicts to record. */
@@ -239,13 +240,21 @@
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
+ /* we have a conflict like apache-1.4. We want to do a m/(.*)-(.*)/ */
while (*conflict != NULL) {
+ version = rindex(*conflict, '-');
+ *version = '\0';
+ version++;
+
if (sqlite3_bind_text(stmnt, 1, pack->name, -1, SQLITE_STATIC) != SQLITE_OK) {
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
if (sqlite3_bind_text(stmnt, 2, *conflict, -1, SQLITE_STATIC) != SQLITE_OK) {
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
+ if (sqlite3_bind_text(stmnt, 3, version, -1, SQLITE_STATIC) != SQLITE_OK) {
+ RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
+ }
if (sqlite3_step(stmnt) != SQLITE_DONE) {
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
@@ -263,8 +272,10 @@
static int insert_depends(sqlite3 *db, mportPackageMeta *pack)
{
sqlite3_stmt *stmnt;
- char sql[] = "INSERT INTO depends (pkg, depend) VALUES (?,?)";
+ char sql[] = "INSERT INTO depends (pkg, depend_pkgname, depend_pkgversion, depend_port) VALUES (?,?,?,?)";
char **depend = pack->depends;
+ char *pkgversion;
+ char *port;
const char *rest = 0;
/* we're done if there are no deps to record. */
@@ -275,13 +286,31 @@
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
+
+ /* depends look like this. break'em up into port, pkgversion and pkgname
+ * perl-5.8.8_1:lang/perl5.8
+ */
while (*depend != NULL) {
+ port = rindex(*depend, ':');
+ *port = '\0';
+ port++;
+
+ pkgversion = rindex(*depend, '-');
+ *pkgversion = '\0';
+ pkgversion++;
+
if (sqlite3_bind_text(stmnt, 1, pack->name, -1, SQLITE_STATIC) != SQLITE_OK) {
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
if (sqlite3_bind_text(stmnt, 2, *depend, -1, SQLITE_STATIC) != SQLITE_OK) {
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
+ if (sqlite3_bind_text(stmnt, 3, pkgversion, -1, SQLITE_STATIC) != SQLITE_OK) {
+ RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
+ }
+ if (sqlite3_bind_text(stmnt, 4, port, -1, SQLITE_STATIC) != SQLITE_OK) {
+ RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
+ }
if (sqlite3_step(stmnt) != SQLITE_DONE) {
RETURN_ERROR(MPORT_ERR_SQLITE, sqlite3_errmsg(db));
}
More information about the Midnightbsd-cvs
mailing list