[Midnightbsd-cvs] src [12187] stable/1.0/lib/libmport: Update mport tool with latest from current.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Feb 23 17:10:35 EST 2019
Revision: 12187
http://svnweb.midnightbsd.org/src/?rev=12187
Author: laffer1
Date: 2019-02-23 17:10:34 -0500 (Sat, 23 Feb 2019)
Log Message:
-----------
Update mport tool with latest from current. fixes memory free issue, adds region support
Modified Paths:
--------------
stable/1.0/lib/libmport/bundle_read_install_pkg.c
stable/1.0/lib/libmport/create_primative.c
stable/1.0/lib/libmport/index.c
stable/1.0/lib/libmport/mport_private.h
Modified: stable/1.0/lib/libmport/bundle_read_install_pkg.c
===================================================================
--- stable/1.0/lib/libmport/bundle_read_install_pkg.c 2019-02-23 22:09:01 UTC (rev 12186)
+++ stable/1.0/lib/libmport/bundle_read_install_pkg.c 2019-02-23 22:10:34 UTC (rev 12187)
@@ -530,7 +530,7 @@
if (e->owner != NULL && e->group != NULL && e->owner[0] != '\0' &&
e->group[0] != '\0') {
#ifdef DEBUG
- fprintf(stderr, "owner %s and group %s\n", fm_owner, fm_group);
+ fprintf(stderr, "owner %s and group %s\n", e->owner, e->group);
#endif
if (chown(file, mport_get_uid(e->owner),
mport_get_gid(e->group)) == -1) {
Modified: stable/1.0/lib/libmport/create_primative.c
===================================================================
--- stable/1.0/lib/libmport/create_primative.c 2019-02-23 22:09:01 UTC (rev 12186)
+++ stable/1.0/lib/libmport/create_primative.c 2019-02-23 22:10:34 UTC (rev 12187)
@@ -172,7 +172,7 @@
e->type == ASSET_FILE_OWNER_MODE) {
/* Don't prepend cwd onto absolute file paths (this is useful for update) */
if (e->data[0] == '/') {
- (void) strlcpy(file, e->data, FILENAME_MAX);
+ (void) snprintf(file, FILENAME_MAX, "%s%s", extra->sourcedir, e->data);
} else {
(void) snprintf(file, FILENAME_MAX, "%s/%s", cwd, e->data);
}
Modified: stable/1.0/lib/libmport/index.c
===================================================================
--- stable/1.0/lib/libmport/index.c 2019-02-23 22:09:01 UTC (rev 12186)
+++ stable/1.0/lib/libmport/index.c 2019-02-23 22:10:34 UTC (rev 12187)
@@ -36,6 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <stddef.h>
static int index_is_recentish(void);
static int index_last_checked_recentish(mportInstance *);
@@ -209,9 +210,15 @@
int ret, i;
int len;
sqlite3_stmt *stmt;
+ char *mirror_region;
+ mirror_region = mport_setting_get(mport, MPORT_SETTING_MIRROR_REGION);
+ if (mirror_region == NULL) {
+ mirror_region = "us";
+ }
+
/* XXX the country is hard coded until a configuration system is created */
- if (mport_db_count(mport->db, &len, "SELECT COUNT(*) FROM idx.mirrors WHERE country='us'") != MPORT_OK)
+ if (mport_db_count(mport->db, &len, "SELECT COUNT(*) FROM idx.mirrors WHERE country=%Q", mirror_region) != MPORT_OK)
RETURN_CURRENT_ERROR;
*list_size = len;
@@ -219,7 +226,7 @@
*list_p = list;
i = 0;
- if (mport_db_prepare(mport->db, &stmt, "SELECT mirror FROM idx.mirrors WHERE country='us'") != MPORT_OK) {
+ if (mport_db_prepare(mport->db, &stmt, "SELECT mirror FROM idx.mirrors WHERE country=%Q", mirror_region) != MPORT_OK) {
sqlite3_finalize(stmt);
RETURN_CURRENT_ERROR;
}
Modified: stable/1.0/lib/libmport/mport_private.h
===================================================================
--- stable/1.0/lib/libmport/mport_private.h 2019-02-23 22:09:01 UTC (rev 12186)
+++ stable/1.0/lib/libmport/mport_private.h 2019-02-23 22:10:34 UTC (rev 12187)
@@ -47,6 +47,8 @@
#define MPORT_BUNDLE_VERSION 5
#define MPORT_BUNDLE_VERSION_STR "5"
+#define MPORT_SETTING_MIRROR_REGION "mirror_region"
+
/* callback syntaxtic sugar */
void mport_call_msg_cb(mportInstance *, const char *, ...);
void mport_call_progress_init_cb(mportInstance *, const char *, ...);
@@ -172,7 +174,11 @@
#error "Unable to detect arch!"
#endif
-#if __MidnightBSD_version >= 100000
+#if __MidnightBSD_version >= 102000
+#define MPORT_OSVERSION "1.2"
+#elif __MidnightBSD_version >= 101000
+#define MPORT_OSVERSION "1.1"
+#elif __MidnightBSD_version >= 100000
#define MPORT_OSVERSION "1.0"
#elif __MidnightBSD_version >= 9000
#define MPORT_OSVERSION "0.9"
More information about the Midnightbsd-cvs
mailing list