[Midnightbsd-cvs] src [6497] trunk/lib/libmport: treat packages of a different os release as updatable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Dec 15 01:44:14 EST 2013
Revision: 6497
http://svnweb.midnightbsd.org/src/?rev=6497
Author: laffer1
Date: 2013-12-15 01:44:13 -0500 (Sun, 15 Dec 2013)
Log Message:
-----------
treat packages of a different os release as updatable
Modified Paths:
--------------
trunk/lib/libmport/check_preconditions.c
trunk/lib/libmport/update_primative.c
Modified: trunk/lib/libmport/check_preconditions.c
===================================================================
--- trunk/lib/libmport/check_preconditions.c 2013-12-15 06:32:39 UTC (rev 6496)
+++ trunk/lib/libmport/check_preconditions.c 2013-12-15 06:44:13 UTC (rev 6497)
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__MBSDID("$MidnightBSD$");
+#include <string.h>
+
#include "mport.h"
#include "mport_private.h"
@@ -71,9 +73,10 @@
{
sqlite3_stmt *stmt;
const char *inst_version;
+ const char *os_release;
/* check if the package is already installed */
- if (mport_db_prepare(db, &stmt, "SELECT version FROM packages WHERE pkg=%Q", pack->name) != MPORT_OK)
+ if (mport_db_prepare(db, &stmt, "SELECT version, os_release FROM packages WHERE pkg=%Q", pack->name) != MPORT_OK)
RETURN_CURRENT_ERROR;
switch (sqlite3_step(stmt)) {
@@ -83,6 +86,11 @@
case SQLITE_ROW:
/* Row was found */
inst_version = sqlite3_column_text(stmt, 0);
+ os_release = sqlite3_column_text(stmt, 1);
+
+ /* Different os release version should not be considered the same package */
+ if (strcmp(os_release, mport_get_osrelease()) != 0)
+ break;
SET_ERRORX(MPORT_ERR_FATAL, "%s (version %s) is already installed.", pack->name, inst_version);
sqlite3_finalize(stmt);
Modified: trunk/lib/libmport/update_primative.c
===================================================================
--- trunk/lib/libmport/update_primative.c 2013-12-15 06:32:39 UTC (rev 6496)
+++ trunk/lib/libmport/update_primative.c 2013-12-15 06:44:13 UTC (rev 6497)
@@ -31,10 +31,12 @@
#include "mport_private.h"
#include <string.h>
#include <stdlib.h>
+
static int set_prefix_to_installed(mportInstance *, mportPackageMeta *);
-MPORT_PUBLIC_API int mport_update_primative(mportInstance *mport, const char *filename)
+MPORT_PUBLIC_API int
+mport_update_primative(mportInstance *mport, const char *filename)
{
mportBundleRead *bundle;
mportPackageMeta **pkgs, *pkg;
@@ -74,7 +76,8 @@
return MPORT_OK;
}
-static int set_prefix_to_installed(mportInstance *mport, mportPackageMeta *pkg)
+static int
+set_prefix_to_installed(mportInstance *mport, mportPackageMeta *pkg)
{
sqlite3_stmt *stmt;
int ret = MPORT_OK;
More information about the Midnightbsd-cvs
mailing list