lib: change xbps_dbg_printf to not require xbps_handle
This allows to simplify a lot of code by not having to pass around the xbps handle everywhere just to print some debug information.
This commit is contained in:
parent
1a3d1ea56c
commit
de484e9369
@ -196,8 +196,7 @@ state_cb(const struct xbps_state_cb_data *xscd, void *cbdata UNUSED)
|
|||||||
if (xscd->desc)
|
if (xscd->desc)
|
||||||
printf("%s\n", xscd->desc);
|
printf("%s\n", xscd->desc);
|
||||||
else
|
else
|
||||||
xbps_dbg_printf(xscd->xhp,
|
xbps_dbg_printf("%s: unknown state %d\n", xscd->arg, xscd->state);
|
||||||
"%s: unknown state %d\n", xscd->arg, xscd->state);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -384,15 +384,15 @@ exec_transaction(struct xbps_handle *xhp, unsigned int maxcols, bool yes, bool d
|
|||||||
goto proceed;
|
goto proceed;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "Empty transaction dictionary: %s\n",
|
xbps_dbg_printf("Empty transaction dictionary: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
proceed:
|
proceed:
|
||||||
#ifdef FULL_DEBUG
|
#ifdef FULL_DEBUG
|
||||||
xbps_dbg_printf(xhp, "Dictionary before transaction happens:\n");
|
xbps_dbg_printf("Dictionary before transaction happens:\n");
|
||||||
xbps_dbg_printf_append(xhp, "%s",
|
xbps_dbg_printf_append("%s",
|
||||||
xbps_dictionary_externalize(xhp->transd));
|
xbps_dictionary_externalize(xhp->transd));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ repo_match_cb(struct xbps_handle *xhp,
|
|||||||
assert(bfile);
|
assert(bfile);
|
||||||
filesd = xbps_archive_fetch_plist(bfile, "/files.plist");
|
filesd = xbps_archive_fetch_plist(bfile, "/files.plist");
|
||||||
if (filesd == NULL) {
|
if (filesd == NULL) {
|
||||||
xbps_dbg_printf(xhp, "%s: couldn't fetch files.plist from %s: %s\n",
|
xbps_dbg_printf("%s: couldn't fetch files.plist from %s: %s\n",
|
||||||
pkgver, bfile, strerror(errno));
|
pkgver, bfile, strerror(errno));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ cat_file(struct xbps_handle *xhp, const char *pkg, const char *file)
|
|||||||
if (url == NULL)
|
if (url == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "matched pkg at %s\n", url);
|
xbps_dbg_printf("matched pkg at %s\n", url);
|
||||||
rv = xbps_archive_fetch_file_into_fd(url, file, STDOUT_FILENO);
|
rv = xbps_archive_fetch_file_into_fd(url, file, STDOUT_FILENO);
|
||||||
free(url);
|
free(url);
|
||||||
return rv;
|
return rv;
|
||||||
@ -317,7 +317,7 @@ repo_cat_file(struct xbps_handle *xhp, const char *pkg, const char *file)
|
|||||||
if (url == NULL)
|
if (url == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "matched pkg at %s\n", url);
|
xbps_dbg_printf("matched pkg at %s\n", url);
|
||||||
rv = xbps_archive_fetch_file_into_fd(url, file, STDOUT_FILENO);
|
rv = xbps_archive_fetch_file_into_fd(url, file, STDOUT_FILENO);
|
||||||
free(url);
|
free(url);
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -88,7 +88,7 @@ cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
|||||||
}
|
}
|
||||||
if (strcmp(binpkgarch, xhp->target_arch ? xhp->target_arch : xhp->native_arch) != 0 &&
|
if (strcmp(binpkgarch, xhp->target_arch ? xhp->target_arch : xhp->native_arch) != 0 &&
|
||||||
strcmp(binpkgarch, "noarch") != 0) {
|
strcmp(binpkgarch, "noarch") != 0) {
|
||||||
xbps_dbg_printf(xhp, "%s: ignoring binpkg with unmatched arch\n", binpkg);
|
xbps_dbg_printf("%s: ignoring binpkg with unmatched arch\n", binpkg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ clean_cachedir(struct xbps_handle *xhp, bool drun)
|
|||||||
if ((ext = strrchr(dp->d_name, '.')) == NULL)
|
if ((ext = strrchr(dp->d_name, '.')) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(ext, ".xbps")) {
|
if (strcmp(ext, ".xbps")) {
|
||||||
xbps_dbg_printf(xhp, "ignoring unknown file: %s\n", dp->d_name);
|
xbps_dbg_printf("ignoring unknown file: %s\n", dp->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
xbps_array_add_cstring(array, dp->d_name);
|
xbps_array_add_cstring(array, dp->d_name);
|
||||||
|
@ -46,7 +46,7 @@ struct CleanerCbInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
idx_cleaner_cb(struct xbps_handle *xhp,
|
idx_cleaner_cb(struct xbps_handle *xhp UNUSED,
|
||||||
xbps_object_t obj,
|
xbps_object_t obj,
|
||||||
const char *key UNUSED,
|
const char *key UNUSED,
|
||||||
void *arg,
|
void *arg,
|
||||||
@ -59,7 +59,7 @@ idx_cleaner_cb(struct xbps_handle *xhp,
|
|||||||
xbps_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
xbps_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
||||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "%s: checking %s [%s] ...\n", info->repourl, pkgver, arch);
|
xbps_dbg_printf("%s: checking %s [%s] ...\n", info->repourl, pkgver, arch);
|
||||||
|
|
||||||
filen = xbps_xasprintf("%s/%s.%s.xbps", info->repourl, pkgver, arch);
|
filen = xbps_xasprintf("%s/%s.%s.xbps", info->repourl, pkgver, arch);
|
||||||
if (access(filen, R_OK) == -1) {
|
if (access(filen, R_OK) == -1) {
|
||||||
|
@ -681,8 +681,10 @@ struct xbps_handle {
|
|||||||
int flags;
|
int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
void xbps_dbg_printf(struct xbps_handle *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
|
extern int xbps_debug_level;
|
||||||
void xbps_dbg_printf_append(struct xbps_handle *, const char *, ...)__attribute__ ((format (printf, 2, 3)));
|
|
||||||
|
void xbps_dbg_printf(const char *, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
void xbps_dbg_printf_append(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
||||||
void xbps_error_printf(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
void xbps_error_printf(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
||||||
void xbps_warn_printf(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
void xbps_warn_printf(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
42
lib/conf.c
42
lib/conf.c
@ -61,7 +61,7 @@ store_virtualpkg(struct xbps_handle *xhp, const char *path, size_t line, char *v
|
|||||||
*/
|
*/
|
||||||
p = strchr(val, ':');
|
p = strchr(val, ':');
|
||||||
if (p == NULL || p[1] == '\0') {
|
if (p == NULL || p[1] == '\0') {
|
||||||
xbps_dbg_printf(xhp, "%s: ignoring invalid "
|
xbps_dbg_printf("%s: ignoring invalid "
|
||||||
"virtualpkg option at line %zu\n", path, line);
|
"virtualpkg option at line %zu\n", path, line);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ store_virtualpkg(struct xbps_handle *xhp, const char *path, size_t line, char *v
|
|||||||
return -errno;
|
return -errno;
|
||||||
if (!xbps_dictionary_set_cstring(xhp->vpkgd_conf, val, p))
|
if (!xbps_dictionary_set_cstring(xhp->vpkgd_conf, val, p))
|
||||||
return -errno;
|
return -errno;
|
||||||
xbps_dbg_printf(xhp, "%s: added virtualpkg %s for %s\n", path, val, p);
|
xbps_dbg_printf("%s: added virtualpkg %s for %s\n", path, val, p);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ store_preserved_file(struct xbps_handle *xhp, const char *file)
|
|||||||
if (xbps_match_string_in_array(xhp->preserved_files, file))
|
if (xbps_match_string_in_array(xhp->preserved_files, file))
|
||||||
goto out;
|
goto out;
|
||||||
xbps_array_add_cstring(xhp->preserved_files, file);
|
xbps_array_add_cstring(xhp->preserved_files, file);
|
||||||
xbps_dbg_printf(xhp, "Added preserved file: %s\n", file);
|
xbps_dbg_printf("Added preserved file: %s\n", file);
|
||||||
goto out;
|
goto out;
|
||||||
} else if (rv != 0) {
|
} else if (rv != 0) {
|
||||||
goto out;
|
goto out;
|
||||||
@ -109,7 +109,7 @@ store_preserved_file(struct xbps_handle *xhp, const char *file)
|
|||||||
assert(p);
|
assert(p);
|
||||||
xbps_strlcpy(p, globbuf.gl_pathv[i] + strlen(xhp->rootdir), len);
|
xbps_strlcpy(p, globbuf.gl_pathv[i] + strlen(xhp->rootdir), len);
|
||||||
xbps_array_add_cstring(xhp->preserved_files, p);
|
xbps_array_add_cstring(xhp->preserved_files, p);
|
||||||
xbps_dbg_printf(xhp, "Added preserved file: %s (expanded from %s)\n", p, file);
|
xbps_dbg_printf("Added preserved file: %s (expanded from %s)\n", p, file);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@ -134,7 +134,7 @@ store_ignored_pkg(struct xbps_handle *xhp, const char *pkgname)
|
|||||||
assert(xhp->ignored_pkgs);
|
assert(xhp->ignored_pkgs);
|
||||||
}
|
}
|
||||||
xbps_array_add_cstring(xhp->ignored_pkgs, pkgname);
|
xbps_array_add_cstring(xhp->ignored_pkgs, pkgname);
|
||||||
xbps_dbg_printf(xhp, "Added ignored package: %s\n", pkgname);
|
xbps_dbg_printf("Added ignored package: %s\n", pkgname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -147,7 +147,7 @@ store_noextract(struct xbps_handle *xhp, const char *value)
|
|||||||
assert(xhp->noextract);
|
assert(xhp->noextract);
|
||||||
}
|
}
|
||||||
xbps_array_add_cstring(xhp->noextract, value);
|
xbps_array_add_cstring(xhp->noextract, value);
|
||||||
xbps_dbg_printf(xhp, "Added noextract pattern: %s\n", value);
|
xbps_dbg_printf("Added noextract pattern: %s\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -288,7 +288,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "Parsing configuration file: %s\n", path);
|
xbps_dbg_printf("Parsing configuration file: %s\n", path);
|
||||||
|
|
||||||
while ((rd = getline(&line, &len, fp)) != -1) {
|
while ((rd = getline(&line, &len, fp)) != -1) {
|
||||||
char *val = NULL;
|
char *val = NULL;
|
||||||
@ -310,7 +310,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
|
|
||||||
switch (parse_option(line, rd, &val, &vallen)) {
|
switch (parse_option(line, rd, &val, &vallen)) {
|
||||||
case KEY_ERROR:
|
case KEY_ERROR:
|
||||||
xbps_dbg_printf(xhp, "%s: ignoring invalid option at "
|
xbps_dbg_printf("%s: ignoring invalid option at "
|
||||||
"line %zu\n", path, nlines);
|
"line %zu\n", path, nlines);
|
||||||
continue;
|
continue;
|
||||||
case KEY_ROOTDIR:
|
case KEY_ROOTDIR:
|
||||||
@ -320,7 +320,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
rv = ENOMEM;
|
rv = ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: rootdir set to %s\n", path, val);
|
xbps_dbg_printf("%s: rootdir set to %s\n", path, val);
|
||||||
break;
|
break;
|
||||||
case KEY_CACHEDIR:
|
case KEY_CACHEDIR:
|
||||||
size = sizeof xhp->cachedir;
|
size = sizeof xhp->cachedir;
|
||||||
@ -329,7 +329,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
rv = ENOMEM;
|
rv = ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: cachedir set to %s\n", path, val);
|
xbps_dbg_printf("%s: cachedir set to %s\n", path, val);
|
||||||
break;
|
break;
|
||||||
case KEY_ARCHITECTURE:
|
case KEY_ARCHITECTURE:
|
||||||
size = sizeof xhp->native_arch;
|
size = sizeof xhp->native_arch;
|
||||||
@ -338,21 +338,21 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
rv = ENOMEM;
|
rv = ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: native architecture set to %s\n", path,
|
xbps_dbg_printf("%s: native architecture set to %s\n", path,
|
||||||
val);
|
val);
|
||||||
break;
|
break;
|
||||||
case KEY_SYSLOG:
|
case KEY_SYSLOG:
|
||||||
if (strcasecmp(val, "true") == 0) {
|
if (strcasecmp(val, "true") == 0) {
|
||||||
xhp->flags &= ~XBPS_FLAG_DISABLE_SYSLOG;
|
xhp->flags &= ~XBPS_FLAG_DISABLE_SYSLOG;
|
||||||
xbps_dbg_printf(xhp, "%s: syslog enabled\n", path);
|
xbps_dbg_printf("%s: syslog enabled\n", path);
|
||||||
} else {
|
} else {
|
||||||
xhp->flags |= XBPS_FLAG_DISABLE_SYSLOG;
|
xhp->flags |= XBPS_FLAG_DISABLE_SYSLOG;
|
||||||
xbps_dbg_printf(xhp, "%s: syslog disabled\n", path);
|
xbps_dbg_printf("%s: syslog disabled\n", path);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_REPOSITORY:
|
case KEY_REPOSITORY:
|
||||||
if (store_repo(xhp, val))
|
if (store_repo(xhp, val))
|
||||||
xbps_dbg_printf(xhp, "%s: added repository %s\n", path, val);
|
xbps_dbg_printf("%s: added repository %s\n", path, val);
|
||||||
break;
|
break;
|
||||||
case KEY_VIRTUALPKG:
|
case KEY_VIRTUALPKG:
|
||||||
rv = store_virtualpkg(xhp, path, nlines, val);
|
rv = store_virtualpkg(xhp, path, nlines, val);
|
||||||
@ -368,19 +368,19 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
case KEY_KEEPCONF:
|
case KEY_KEEPCONF:
|
||||||
if (strcasecmp(val, "true") == 0) {
|
if (strcasecmp(val, "true") == 0) {
|
||||||
xhp->flags |= XBPS_FLAG_KEEP_CONFIG;
|
xhp->flags |= XBPS_FLAG_KEEP_CONFIG;
|
||||||
xbps_dbg_printf(xhp, "%s: config preservation enabled\n", path);
|
xbps_dbg_printf("%s: config preservation enabled\n", path);
|
||||||
} else {
|
} else {
|
||||||
xhp->flags &= ~XBPS_FLAG_KEEP_CONFIG;
|
xhp->flags &= ~XBPS_FLAG_KEEP_CONFIG;
|
||||||
xbps_dbg_printf(xhp, "%s: config preservation disabled\n", path);
|
xbps_dbg_printf("%s: config preservation disabled\n", path);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_BESTMATCHING:
|
case KEY_BESTMATCHING:
|
||||||
if (strcasecmp(val, "true") == 0) {
|
if (strcasecmp(val, "true") == 0) {
|
||||||
xhp->flags |= XBPS_FLAG_BESTMATCH;
|
xhp->flags |= XBPS_FLAG_BESTMATCH;
|
||||||
xbps_dbg_printf(xhp, "%s: pkg best matching enabled\n", path);
|
xbps_dbg_printf("%s: pkg best matching enabled\n", path);
|
||||||
} else {
|
} else {
|
||||||
xhp->flags &= ~XBPS_FLAG_BESTMATCH;
|
xhp->flags &= ~XBPS_FLAG_BESTMATCH;
|
||||||
xbps_dbg_printf(xhp, "%s: pkg best matching disabled\n", path);
|
xbps_dbg_printf("%s: pkg best matching disabled\n", path);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_IGNOREPKG:
|
case KEY_IGNOREPKG:
|
||||||
@ -392,7 +392,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
|
|||||||
case KEY_INCLUDE:
|
case KEY_INCLUDE:
|
||||||
/* Avoid double-nested parsing, only allow it once */
|
/* Avoid double-nested parsing, only allow it once */
|
||||||
if (nested) {
|
if (nested) {
|
||||||
xbps_dbg_printf(xhp, "%s: ignoring nested include\n", path);
|
xbps_dbg_printf("%s: ignoring nested include\n", path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dir = strdup(path);
|
dir = strdup(path);
|
||||||
@ -418,12 +418,12 @@ xbps_conf_init(struct xbps_handle *xhp)
|
|||||||
assert(seen);
|
assert(seen);
|
||||||
|
|
||||||
if (*xhp->confdir) {
|
if (*xhp->confdir) {
|
||||||
xbps_dbg_printf(xhp, "Processing configuration directory: %s\n", xhp->confdir);
|
xbps_dbg_printf("Processing configuration directory: %s\n", xhp->confdir);
|
||||||
if ((rv = parse_files_glob(xhp, seen, xhp->confdir, "*.conf", false)))
|
if ((rv = parse_files_glob(xhp, seen, xhp->confdir, "*.conf", false)))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (*xhp->sysconfdir) {
|
if (*xhp->sysconfdir) {
|
||||||
xbps_dbg_printf(xhp, "Processing system configuration directory: %s\n", xhp->sysconfdir);
|
xbps_dbg_printf("Processing system configuration directory: %s\n", xhp->sysconfdir);
|
||||||
if ((rv = parse_files_glob(xhp, seen, xhp->sysconfdir, "*.conf", false)))
|
if ((rv = parse_files_glob(xhp, seen, xhp->sysconfdir, "*.conf", false)))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -172,12 +172,12 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
fio = fetchXGet(url, &url_st, fetch_flags);
|
fio = fetchXGet(url, &url_st, fetch_flags);
|
||||||
|
|
||||||
/* debug stuff */
|
/* debug stuff */
|
||||||
xbps_dbg_printf(xhp, "st.st_size: %zd\n", (ssize_t)stp->st_size);
|
xbps_dbg_printf("st.st_size: %zd\n", (ssize_t)stp->st_size);
|
||||||
xbps_dbg_printf(xhp, "st.st_atime: %s\n", print_time(&stp->st_atime));
|
xbps_dbg_printf("st.st_atime: %s\n", print_time(&stp->st_atime));
|
||||||
xbps_dbg_printf(xhp, "st.st_mtime: %s\n", print_time(&stp->st_mtime));
|
xbps_dbg_printf("st.st_mtime: %s\n", print_time(&stp->st_mtime));
|
||||||
xbps_dbg_printf(xhp, "url_stat.size: %zd\n", (ssize_t)url_st.size);
|
xbps_dbg_printf("url_stat.size: %zd\n", (ssize_t)url_st.size);
|
||||||
xbps_dbg_printf(xhp, "url_stat.atime: %s\n", print_time(&url_st.atime));
|
xbps_dbg_printf("url_stat.atime: %s\n", print_time(&url_st.atime));
|
||||||
xbps_dbg_printf(xhp, "url_stat.mtime: %s\n", print_time(&url_st.mtime));
|
xbps_dbg_printf("url_stat.mtime: %s\n", print_time(&url_st.mtime));
|
||||||
|
|
||||||
if (fio == NULL) {
|
if (fio == NULL) {
|
||||||
if (fetchLastErrCode == FETCH_UNCHANGED) {
|
if (fetchLastErrCode == FETCH_UNCHANGED) {
|
||||||
@ -191,7 +191,7 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
goto fetch_file_out;
|
goto fetch_file_out;
|
||||||
}
|
}
|
||||||
if (url_st.size == -1) {
|
if (url_st.size == -1) {
|
||||||
xbps_dbg_printf(xhp, "Remote file size is unknown, resume "
|
xbps_dbg_printf("Remote file size is unknown, resume "
|
||||||
"not possible...\n");
|
"not possible...\n");
|
||||||
restart = false;
|
restart = false;
|
||||||
} else if (stp->st_size > url_st.size) {
|
} else if (stp->st_size > url_st.size) {
|
||||||
@ -199,18 +199,18 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
* Remove local file if bigger than remote, and refetch the
|
* Remove local file if bigger than remote, and refetch the
|
||||||
* whole shit again.
|
* whole shit again.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "Local file %s is greater than remote, "
|
xbps_dbg_printf("Local file %s is greater than remote, "
|
||||||
"removing local file and refetching...\n", filename);
|
"removing local file and refetching...\n", filename);
|
||||||
(void)remove(tempfile);
|
(void)remove(tempfile);
|
||||||
restart = false;
|
restart = false;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "url->scheme: %s\n", url->scheme);
|
xbps_dbg_printf("url->scheme: %s\n", url->scheme);
|
||||||
xbps_dbg_printf(xhp, "url->host: %s\n", url->host);
|
xbps_dbg_printf("url->host: %s\n", url->host);
|
||||||
xbps_dbg_printf(xhp, "url->port: %d\n", url->port);
|
xbps_dbg_printf("url->port: %d\n", url->port);
|
||||||
xbps_dbg_printf(xhp, "url->doc: %s\n", url->doc);
|
xbps_dbg_printf("url->doc: %s\n", url->doc);
|
||||||
xbps_dbg_printf(xhp, "url->offset: %zd\n", (ssize_t)url->offset);
|
xbps_dbg_printf("url->offset: %zd\n", (ssize_t)url->offset);
|
||||||
xbps_dbg_printf(xhp, "url->length: %zu\n", url->length);
|
xbps_dbg_printf("url->length: %zu\n", url->length);
|
||||||
xbps_dbg_printf(xhp, "url->last_modified: %s\n",
|
xbps_dbg_printf("url->last_modified: %s\n",
|
||||||
print_time(&url->last_modified));
|
print_time(&url->last_modified));
|
||||||
/*
|
/*
|
||||||
* If restarting, open the file for appending otherwise create it.
|
* If restarting, open the file for appending otherwise create it.
|
||||||
@ -235,7 +235,7 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
SHA256_Update(&sha256, buf, bytes_read);
|
SHA256_Update(&sha256, buf, bytes_read);
|
||||||
}
|
}
|
||||||
if (bytes_read == -1) {
|
if (bytes_read == -1) {
|
||||||
xbps_dbg_printf(xhp, "IO error while reading %s: %s\n",
|
xbps_dbg_printf("IO error while reading %s: %s\n",
|
||||||
tempfile, strerror(errno));
|
tempfile, strerror(errno));
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
rv = -1;
|
rv = -1;
|
||||||
@ -260,8 +260,7 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
SHA256_Update(&sha256, buf, bytes_read);
|
SHA256_Update(&sha256, buf, bytes_read);
|
||||||
bytes_written = write(fd, buf, (size_t)bytes_read);
|
bytes_written = write(fd, buf, (size_t)bytes_read);
|
||||||
if (bytes_written != bytes_read) {
|
if (bytes_written != bytes_read) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf("Couldn't write to %s!\n", tempfile);
|
||||||
"Couldn't write to %s!\n", tempfile);
|
|
||||||
rv = -1;
|
rv = -1;
|
||||||
goto fetch_file_out;
|
goto fetch_file_out;
|
||||||
}
|
}
|
||||||
@ -275,13 +274,13 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
filename, false, true, false);
|
filename, false, true, false);
|
||||||
}
|
}
|
||||||
if (bytes_read == -1) {
|
if (bytes_read == -1) {
|
||||||
xbps_dbg_printf(xhp, "IO error while fetching %s: %s\n",
|
xbps_dbg_printf("IO error while fetching %s: %s\n",
|
||||||
filename, fetchLastErrString);
|
filename, fetchLastErrString);
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
rv = -1;
|
rv = -1;
|
||||||
goto fetch_file_out;
|
goto fetch_file_out;
|
||||||
} else if (url_st.size > 0 && ((bytes_dload + url->offset) != url_st.size)) {
|
} else if (url_st.size > 0 && ((bytes_dload + url->offset) != url_st.size)) {
|
||||||
xbps_dbg_printf(xhp, "file %s is truncated\n", filename);
|
xbps_dbg_printf("file %s is truncated\n", filename);
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
rv = -1;
|
rv = -1;
|
||||||
goto fetch_file_out;
|
goto fetch_file_out;
|
||||||
@ -311,7 +310,7 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
rename_file:
|
rename_file:
|
||||||
/* File downloaded successfully, rename to destfile */
|
/* File downloaded successfully, rename to destfile */
|
||||||
if (rename(tempfile, filename) == -1) {
|
if (rename(tempfile, filename) == -1) {
|
||||||
xbps_dbg_printf(xhp, "failed to rename %s to %s: %s",
|
xbps_dbg_printf("failed to rename %s to %s: %s",
|
||||||
tempfile, filename, strerror(errno));
|
tempfile, filename, strerror(errno));
|
||||||
rv = -1;
|
rv = -1;
|
||||||
goto fetch_file_out;
|
goto fetch_file_out;
|
||||||
|
4
lib/external/fexec.c
vendored
4
lib/external/fexec.c
vendored
@ -58,12 +58,12 @@ pfcexec(struct xbps_handle *xhp, const char *file, const char **argv)
|
|||||||
if (strcmp(xhp->rootdir, "/")) {
|
if (strcmp(xhp->rootdir, "/")) {
|
||||||
if ((geteuid() == 0) && (access("bin/sh", X_OK) == 0)) {
|
if ((geteuid() == 0) && (access("bin/sh", X_OK) == 0)) {
|
||||||
if (chroot(xhp->rootdir) == -1) {
|
if (chroot(xhp->rootdir) == -1) {
|
||||||
xbps_dbg_printf(xhp, "%s: chroot() "
|
xbps_dbg_printf("%s: chroot() "
|
||||||
"failed: %s\n", *argv, strerror(errno));
|
"failed: %s\n", *argv, strerror(errno));
|
||||||
_exit(errno);
|
_exit(errno);
|
||||||
}
|
}
|
||||||
if (chdir("/") == -1) {
|
if (chdir("/") == -1) {
|
||||||
xbps_dbg_printf(xhp, "%s: chdir() "
|
xbps_dbg_printf("%s: chdir() "
|
||||||
"failed: %s\n", *argv, strerror(errno));
|
"failed: %s\n", *argv, strerror(errno));
|
||||||
_exit(errno);
|
_exit(errno);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,10 @@ xbps_init(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
assert(xhp != NULL);
|
assert(xhp != NULL);
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "%s\n", XBPS_RELVER);
|
if (xhp->flags & XBPS_FLAG_DEBUG)
|
||||||
|
xbps_debug_level = 1;
|
||||||
|
|
||||||
|
xbps_dbg_printf("%s\n", XBPS_RELVER);
|
||||||
|
|
||||||
/* Set rootdir */
|
/* Set rootdir */
|
||||||
if (xhp->rootdir[0] == '\0') {
|
if (xhp->rootdir[0] == '\0') {
|
||||||
@ -151,23 +154,23 @@ xbps_init(struct xbps_handle *xhp)
|
|||||||
if (xbps_path_clean(xhp->metadir) == -1)
|
if (xbps_path_clean(xhp->metadir) == -1)
|
||||||
return ENOTSUP;
|
return ENOTSUP;
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "rootdir=%s\n", xhp->rootdir);
|
xbps_dbg_printf("rootdir=%s\n", xhp->rootdir);
|
||||||
xbps_dbg_printf(xhp, "metadir=%s\n", xhp->metadir);
|
xbps_dbg_printf("metadir=%s\n", xhp->metadir);
|
||||||
xbps_dbg_printf(xhp, "cachedir=%s\n", xhp->cachedir);
|
xbps_dbg_printf("cachedir=%s\n", xhp->cachedir);
|
||||||
xbps_dbg_printf(xhp, "confdir=%s\n", xhp->confdir);
|
xbps_dbg_printf("confdir=%s\n", xhp->confdir);
|
||||||
xbps_dbg_printf(xhp, "sysconfdir=%s\n", xhp->sysconfdir);
|
xbps_dbg_printf("sysconfdir=%s\n", xhp->sysconfdir);
|
||||||
xbps_dbg_printf(xhp, "syslog=%s\n", xhp->flags & XBPS_FLAG_DISABLE_SYSLOG ? "false" : "true");
|
xbps_dbg_printf("syslog=%s\n", xhp->flags & XBPS_FLAG_DISABLE_SYSLOG ? "false" : "true");
|
||||||
xbps_dbg_printf(xhp, "bestmatching=%s\n", xhp->flags & XBPS_FLAG_BESTMATCH ? "true" : "false");
|
xbps_dbg_printf("bestmatching=%s\n", xhp->flags & XBPS_FLAG_BESTMATCH ? "true" : "false");
|
||||||
xbps_dbg_printf(xhp, "keepconf=%s\n", xhp->flags & XBPS_FLAG_KEEP_CONFIG ? "true" : "false");
|
xbps_dbg_printf("keepconf=%s\n", xhp->flags & XBPS_FLAG_KEEP_CONFIG ? "true" : "false");
|
||||||
xbps_dbg_printf(xhp, "Architecture: %s\n", xhp->native_arch);
|
xbps_dbg_printf("Architecture: %s\n", xhp->native_arch);
|
||||||
xbps_dbg_printf(xhp, "Target Architecture: %s\n", xhp->target_arch ? xhp->target_arch : "(null)");
|
xbps_dbg_printf("Target Architecture: %s\n", xhp->target_arch ? xhp->target_arch : "(null)");
|
||||||
|
|
||||||
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
||||||
const char *repodir;
|
const char *repodir;
|
||||||
for (unsigned int i = 0; i < xbps_array_count(xhp->repositories); i++) {
|
for (unsigned int i = 0; i < xbps_array_count(xhp->repositories); i++) {
|
||||||
if (!xbps_array_get_cstring_nocopy(xhp->repositories, i, &repodir))
|
if (!xbps_array_get_cstring_nocopy(xhp->repositories, i, &repodir))
|
||||||
return errno;
|
return errno;
|
||||||
xbps_dbg_printf(xhp, "Repository[%u]=%s\n", i, repodir);
|
xbps_dbg_printf("Repository[%u]=%s\n", i, repodir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
lib/log.c
16
lib/log.c
@ -34,6 +34,8 @@
|
|||||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int xbps_debug_level = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file lib/log.c
|
* @file lib/log.c
|
||||||
* @brief Logging functions
|
* @brief Logging functions
|
||||||
@ -52,14 +54,11 @@ common_printf(FILE *f, const char *msg, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xbps_dbg_printf_append(struct xbps_handle *xhp, const char *fmt, ...)
|
xbps_dbg_printf_append(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (!xhp)
|
if (xbps_debug_level == 0)
|
||||||
return;
|
|
||||||
|
|
||||||
if ((xhp->flags & XBPS_FLAG_DEBUG) == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
@ -68,14 +67,11 @@ xbps_dbg_printf_append(struct xbps_handle *xhp, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xbps_dbg_printf(struct xbps_handle *xhp, const char *fmt, ...)
|
xbps_dbg_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (!xhp)
|
if (xbps_debug_level == 0)
|
||||||
return;
|
|
||||||
|
|
||||||
if ((xhp->flags & XBPS_FLAG_DEBUG) == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
@ -181,7 +181,7 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
|||||||
dir = xbps_xasprintf("%s/%s", xhp->rootdir, dir);
|
dir = xbps_xasprintf("%s/%s", xhp->rootdir, dir);
|
||||||
if (strcmp(dir, ".") && xbps_mkpath(dir, 0755) && errno != EEXIST) {
|
if (strcmp(dir, ".") && xbps_mkpath(dir, 0755) && errno != EEXIST) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"failed to create target dir '%s' for group '%s': %s\n",
|
"failed to create target dir '%s' for group '%s': %s\n",
|
||||||
dir, grname, strerror(errno));
|
dir, grname, strerror(errno));
|
||||||
free(dir);
|
free(dir);
|
||||||
@ -194,7 +194,7 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
|||||||
dir = dirname(p);
|
dir = dirname(p);
|
||||||
if (strcmp(dir, ".") && xbps_mkpath(dir, 0755) && errno != EEXIST) {
|
if (strcmp(dir, ".") && xbps_mkpath(dir, 0755) && errno != EEXIST) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"failed to create symlink dir '%s' for group '%s': %s\n",
|
"failed to create symlink dir '%s' for group '%s': %s\n",
|
||||||
dir, grname, strerror(errno));
|
dir, grname, strerror(errno));
|
||||||
free(p);
|
free(p);
|
||||||
@ -214,7 +214,7 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
|||||||
|
|
||||||
unlink(linkpath);
|
unlink(linkpath);
|
||||||
if ((rv = symlink(target, linkpath)) != 0) {
|
if ((rv = symlink(target, linkpath)) != 0) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"failed to create alt symlink '%s' for group '%s': %s\n",
|
"failed to create alt symlink '%s' for group '%s': %s\n",
|
||||||
linkpath, grname, strerror(errno));
|
linkpath, grname, strerror(errno));
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -87,7 +87,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
* Get original hash for the file from current
|
* Get original hash for the file from current
|
||||||
* installed package.
|
* installed package.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: processing conf_file %s\n",
|
xbps_dbg_printf("%s: processing conf_file %s\n",
|
||||||
pkgver, entry_pname);
|
pkgver, entry_pname);
|
||||||
|
|
||||||
if (pkg_filesd == NULL || mysymlink) {
|
if (pkg_filesd == NULL || mysymlink) {
|
||||||
@ -98,7 +98,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
*/
|
*/
|
||||||
version = xbps_pkg_version(pkgver);
|
version = xbps_pkg_version(pkgver);
|
||||||
assert(version);
|
assert(version);
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s not currently "
|
xbps_dbg_printf("%s: conf_file %s not currently "
|
||||||
"installed, renaming to %s.new-%s\n", pkgver,
|
"installed, renaming to %s.new-%s\n", pkgver,
|
||||||
entry_pname, entry_pname, version);
|
entry_pname, entry_pname, version);
|
||||||
snprintf(buf, sizeof(buf), "%s.new-%s", entry_pname, version);
|
snprintf(buf, sizeof(buf), "%s.new-%s", entry_pname, version);
|
||||||
@ -126,7 +126,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
* First case: original hash not found, install new file.
|
* First case: original hash not found, install new file.
|
||||||
*/
|
*/
|
||||||
if (sha256_orig == NULL) {
|
if (sha256_orig == NULL) {
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s not installed\n",
|
xbps_dbg_printf("%s: conf_file %s not installed\n",
|
||||||
pkgver, entry_pname);
|
pkgver, entry_pname);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
goto out;
|
goto out;
|
||||||
@ -146,7 +146,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
/*
|
/*
|
||||||
* File not installed, install new one.
|
* File not installed, install new one.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s not "
|
xbps_dbg_printf("%s: conf_file %s not "
|
||||||
"installed\n", pkgver, entry_pname);
|
"installed\n", pkgver, entry_pname);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
break;
|
break;
|
||||||
@ -164,7 +164,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
if ((strcmp(sha256_orig, sha256_cur) == 0) &&
|
if ((strcmp(sha256_orig, sha256_cur) == 0) &&
|
||||||
(strcmp(sha256_orig, sha256_new) == 0) &&
|
(strcmp(sha256_orig, sha256_new) == 0) &&
|
||||||
(strcmp(sha256_cur, sha256_new) == 0)) {
|
(strcmp(sha256_cur, sha256_new) == 0)) {
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s orig = X, "
|
xbps_dbg_printf("%s: conf_file %s orig = X, "
|
||||||
"cur = X, new = X\n", pkgver, entry_pname);
|
"cur = X, new = X\n", pkgver, entry_pname);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
break;
|
break;
|
||||||
@ -209,7 +209,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
} else if ((strcmp(sha256_cur, sha256_new) == 0) &&
|
} else if ((strcmp(sha256_cur, sha256_new) == 0) &&
|
||||||
(strcmp(sha256_orig, sha256_new)) &&
|
(strcmp(sha256_orig, sha256_new)) &&
|
||||||
(strcmp(sha256_orig, sha256_cur))) {
|
(strcmp(sha256_orig, sha256_cur))) {
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s orig = X, "
|
xbps_dbg_printf("%s: conf_file %s orig = X, "
|
||||||
"cur = Y, new = Y\n", pkgver, entry_pname);
|
"cur = Y, new = Y\n", pkgver, entry_pname);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
break;
|
break;
|
||||||
@ -239,7 +239,7 @@ out:
|
|||||||
|
|
||||||
xbps_object_iterator_release(iter);
|
xbps_object_iterator_release(iter);
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s returned %d\n",
|
xbps_dbg_printf("%s: conf_file %s returned %d\n",
|
||||||
pkgver, entry_pname, rv);
|
pkgver, entry_pname, rv);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -66,14 +66,14 @@ xbps_configure_packages(struct xbps_handle *xhp, xbps_array_t ignpkgs)
|
|||||||
if (xbps_array_count(ignpkgs)) {
|
if (xbps_array_count(ignpkgs)) {
|
||||||
if ((xbps_match_string_in_array(ignpkgs, pkgver)) ||
|
if ((xbps_match_string_in_array(ignpkgs, pkgver)) ||
|
||||||
(xbps_match_pkgver_in_array(ignpkgs, pkgver))) {
|
(xbps_match_pkgver_in_array(ignpkgs, pkgver))) {
|
||||||
xbps_dbg_printf(xhp, "%s: ignoring pkg %s\n",
|
xbps_dbg_printf("%s: ignoring pkg %s\n",
|
||||||
__func__, pkgver);
|
__func__, pkgver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rv = xbps_configure_pkg(xhp, pkgver, true, false);
|
rv = xbps_configure_pkg(xhp, pkgver, true, false);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
xbps_dbg_printf(xhp, "%s: failed to configure %s: %s\n",
|
xbps_dbg_printf("%s: failed to configure %s: %s\n",
|
||||||
__func__, pkgver, strerror(rv));
|
__func__, pkgver, strerror(rv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -106,15 +106,15 @@ xbps_configure_pkg(struct xbps_handle *xhp,
|
|||||||
|
|
||||||
pkgd = xbps_pkgdb_get_pkg(xhp, p);
|
pkgd = xbps_pkgdb_get_pkg(xhp, p);
|
||||||
if (pkgd == NULL) {
|
if (pkgd == NULL) {
|
||||||
xbps_dbg_printf(xhp, "[configure] cannot find %s (%s) "
|
xbps_dbg_printf("[configure] cannot find %s (%s) "
|
||||||
"in pkgdb\n", p, pkgver);
|
"in pkgdb\n", p, pkgver);
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = xbps_pkg_state_dictionary(pkgd, &state);
|
rv = xbps_pkg_state_dictionary(pkgd, &state);
|
||||||
xbps_dbg_printf(xhp, "%s: state %d rv %d\n", pkgver, state, rv);
|
xbps_dbg_printf("%s: state %d rv %d\n", pkgver, state, rv);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
xbps_dbg_printf(xhp, "%s: [configure] failed to get "
|
xbps_dbg_printf("%s: [configure] failed to get "
|
||||||
"pkg state: %s\n", pkgver, strerror(rv));
|
"pkg state: %s\n", pkgver, strerror(rv));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ ordered_depends(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool rpool,
|
|||||||
}
|
}
|
||||||
if (curpkgd == NULL) {
|
if (curpkgd == NULL) {
|
||||||
/* package depends on missing dependencies */
|
/* package depends on missing dependencies */
|
||||||
xbps_dbg_printf(xhp, "%s: missing dependency '%s'\n", pkgver, curdep);
|
xbps_dbg_printf("%s: missing dependency '%s'\n", pkgver, curdep);
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ ordered_depends(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool rpool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (provides && xbps_match_pkgname_in_array(provides, curdepname)) {
|
if (provides && xbps_match_pkgname_in_array(provides, curdepname)) {
|
||||||
xbps_dbg_printf(xhp, "%s: ignoring dependency %s "
|
xbps_dbg_printf("%s: ignoring dependency %s "
|
||||||
"already in provides\n", pkgver, curdep);
|
"already in provides\n", pkgver, curdep);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ ordered_depends(struct xbps_handle *xhp, xbps_dictionary_t pkgd, bool rpool,
|
|||||||
xitem = ordered_depends(xhp, curpkgd, rpool, depth+1);
|
xitem = ordered_depends(xhp, curpkgd, rpool, depth+1);
|
||||||
if (xitem == NULL) {
|
if (xitem == NULL) {
|
||||||
/* package depends on missing dependencies */
|
/* package depends on missing dependencies */
|
||||||
xbps_dbg_printf(xhp, "%s: missing dependency '%s'\n", pkgver, curdep);
|
xbps_dbg_printf("%s: missing dependency '%s'\n", pkgver, curdep);
|
||||||
errno = ENODEV;
|
errno = ENODEV;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -93,14 +93,14 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
|||||||
/* _XBPS_ALTERNATIVES_ */
|
/* _XBPS_ALTERNATIVES_ */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, " %s checking %s\n", __func__, pkgver);
|
xbps_dbg_printf(" %s checking %s\n", __func__, pkgver);
|
||||||
xbps_dictionary_get_bool(pkgd, "automatic-install", &automatic);
|
xbps_dictionary_get_bool(pkgd, "automatic-install", &automatic);
|
||||||
if (!automatic) {
|
if (!automatic) {
|
||||||
xbps_dbg_printf(xhp, " %s skipped (!automatic)\n", pkgver);
|
xbps_dbg_printf(" %s skipped (!automatic)\n", pkgver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (xbps_find_pkg_in_array(array, pkgver, 0)) {
|
if (xbps_find_pkg_in_array(array, pkgver, 0)) {
|
||||||
xbps_dbg_printf(xhp, " %s orphan (queued)\n", pkgver);
|
xbps_dbg_printf(" %s orphan (queued)\n", pkgver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
revdeps = xbps_pkgdb_get_pkg_revdeps(xhp, pkgver);
|
revdeps = xbps_pkgdb_get_pkg_revdeps(xhp, pkgver);
|
||||||
@ -109,7 +109,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
|||||||
if (revdepscnt == 0) {
|
if (revdepscnt == 0) {
|
||||||
added = true;
|
added = true;
|
||||||
xbps_array_add(array, pkgd);
|
xbps_array_add(array, pkgd);
|
||||||
xbps_dbg_printf(xhp, " %s orphan (automatic and !revdeps)\n", pkgver);
|
xbps_dbg_printf(" %s orphan (automatic and !revdeps)\n", pkgver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* verify all revdeps are seen */
|
/* verify all revdeps are seen */
|
||||||
@ -123,11 +123,11 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
|||||||
if (cnt == revdepscnt) {
|
if (cnt == revdepscnt) {
|
||||||
added = true;
|
added = true;
|
||||||
xbps_array_add(array, pkgd);
|
xbps_array_add(array, pkgd);
|
||||||
xbps_dbg_printf(xhp, " %s orphan (automatic and all revdeps)\n", pkgver);
|
xbps_dbg_printf(" %s orphan (automatic and all revdeps)\n", pkgver);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "orphans pkgdb iter: added %s\n", added ? "true" : "false");
|
xbps_dbg_printf("orphans pkgdb iter: added %s\n", added ? "true" : "false");
|
||||||
xbps_object_iterator_reset(iter);
|
xbps_object_iterator_reset(iter);
|
||||||
if (!added)
|
if (!added)
|
||||||
break;
|
break;
|
||||||
@ -164,7 +164,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, " processing rdeps for %s\n", pkgver);
|
xbps_dbg_printf(" processing rdeps for %s\n", pkgver);
|
||||||
for (unsigned int x = 0; x < xbps_array_count(rdeps); x++) {
|
for (unsigned int x = 0; x < xbps_array_count(rdeps); x++) {
|
||||||
xbps_array_t reqby;
|
xbps_array_t reqby;
|
||||||
xbps_dictionary_t deppkgd;
|
xbps_dictionary_t deppkgd;
|
||||||
@ -174,13 +174,13 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
|||||||
cnt = 0;
|
cnt = 0;
|
||||||
xbps_array_get_cstring_nocopy(rdeps, x, &deppkgver);
|
xbps_array_get_cstring_nocopy(rdeps, x, &deppkgver);
|
||||||
if (xbps_find_pkg_in_array(array, deppkgver, 0)) {
|
if (xbps_find_pkg_in_array(array, deppkgver, 0)) {
|
||||||
xbps_dbg_printf(xhp, " rdep %s already queued\n", deppkgver);
|
xbps_dbg_printf(" rdep %s already queued\n", deppkgver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
deppkgd = xbps_pkgdb_get_pkg(xhp, deppkgver);
|
deppkgd = xbps_pkgdb_get_pkg(xhp, deppkgver);
|
||||||
xbps_dictionary_get_bool(deppkgd, "automatic-install", &automatic);
|
xbps_dictionary_get_bool(deppkgd, "automatic-install", &automatic);
|
||||||
if (!automatic) {
|
if (!automatic) {
|
||||||
xbps_dbg_printf(xhp, " rdep %s skipped (!automatic)\n", deppkgver);
|
xbps_dbg_printf(" rdep %s skipped (!automatic)\n", deppkgver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,13 +190,13 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
|
|||||||
const char *reqbydep = NULL;
|
const char *reqbydep = NULL;
|
||||||
|
|
||||||
xbps_array_get_cstring_nocopy(reqby, j, &reqbydep);
|
xbps_array_get_cstring_nocopy(reqby, j, &reqbydep);
|
||||||
xbps_dbg_printf(xhp, " %s processing revdep %s\n", pkgver, reqbydep);
|
xbps_dbg_printf(" %s processing revdep %s\n", pkgver, reqbydep);
|
||||||
if (xbps_find_pkg_in_array(array, reqbydep, 0))
|
if (xbps_find_pkg_in_array(array, reqbydep, 0))
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
if (cnt == reqbycnt) {
|
if (cnt == reqbycnt) {
|
||||||
xbps_array_add(array, deppkgd);
|
xbps_array_add(array, deppkgd);
|
||||||
xbps_dbg_printf(xhp, " added %s orphan\n", deppkgver);
|
xbps_dbg_printf(" added %s orphan\n", deppkgver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
|||||||
* preserve its value.
|
* preserve its value.
|
||||||
*/
|
*/
|
||||||
if (autoinst && !xbps_dictionary_set_bool(pkgd, "automatic-install", true)) {
|
if (autoinst && !xbps_dictionary_set_bool(pkgd, "automatic-install", true)) {
|
||||||
xbps_dbg_printf(xhp, "%s: invalid autoinst for %s\n", __func__, pkgver);
|
xbps_dbg_printf("%s: invalid autoinst for %s\n", __func__, pkgver);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -77,19 +77,19 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
|||||||
*/
|
*/
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
if ((tmp = localtime_r(&t, &tm)) == NULL) {
|
if ((tmp = localtime_r(&t, &tm)) == NULL) {
|
||||||
xbps_dbg_printf(xhp, "%s: localtime_r failed: %s\n",
|
xbps_dbg_printf("%s: localtime_r failed: %s\n",
|
||||||
pkgver, strerror(errno));
|
pkgver, strerror(errno));
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (strftime(outstr, sizeof(outstr)-1, "%F %R %Z", tmp) == 0) {
|
if (strftime(outstr, sizeof(outstr)-1, "%F %R %Z", tmp) == 0) {
|
||||||
xbps_dbg_printf(xhp, "%s: strftime failed: %s\n",
|
xbps_dbg_printf("%s: strftime failed: %s\n",
|
||||||
pkgver, strerror(errno));
|
pkgver, strerror(errno));
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!xbps_dictionary_set_cstring(pkgd, "install-date", outstr)) {
|
if (!xbps_dictionary_set_cstring(pkgd, "install-date", outstr)) {
|
||||||
xbps_dbg_printf(xhp, "%s: install-date set failed!\n", pkgver);
|
xbps_dbg_printf("%s: install-date set failed!\n", pkgver);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -123,8 +123,7 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
|||||||
xbps_dictionary_remove(pkgd, "version");
|
xbps_dictionary_remove(pkgd, "version");
|
||||||
|
|
||||||
if (!xbps_dictionary_set(xhp->pkgdb, pkgname, pkgd)) {
|
if (!xbps_dictionary_set(xhp->pkgdb, pkgname, pkgd)) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf("%s: failed to set pkgd for %s\n", __func__, pkgver);
|
||||||
"%s: failed to set pkgd for %s\n", __func__, pkgver);
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
xbps_object_release(pkgd);
|
xbps_object_release(pkgd);
|
||||||
|
@ -128,16 +128,16 @@ xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update)
|
|||||||
|
|
||||||
if ((pkgd = xbps_pkgdb_get_pkg(xhp, pkgname)) == NULL) {
|
if ((pkgd = xbps_pkgdb_get_pkg(xhp, pkgname)) == NULL) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[remove] cannot find %s in pkgdb: %s\n",
|
xbps_dbg_printf("[remove] cannot find %s in pkgdb: %s\n",
|
||||||
pkgver, strerror(rv));
|
pkgver, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((rv = xbps_pkg_state_dictionary(pkgd, &state)) != 0) {
|
if ((rv = xbps_pkg_state_dictionary(pkgd, &state)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[remove] cannot find %s in pkgdb: %s\n",
|
xbps_dbg_printf("[remove] cannot find %s in pkgdb: %s\n",
|
||||||
pkgver, strerror(rv));
|
pkgver, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "attempting to remove %s state %d\n", pkgver, state);
|
xbps_dbg_printf("attempting to remove %s state %d\n", pkgver, state);
|
||||||
|
|
||||||
if (!update)
|
if (!update)
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE, 0, pkgver, NULL);
|
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE, 0, pkgver, NULL);
|
||||||
@ -223,7 +223,7 @@ purge:
|
|||||||
/*
|
/*
|
||||||
* Unregister package from pkgdb.
|
* Unregister package from pkgdb.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "[remove] unregister %s returned %d\n", pkgver, rv);
|
xbps_dbg_printf("[remove] unregister %s returned %d\n", pkgver, rv);
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_DONE, 0, pkgver, NULL);
|
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_DONE, 0, pkgver, NULL);
|
||||||
xbps_dictionary_remove(xhp->pkgdb, pkgname);
|
xbps_dictionary_remove(xhp->pkgdb, pkgname);
|
||||||
out:
|
out:
|
||||||
|
@ -57,7 +57,7 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
|||||||
assert(action);
|
assert(action);
|
||||||
|
|
||||||
if (xhp->target_arch) {
|
if (xhp->target_arch) {
|
||||||
xbps_dbg_printf(xhp, "%s: not executing %s "
|
xbps_dbg_printf("%s: not executing %s "
|
||||||
"install/remove action.\n", pkgver, action);
|
"install/remove action.\n", pkgver, action);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
|||||||
/* Create temp file to run script */
|
/* Create temp file to run script */
|
||||||
if ((fd = mkstemp(fpath)) == -1) {
|
if ((fd = mkstemp(fpath)) == -1) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "%s: mkstemp %s\n",
|
xbps_dbg_printf("%s: mkstemp %s\n",
|
||||||
__func__, strerror(errno));
|
__func__, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
|||||||
ret = write(fd, blob, blobsiz);
|
ret = write(fd, blob, blobsiz);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "%s: write %s\n",
|
xbps_dbg_printf("%s: write %s\n",
|
||||||
__func__, strerror(errno));
|
__func__, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -249,7 +249,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
* Skip files that match noextract patterns from configuration file.
|
* Skip files that match noextract patterns from configuration file.
|
||||||
*/
|
*/
|
||||||
if (xhp->noextract && xbps_patterns_match(xhp->noextract, entry_pname+1)) {
|
if (xhp->noextract && xbps_patterns_match(xhp->noextract, entry_pname+1)) {
|
||||||
xbps_dbg_printf(xhp, "[unpack] %s skipped (matched by a pattern)\n", entry_pname+1);
|
xbps_dbg_printf("[unpack] %s skipped (matched by a pattern)\n", entry_pname+1);
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
|
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
|
||||||
pkgver, "%s: file `%s' won't be extracted, "
|
pkgver, "%s: file `%s' won't be extracted, "
|
||||||
"it matches a noextract pattern.", pkgver, entry_pname);
|
"it matches a noextract pattern.", pkgver, entry_pname);
|
||||||
@ -270,7 +270,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
*/
|
*/
|
||||||
if (file_exists && match_preserved_file(xhp, entry_pname)) {
|
if (file_exists && match_preserved_file(xhp, entry_pname)) {
|
||||||
archive_read_data_skip(ar);
|
archive_read_data_skip(ar);
|
||||||
xbps_dbg_printf(xhp, "[unpack] `%s' exists on disk "
|
xbps_dbg_printf("[unpack] `%s' exists on disk "
|
||||||
"and must be preserved, skipping.\n", entry_pname);
|
"and must be preserved, skipping.\n", entry_pname);
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
|
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
|
||||||
pkgver, "%s: file `%s' won't be extracted, "
|
pkgver, "%s: file `%s' won't be extracted, "
|
||||||
@ -327,7 +327,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
xhp, binpkg_filesd, "files", buf);
|
xhp, binpkg_filesd, "files", buf);
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
/* error */
|
/* error */
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"%s: failed to check"
|
"%s: failed to check"
|
||||||
" hash for `%s': %s\n",
|
" hash for `%s': %s\n",
|
||||||
pkgver, entry_pname,
|
pkgver, entry_pname,
|
||||||
@ -337,7 +337,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
/*
|
/*
|
||||||
* hash match, skip extraction.
|
* hash match, skip extraction.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"%s: file %s "
|
"%s: file %s "
|
||||||
"matches existing SHA256, "
|
"matches existing SHA256, "
|
||||||
"skipping...\n",
|
"skipping...\n",
|
||||||
@ -358,14 +358,14 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
if (lchown(entry_pname,
|
if (lchown(entry_pname,
|
||||||
archive_entry_uid(entry),
|
archive_entry_uid(entry),
|
||||||
archive_entry_gid(entry)) != 0) {
|
archive_entry_gid(entry)) != 0) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"%s: failed "
|
"%s: failed "
|
||||||
"to set uid/gid to %"PRIu64":%"PRIu64" (%s)\n",
|
"to set uid/gid to %"PRIu64":%"PRIu64" (%s)\n",
|
||||||
pkgver, archive_entry_uid(entry),
|
pkgver, archive_entry_uid(entry),
|
||||||
archive_entry_gid(entry),
|
archive_entry_gid(entry),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "%s: entry %s changed "
|
xbps_dbg_printf("%s: entry %s changed "
|
||||||
"uid/gid to %"PRIu64":%"PRIu64".\n", pkgver, entry_pname,
|
"uid/gid to %"PRIu64":%"PRIu64".\n", pkgver, entry_pname,
|
||||||
archive_entry_uid(entry),
|
archive_entry_uid(entry),
|
||||||
archive_entry_gid(entry));
|
archive_entry_gid(entry));
|
||||||
@ -379,7 +379,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
(archive_entry_mode(entry) != st.st_mode)) {
|
(archive_entry_mode(entry) != st.st_mode)) {
|
||||||
if (chmod(entry_pname,
|
if (chmod(entry_pname,
|
||||||
archive_entry_mode(entry)) != 0) {
|
archive_entry_mode(entry)) != 0) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"%s: failed "
|
"%s: failed "
|
||||||
"to set perms %s to %s: %s\n",
|
"to set perms %s to %s: %s\n",
|
||||||
pkgver, archive_entry_strmode(entry),
|
pkgver, archive_entry_strmode(entry),
|
||||||
@ -388,7 +388,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: entry %s changed file "
|
xbps_dbg_printf("%s: entry %s changed file "
|
||||||
"mode to %s.\n", pkgver, entry_pname,
|
"mode to %s.\n", pkgver, entry_pname,
|
||||||
archive_entry_strmode(entry));
|
archive_entry_strmode(entry));
|
||||||
}
|
}
|
||||||
|
30
lib/pkgdb.c
30
lib/pkgdb.c
@ -82,7 +82,7 @@ xbps_pkgdb_lock(struct xbps_handle *xhp)
|
|||||||
}
|
}
|
||||||
if (xbps_mkpath(xhp->metadir, 0755) == -1) {
|
if (xbps_mkpath(xhp->metadir, 0755) == -1) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] failed to create metadir "
|
xbps_dbg_printf("[pkgdb] failed to create metadir "
|
||||||
"%s: %s\n", xhp->metadir, strerror(rv));
|
"%s: %s\n", xhp->metadir, strerror(rv));
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ xbps_pkgdb_lock(struct xbps_handle *xhp)
|
|||||||
xhp->pkgdb = xbps_dictionary_create();
|
xhp->pkgdb = xbps_dictionary_create();
|
||||||
if (!xbps_dictionary_externalize_to_file(xhp->pkgdb, xhp->pkgdb_plist)) {
|
if (!xbps_dictionary_externalize_to_file(xhp->pkgdb, xhp->pkgdb_plist)) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] failed to create pkgdb "
|
xbps_dbg_printf("[pkgdb] failed to create pkgdb "
|
||||||
"%s: %s\n", xhp->pkgdb_plist, strerror(rv));
|
"%s: %s\n", xhp->pkgdb_plist, strerror(rv));
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ xbps_pkgdb_lock(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
if ((pkgdb_fd = open(xhp->pkgdb_plist, O_CREAT|O_RDWR|O_CLOEXEC, 0664)) == -1) {
|
if ((pkgdb_fd = open(xhp->pkgdb_plist, O_CREAT|O_RDWR|O_CLOEXEC, 0664)) == -1) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] cannot open pkgdb for locking "
|
xbps_dbg_printf("[pkgdb] cannot open pkgdb for locking "
|
||||||
"%s: %s\n", xhp->pkgdb_plist, strerror(rv));
|
"%s: %s\n", xhp->pkgdb_plist, strerror(rv));
|
||||||
free(xhp->pkgdb_plist);
|
free(xhp->pkgdb_plist);
|
||||||
goto ret;
|
goto ret;
|
||||||
@ -110,14 +110,14 @@ xbps_pkgdb_lock(struct xbps_handle *xhp)
|
|||||||
*/
|
*/
|
||||||
if (lockf(pkgdb_fd, F_TLOCK, 0) == -1) {
|
if (lockf(pkgdb_fd, F_TLOCK, 0) == -1) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] cannot lock pkgdb: %s\n", strerror(rv));
|
xbps_dbg_printf("[pkgdb] cannot lock pkgdb: %s\n", strerror(rv));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Check if rootdir is writable.
|
* Check if rootdir is writable.
|
||||||
*/
|
*/
|
||||||
if (access(xhp->rootdir, W_OK) == -1) {
|
if (access(xhp->rootdir, W_OK) == -1) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] rootdir %s: %s\n", xhp->rootdir, strerror(rv));
|
xbps_dbg_printf("[pkgdb] rootdir %s: %s\n", xhp->rootdir, strerror(rv));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
@ -126,13 +126,13 @@ ret:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xbps_pkgdb_unlock(struct xbps_handle *xhp)
|
xbps_pkgdb_unlock(struct xbps_handle *xhp UNUSED)
|
||||||
{
|
{
|
||||||
xbps_dbg_printf(xhp, "%s: pkgdb_fd %d\n", __func__, pkgdb_fd);
|
xbps_dbg_printf("%s: pkgdb_fd %d\n", __func__, pkgdb_fd);
|
||||||
|
|
||||||
if (pkgdb_fd != -1) {
|
if (pkgdb_fd != -1) {
|
||||||
if (lockf(pkgdb_fd, F_ULOCK, 0) == -1)
|
if (lockf(pkgdb_fd, F_ULOCK, 0) == -1)
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] failed to unlock pkgdb: %s\n", strerror(errno));
|
xbps_dbg_printf("[pkgdb] failed to unlock pkgdb: %s\n", strerror(errno));
|
||||||
|
|
||||||
(void)close(pkgdb_fd);
|
(void)close(pkgdb_fd);
|
||||||
pkgdb_fd = -1;
|
pkgdb_fd = -1;
|
||||||
@ -182,12 +182,12 @@ pkgdb_map_vpkgs(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
xbps_array_get_cstring_nocopy(provides, i, &vpkg);
|
xbps_array_get_cstring_nocopy(provides, i, &vpkg);
|
||||||
if (!xbps_dictionary_set_cstring(xhp->vpkgd, vpkg, pkgname)) {
|
if (!xbps_dictionary_set_cstring(xhp->vpkgd, vpkg, pkgname)) {
|
||||||
xbps_dbg_printf(xhp, "%s: set_cstring vpkg "
|
xbps_dbg_printf("%s: set_cstring vpkg "
|
||||||
"%s pkgname %s\n", __func__, vpkg, pkgname);
|
"%s pkgname %s\n", __func__, vpkg, pkgname);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] added vpkg %s for %s\n", vpkg, pkgname);
|
xbps_dbg_printf("[pkgdb] added vpkg %s for %s\n", vpkg, pkgname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@ -258,21 +258,21 @@ xbps_pkgdb_init(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
if ((rv = xbps_pkgdb_update(xhp, false, true)) != 0) {
|
if ((rv = xbps_pkgdb_update(xhp, false, true)) != 0) {
|
||||||
if (rv != ENOENT)
|
if (rv != ENOENT)
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] cannot internalize "
|
xbps_dbg_printf("[pkgdb] cannot internalize "
|
||||||
"pkgdb dictionary: %s\n", strerror(rv));
|
"pkgdb dictionary: %s\n", strerror(rv));
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
if ((rv = pkgdb_map_names(xhp)) != 0) {
|
if ((rv = pkgdb_map_names(xhp)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] pkgdb_map_names %s\n", strerror(rv));
|
xbps_dbg_printf("[pkgdb] pkgdb_map_names %s\n", strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
if ((rv = pkgdb_map_vpkgs(xhp)) != 0) {
|
if ((rv = pkgdb_map_vpkgs(xhp)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] pkgdb_map_vpkgs %s\n", strerror(rv));
|
xbps_dbg_printf("[pkgdb] pkgdb_map_vpkgs %s\n", strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
assert(xhp->pkgdb);
|
assert(xhp->pkgdb);
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] initialized ok.\n");
|
xbps_dbg_printf("[pkgdb] initialized ok.\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ xbps_pkgdb_release(struct xbps_handle *xhp)
|
|||||||
xbps_pkgdb_unlock(xhp);
|
xbps_pkgdb_unlock(xhp);
|
||||||
if (xhp->pkgdb)
|
if (xhp->pkgdb)
|
||||||
xbps_object_release(xhp->pkgdb);
|
xbps_object_release(xhp->pkgdb);
|
||||||
xbps_dbg_printf(xhp, "[pkgdb] released ok.\n");
|
xbps_dbg_printf("[pkgdb] released ok.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -84,7 +84,7 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
|
|||||||
* Copy old pkgdb objects to the new pkgdb.
|
* Copy old pkgdb objects to the new pkgdb.
|
||||||
*/
|
*/
|
||||||
if (!xbps_dictionary_set(pkgdb, pkgname, pkgd)) {
|
if (!xbps_dictionary_set(pkgdb, pkgname, pkgd)) {
|
||||||
xbps_dbg_printf(xhp, "%s: failed to copy %s pkgd "
|
xbps_dbg_printf("%s: failed to copy %s pkgd "
|
||||||
"for pkgdb conversion\n", __func__, pkgname);
|
"for pkgdb conversion\n", __func__, pkgname);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -96,7 +96,7 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
|
|||||||
pkgmetad = xbps_plist_dictionary_from_file(xhp, pkgmeta);
|
pkgmetad = xbps_plist_dictionary_from_file(xhp, pkgmeta);
|
||||||
if (pkgmetad == NULL) {
|
if (pkgmetad == NULL) {
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
xbps_dbg_printf(xhp, "%s: cannot open %s: %s\n",
|
xbps_dbg_printf("%s: cannot open %s: %s\n",
|
||||||
__func__, pkgmeta, strerror(errno));
|
__func__, pkgmeta, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!xbps_dictionary_set(pkgd, key, curobj)) {
|
if (!xbps_dictionary_set(pkgd, key, curobj)) {
|
||||||
xbps_dbg_printf(xhp, "%s: failed to copy %s "
|
xbps_dbg_printf("%s: failed to copy %s "
|
||||||
"pkgd for pkgdb conversion\n", pkgname, key);
|
"pkgd for pkgdb conversion\n", pkgname, key);
|
||||||
xbps_object_iterator_release(iter2);
|
xbps_object_iterator_release(iter2);
|
||||||
xbps_object_release(pkgmetad);
|
xbps_object_release(pkgmetad);
|
||||||
@ -147,12 +147,12 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
|
|||||||
|
|
||||||
pkgfiles = xbps_xasprintf("%s/.%s-files.plist", xhp->metadir, pkgname);
|
pkgfiles = xbps_xasprintf("%s/.%s-files.plist", xhp->metadir, pkgname);
|
||||||
if (!xbps_dictionary_externalize_to_file(pkgfilesd, pkgfiles)) {
|
if (!xbps_dictionary_externalize_to_file(pkgfilesd, pkgfiles)) {
|
||||||
xbps_dbg_printf(xhp, "%s: failed to "
|
xbps_dbg_printf("%s: failed to "
|
||||||
"externalize %s: %s\n", __func__, pkgfiles, strerror(errno));
|
"externalize %s: %s\n", __func__, pkgfiles, strerror(errno));
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: externalized %s successfully\n", __func__, pkgfiles);
|
xbps_dbg_printf("%s: externalized %s successfully\n", __func__, pkgfiles);
|
||||||
/*
|
/*
|
||||||
* Update SHA56 hash for the pkg files plist.
|
* Update SHA56 hash for the pkg files plist.
|
||||||
*/
|
*/
|
||||||
@ -173,7 +173,7 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
|
|||||||
* Externalize the new pkgdb plist.
|
* Externalize the new pkgdb plist.
|
||||||
*/
|
*/
|
||||||
if (!xbps_dictionary_externalize_to_file(pkgdb, xhp->pkgdb_plist)) {
|
if (!xbps_dictionary_externalize_to_file(pkgdb, xhp->pkgdb_plist)) {
|
||||||
xbps_dbg_printf(xhp, "%s: failed to externalize %s: "
|
xbps_dbg_printf("%s: failed to externalize %s: "
|
||||||
"%s!\n", __func__, xhp->pkgdb_plist, strerror(errno));
|
"%s!\n", __func__, xhp->pkgdb_plist, strerror(errno));
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -262,7 +262,7 @@ vpkg_user_conf(struct xbps_handle *xhp, const char *vpkg, bool only_conf)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "%s: vpkg_conf %s pkg %s vpkgname %s\n", __func__, vpkg_conf, pkg, vpkgname);
|
xbps_dbg_printf("%s: vpkg_conf %s pkg %s vpkgname %s\n", __func__, vpkg_conf, pkg, vpkgname);
|
||||||
free(vpkgname);
|
free(vpkgname);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -940,7 +940,7 @@ xbps_plist_array_from_file(struct xbps_handle *xhp, const char *f)
|
|||||||
|
|
||||||
a = xbps_array_internalize_from_zfile(f);
|
a = xbps_array_internalize_from_zfile(f);
|
||||||
if (xbps_object_type(a) != XBPS_TYPE_ARRAY) {
|
if (xbps_object_type(a) != XBPS_TYPE_ARRAY) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"xbps: failed to internalize array from %s\n", f);
|
"xbps: failed to internalize array from %s\n", f);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
@ -953,7 +953,7 @@ xbps_plist_dictionary_from_file(struct xbps_handle *xhp, const char *f)
|
|||||||
|
|
||||||
d = xbps_dictionary_internalize_from_zfile(f);
|
d = xbps_dictionary_internalize_from_zfile(f);
|
||||||
if (xbps_object_type(d) != XBPS_TYPE_DICTIONARY) {
|
if (xbps_object_type(d) != XBPS_TYPE_DICTIONARY) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"xbps: failed to internalize dict from %s\n", f);
|
"xbps: failed to internalize dict from %s\n", f);
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
|
@ -88,20 +88,20 @@ xbps_pubkey2fp(struct xbps_handle *xhp, xbps_data_t pubkey)
|
|||||||
|
|
||||||
pPubKey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL);
|
pPubKey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL);
|
||||||
if (!pPubKey) {
|
if (!pPubKey) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"unable to decode public key from the given file: %s\n",
|
"unable to decode public key from the given file: %s\n",
|
||||||
ERR_error_string(ERR_get_error(), NULL));
|
ERR_error_string(ERR_get_error(), NULL));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EVP_PKEY_base_id(pPubKey) != EVP_PKEY_RSA) {
|
if (EVP_PKEY_base_id(pPubKey) != EVP_PKEY_RSA) {
|
||||||
xbps_dbg_printf(xhp, "only RSA public keys are currently supported\n");
|
xbps_dbg_printf("only RSA public keys are currently supported\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
pRsa = EVP_PKEY_get1_RSA(pPubKey);
|
pRsa = EVP_PKEY_get1_RSA(pPubKey);
|
||||||
if (!pRsa) {
|
if (!pRsa) {
|
||||||
xbps_dbg_printf(xhp, "failed to get RSA public key : %s\n",
|
xbps_dbg_printf("failed to get RSA public key : %s\n",
|
||||||
ERR_error_string(ERR_get_error(), NULL));
|
ERR_error_string(ERR_get_error(), NULL));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
45
lib/repo.c
45
lib/repo.c
@ -72,8 +72,7 @@ repo_get_dict(struct xbps_repo *repo)
|
|||||||
|
|
||||||
rv = archive_read_next_header(repo->ar, &entry);
|
rv = archive_read_next_header(repo->ar, &entry);
|
||||||
if (rv != ARCHIVE_OK) {
|
if (rv != ARCHIVE_OK) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("%s: read_next_header %s\n", repo->uri,
|
||||||
"%s: read_next_header %s\n", repo->uri,
|
|
||||||
archive_error_string(repo->ar));
|
archive_error_string(repo->ar));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -103,12 +102,12 @@ xbps_repo_lock(struct xbps_handle *xhp, const char *repodir,
|
|||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
break;
|
break;
|
||||||
if (rv != EEXIST) {
|
if (rv != EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' failed to "
|
xbps_dbg_printf("[repo] `%s' failed to "
|
||||||
"create lock file %s\n", lockfile, strerror(rv));
|
"create lock file %s\n", lockfile, strerror(rv));
|
||||||
free(lockfile);
|
free(lockfile);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' lock file exists,"
|
xbps_dbg_printf("[repo] `%s' lock file exists,"
|
||||||
"waiting for 1s...\n", lockfile);
|
"waiting for 1s...\n", lockfile);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
@ -136,7 +135,7 @@ repo_open_local(struct xbps_repo *repo, const char *repofile)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (fstat(repo->fd, &st) == -1) {
|
if (fstat(repo->fd, &st) == -1) {
|
||||||
xbps_dbg_printf(repo->xhp, "[repo] `%s' fstat repodata %s\n",
|
xbps_dbg_printf("[repo] `%s' fstat repodata %s\n",
|
||||||
repofile, strerror(errno));
|
repofile, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -151,13 +150,12 @@ repo_open_local(struct xbps_repo *repo, const char *repofile)
|
|||||||
archive_read_support_format_tar(repo->ar);
|
archive_read_support_format_tar(repo->ar);
|
||||||
|
|
||||||
if (archive_read_open_fd(repo->ar, repo->fd, st.st_blksize) == ARCHIVE_FATAL) {
|
if (archive_read_open_fd(repo->ar, repo->fd, st.st_blksize) == ARCHIVE_FATAL) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[repo] `%s' failed to open repodata archive %s\n",
|
||||||
"[repo] `%s' failed to open repodata archive %s\n",
|
|
||||||
repofile, archive_error_string(repo->ar));
|
repofile, archive_error_string(repo->ar));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((repo->idx = repo_get_dict(repo)) == NULL) {
|
if ((repo->idx = repo_get_dict(repo)) == NULL) {
|
||||||
xbps_dbg_printf(repo->xhp, "[repo] `%s' failed to internalize "
|
xbps_dbg_printf("[repo] `%s' failed to internalize "
|
||||||
" index on archive, removing file.\n", repofile);
|
" index on archive, removing file.\n", repofile);
|
||||||
/* broken archive, remove it */
|
/* broken archive, remove it */
|
||||||
(void)unlink(repofile);
|
(void)unlink(repofile);
|
||||||
@ -188,7 +186,7 @@ repo_open_remote(struct xbps_repo *repo)
|
|||||||
rv = xbps_repo_fetch_remote(repo, rpath);
|
rv = xbps_repo_fetch_remote(repo, rpath);
|
||||||
free(rpath);
|
free(rpath);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
xbps_dbg_printf(repo->xhp, "[repo] `%s' used remotely (kept in memory).\n", repo->uri);
|
xbps_dbg_printf("[repo] `%s' used remotely (kept in memory).\n", repo->uri);
|
||||||
if (repo->xhp->state_cb && xbps_repo_key_import(repo) != 0)
|
if (repo->xhp->state_cb && xbps_repo_key_import(repo) != 0)
|
||||||
rv = false;
|
rv = false;
|
||||||
}
|
}
|
||||||
@ -246,7 +244,7 @@ repo_open_with_type(struct xbps_handle *xhp, const char *url, const char *name)
|
|||||||
repo->fd = open(repofile, O_RDONLY|O_CLOEXEC);
|
repo->fd = open(repofile, O_RDONLY|O_CLOEXEC);
|
||||||
if (repo->fd == -1) {
|
if (repo->fd == -1) {
|
||||||
int rv = errno;
|
int rv = errno;
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' open %s %s\n",
|
xbps_dbg_printf("[repo] `%s' open %s %s\n",
|
||||||
repofile, name, strerror(rv));
|
repofile, name, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -279,17 +277,17 @@ xbps_repo_store(struct xbps_handle *xhp, const char *repo)
|
|||||||
if (!xbps_repository_is_remote(repo)) {
|
if (!xbps_repository_is_remote(repo)) {
|
||||||
if (repo[0] != '/' && repo[0] != '\0') {
|
if (repo[0] != '/' && repo[0] != '\0') {
|
||||||
if ((url = realpath(repo, NULL)) == NULL)
|
if ((url = realpath(repo, NULL)) == NULL)
|
||||||
xbps_dbg_printf(xhp, "[repo] %s: realpath %s\n", __func__, repo);
|
xbps_dbg_printf("[repo] %s: realpath %s\n", __func__, repo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (xbps_match_string_in_array(xhp->repositories, url ? url : repo)) {
|
if (xbps_match_string_in_array(xhp->repositories, url ? url : repo)) {
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' already stored\n", url ? url : repo);
|
xbps_dbg_printf("[repo] `%s' already stored\n", url ? url : repo);
|
||||||
if (url)
|
if (url)
|
||||||
free(url);
|
free(url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (xbps_array_add_cstring(xhp->repositories, url ? url : repo)) {
|
if (xbps_array_add_cstring(xhp->repositories, url ? url : repo)) {
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' stored successfully\n", url ? url : repo);
|
xbps_dbg_printf("[repo] `%s' stored successfully\n", url ? url : repo);
|
||||||
if (url)
|
if (url)
|
||||||
free(url);
|
free(url);
|
||||||
return true;
|
return true;
|
||||||
@ -315,7 +313,7 @@ xbps_repo_remove(struct xbps_handle *xhp, const char *repo)
|
|||||||
url = strdup(repo);
|
url = strdup(repo);
|
||||||
if (xbps_remove_string_from_array(xhp->repositories, repo)) {
|
if (xbps_remove_string_from_array(xhp->repositories, repo)) {
|
||||||
if (url)
|
if (url)
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' removed\n", url);
|
xbps_dbg_printf("[repo] `%s' removed\n", url);
|
||||||
rv = true;
|
rv = true;
|
||||||
}
|
}
|
||||||
free(url);
|
free(url);
|
||||||
@ -430,7 +428,7 @@ xbps_repo_get_virtualpkg(struct xbps_repo *repo, const char *pkg)
|
|||||||
if (!xbps_dictionary_set_cstring(pkgd, "pkgname", pkgname)) {
|
if (!xbps_dictionary_set_cstring(pkgd, "pkgname", pkgname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(repo->xhp, "%s: found %s\n", __func__, pkgver);
|
xbps_dbg_printf("%s: found %s\n", __func__, pkgver);
|
||||||
|
|
||||||
return pkgd;
|
return pkgd;
|
||||||
}
|
}
|
||||||
@ -470,7 +468,7 @@ add:
|
|||||||
if (!xbps_dictionary_set_cstring(pkgd, "pkgname", pkgname)) {
|
if (!xbps_dictionary_set_cstring(pkgd, "pkgname", pkgname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(repo->xhp, "%s: found %s\n", __func__, pkgver);
|
xbps_dbg_printf("%s: found %s\n", __func__, pkgver);
|
||||||
return pkgd;
|
return pkgd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,8 +635,7 @@ xbps_repo_key_import(struct xbps_repo *repo)
|
|||||||
* If repository does not have required metadata plist, ignore it.
|
* If repository does not have required metadata plist, ignore it.
|
||||||
*/
|
*/
|
||||||
if (!xbps_dictionary_count(repo->idxmeta)) {
|
if (!xbps_dictionary_count(repo->idxmeta)) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[repo] `%s' unsigned repository!\n", repo->uri);
|
||||||
"[repo] `%s' unsigned repository!\n", repo->uri);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -653,8 +650,7 @@ xbps_repo_key_import(struct xbps_repo *repo)
|
|||||||
|
|
||||||
if (signedby == NULL || pubkey_size == 0 ||
|
if (signedby == NULL || pubkey_size == 0 ||
|
||||||
xbps_object_type(pubkey) != XBPS_TYPE_DATA) {
|
xbps_object_type(pubkey) != XBPS_TYPE_DATA) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[repo] `%s': incomplete signed repository "
|
||||||
"[repo] `%s': incomplete signed repository "
|
|
||||||
"(missing objs)\n", repo->uri);
|
"(missing objs)\n", repo->uri);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -666,8 +662,7 @@ xbps_repo_key_import(struct xbps_repo *repo)
|
|||||||
rkeyfile = xbps_xasprintf("%s/keys/%s.plist", repo->xhp->metadir, hexfp);
|
rkeyfile = xbps_xasprintf("%s/keys/%s.plist", repo->xhp->metadir, hexfp);
|
||||||
repokeyd = xbps_plist_dictionary_from_file(repo->xhp, rkeyfile);
|
repokeyd = xbps_plist_dictionary_from_file(repo->xhp, rkeyfile);
|
||||||
if (xbps_object_type(repokeyd) == XBPS_TYPE_DICTIONARY) {
|
if (xbps_object_type(repokeyd) == XBPS_TYPE_DICTIONARY) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[repo] `%s' public key already stored.\n", repo->uri);
|
||||||
"[repo] `%s' public key already stored.\n", repo->uri);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -692,8 +687,7 @@ xbps_repo_key_import(struct xbps_repo *repo)
|
|||||||
rv = xbps_mkpath(dbkeyd, 0755);
|
rv = xbps_mkpath(dbkeyd, 0755);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[repo] `%s' cannot create %s: %s\n",
|
||||||
"[repo] `%s' cannot create %s: %s\n",
|
|
||||||
repo->uri, dbkeyd, strerror(errno));
|
repo->uri, dbkeyd, strerror(errno));
|
||||||
free(p);
|
free(p);
|
||||||
goto out;
|
goto out;
|
||||||
@ -708,8 +702,7 @@ xbps_repo_key_import(struct xbps_repo *repo)
|
|||||||
|
|
||||||
if (!xbps_dictionary_externalize_to_file(repokeyd, rkeyfile)) {
|
if (!xbps_dictionary_externalize_to_file(repokeyd, rkeyfile)) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[repo] `%s' failed to externalize %s: %s\n",
|
||||||
"[repo] `%s' failed to externalize %s: %s\n",
|
|
||||||
repo->uri, rkeyfile, strerror(rv));
|
repo->uri, rkeyfile, strerror(rv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
lib/rpool.c
19
lib/rpool.c
@ -70,7 +70,7 @@ xbps_rpool_sync(struct xbps_handle *xhp, const char *uri)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (xbps_repo_sync(xhp, repouri) == -1) {
|
if (xbps_repo_sync(xhp, repouri) == -1) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"[rpool] `%s' failed to fetch repository data: %s\n",
|
"[rpool] `%s' failed to fetch repository data: %s\n",
|
||||||
repouri, fetchLastErrCode == 0 ? strerror(errno) :
|
repouri, fetchLastErrCode == 0 ? strerror(errno) :
|
||||||
xbps_fetch_error_string());
|
xbps_fetch_error_string());
|
||||||
@ -98,7 +98,7 @@ xbps_regget_repo(struct xbps_handle *xhp, const char *url)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
SIMPLEQ_INSERT_TAIL(&rpool_queue, repo, entries);
|
SIMPLEQ_INSERT_TAIL(&rpool_queue, repo, entries);
|
||||||
xbps_dbg_printf(xhp, "[rpool] `%s' registered.\n", repouri);
|
xbps_dbg_printf("[rpool] `%s' registered.\n", repouri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SIMPLEQ_FOREACH(repo, &rpool_queue, entries)
|
SIMPLEQ_FOREACH(repo, &rpool_queue, entries)
|
||||||
@ -151,7 +151,7 @@ xbps_rpool_foreach(struct xbps_handle *xhp,
|
|||||||
again:
|
again:
|
||||||
for (unsigned int i = n; i < xbps_array_count(xhp->repositories); i++, n++) {
|
for (unsigned int i = n; i < xbps_array_count(xhp->repositories); i++, n++) {
|
||||||
xbps_array_get_cstring_nocopy(xhp->repositories, i, &repouri);
|
xbps_array_get_cstring_nocopy(xhp->repositories, i, &repouri);
|
||||||
xbps_dbg_printf(xhp, "[rpool] checking `%s' at index %u\n", repouri, n);
|
xbps_dbg_printf("[rpool] checking `%s' at index %u\n", repouri, n);
|
||||||
if ((repo = xbps_rpool_get_repo(repouri)) == NULL) {
|
if ((repo = xbps_rpool_get_repo(repouri)) == NULL) {
|
||||||
repo = xbps_repo_open(xhp, repouri);
|
repo = xbps_repo_open(xhp, repouri);
|
||||||
if (!repo) {
|
if (!repo) {
|
||||||
@ -159,7 +159,7 @@ again:
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
SIMPLEQ_INSERT_TAIL(&rpool_queue, repo, entries);
|
SIMPLEQ_INSERT_TAIL(&rpool_queue, repo, entries);
|
||||||
xbps_dbg_printf(xhp, "[rpool] `%s' registered.\n", repouri);
|
xbps_dbg_printf("[rpool] `%s' registered.\n", repouri);
|
||||||
}
|
}
|
||||||
foundrepo = true;
|
foundrepo = true;
|
||||||
rv = (*fn)(repo, arg, &done);
|
rv = (*fn)(repo, arg, &done);
|
||||||
@ -235,16 +235,14 @@ find_best_pkg_cb(struct xbps_repo *repo, void *arg, bool *done UNUSED)
|
|||||||
if (errno && errno != ENOENT)
|
if (errno && errno != ENOENT)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[rpool] Package '%s' not found in repository"
|
||||||
"[rpool] Package '%s' not found in repository "
|
" '%s'.\n", rpf->pattern, repo->uri);
|
||||||
"'%s'.\n", rpf->pattern, repo->uri);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||||
"pkgver", &repopkgver);
|
"pkgver", &repopkgver);
|
||||||
if (rpf->bestpkgver == NULL) {
|
if (rpf->bestpkgver == NULL) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[rpool] Found match '%s' (%s).\n",
|
||||||
"[rpool] Found match '%s' (%s).\n",
|
|
||||||
repopkgver, repo->uri);
|
repopkgver, repo->uri);
|
||||||
rpf->pkgd = pkgd;
|
rpf->pkgd = pkgd;
|
||||||
rpf->bestpkgver = repopkgver;
|
rpf->bestpkgver = repopkgver;
|
||||||
@ -255,8 +253,7 @@ find_best_pkg_cb(struct xbps_repo *repo, void *arg, bool *done UNUSED)
|
|||||||
* version from current package in repository.
|
* version from current package in repository.
|
||||||
*/
|
*/
|
||||||
if (xbps_cmpver(repopkgver, rpf->bestpkgver) == 1) {
|
if (xbps_cmpver(repopkgver, rpf->bestpkgver) == 1) {
|
||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf("[rpool] Found best match '%s' (%s).\n",
|
||||||
"[rpool] Found best match '%s' (%s).\n",
|
|
||||||
repopkgver, repo->uri);
|
repopkgver, repo->uri);
|
||||||
rpf->pkgd = pkgd;
|
rpf->pkgd = pkgd;
|
||||||
rpf->bestpkgver = repopkgver;
|
rpf->bestpkgver = repopkgver;
|
||||||
|
@ -105,7 +105,7 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "found conflicting installed "
|
xbps_dbg_printf("found conflicting installed "
|
||||||
"pkg %s with pkg in transaction %s "
|
"pkg %s with pkg in transaction %s "
|
||||||
"(matched by %s [trans])\n", pkgver, repopkgver, cfpkg);
|
"(matched by %s [trans])\n", pkgver, repopkgver, cfpkg);
|
||||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||||
@ -137,7 +137,7 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
if (!xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver)) {
|
if (!xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
xbps_dbg_printf("found conflicting pkgs in "
|
||||||
"transaction %s <-> %s (matched by %s [trans])\n",
|
"transaction %s <-> %s (matched by %s [trans])\n",
|
||||||
pkgver, repopkgver, cfpkg);
|
pkgver, repopkgver, cfpkg);
|
||||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||||
@ -209,7 +209,7 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
|||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
xbps_dbg_printf("found conflicting pkgs in "
|
||||||
"transaction %s <-> %s (matched by %s [pkgdb])\n",
|
"transaction %s <-> %s (matched by %s [pkgdb])\n",
|
||||||
pkgver, repopkgver, cfpkg);
|
pkgver, repopkgver, cfpkg);
|
||||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||||
|
@ -140,7 +140,7 @@ xbps_transaction_check_replaces(struct xbps_handle *xhp, xbps_array_t pkgs)
|
|||||||
xbps_object_iterator_release(iter);
|
xbps_object_iterator_release(iter);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"Package `%s' in transaction will be "
|
"Package `%s' in transaction will be "
|
||||||
"replaced by `%s', matched with `%s'\n",
|
"replaced by `%s', matched with `%s'\n",
|
||||||
curpkgver, pkgver, pattern);
|
curpkgver, pkgver, pattern);
|
||||||
@ -172,7 +172,7 @@ xbps_transaction_check_replaces(struct xbps_handle *xhp, xbps_array_t pkgs)
|
|||||||
xbps_object_iterator_release(iter);
|
xbps_object_iterator_release(iter);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(
|
||||||
"Package `%s' will be replaced by `%s', "
|
"Package `%s' will be replaced by `%s', "
|
||||||
"matched with `%s'\n", curpkgver, pkgver, pattern);
|
"matched with `%s'\n", curpkgver, pkgver, pattern);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ collect_shlibs(struct xbps_handle *xhp, xbps_array_t pkgs, bool req)
|
|||||||
const char *shlib = NULL;
|
const char *shlib = NULL;
|
||||||
|
|
||||||
xbps_array_get_cstring_nocopy(shobjs, i, &shlib);
|
xbps_array_get_cstring_nocopy(shobjs, i, &shlib);
|
||||||
xbps_dbg_printf(xhp, "%s: registering %s for %s\n",
|
xbps_dbg_printf("%s: registering %s for %s\n",
|
||||||
pkgver, shlib, req ? "shlib-requires" : "shlib-provides");
|
pkgver, shlib, req ? "shlib-requires" : "shlib-provides");
|
||||||
if (req)
|
if (req)
|
||||||
shlib_register(d, shlib, pkgver);
|
shlib_register(d, shlib, pkgver);
|
||||||
@ -155,13 +155,13 @@ xbps_transaction_check_shlibs(struct xbps_handle *xhp, xbps_array_t pkgs)
|
|||||||
|
|
||||||
while ((obj = xbps_object_iterator_next(iter))) {
|
while ((obj = xbps_object_iterator_next(iter))) {
|
||||||
shlib = xbps_dictionary_keysym_cstring_nocopy(obj);
|
shlib = xbps_dictionary_keysym_cstring_nocopy(obj);
|
||||||
xbps_dbg_printf(xhp, "%s: checking for `%s': ", __func__, shlib);
|
xbps_dbg_printf("%s: checking for `%s': ", __func__, shlib);
|
||||||
if ((obj2 = xbps_dictionary_get(shprovides, shlib))) {
|
if ((obj2 = xbps_dictionary_get(shprovides, shlib))) {
|
||||||
xbps_dbg_printf_append(xhp, "provided by `%s'\n",
|
xbps_dbg_printf_append("provided by `%s'\n",
|
||||||
xbps_string_cstring_nocopy(obj2));
|
xbps_string_cstring_nocopy(obj2));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf_append(xhp, "not found\n");
|
xbps_dbg_printf_append("not found\n");
|
||||||
|
|
||||||
broken = true;
|
broken = true;
|
||||||
array = xbps_dictionary_get_keysym(shrequires, obj);
|
array = xbps_dictionary_get_keysym(shrequires, obj);
|
||||||
|
@ -153,7 +153,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
* Download and verify binary packages.
|
* Download and verify binary packages.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_transaction_fetch(xhp, iter)) != 0) {
|
if ((rv = xbps_transaction_fetch(xhp, iter)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to fetch and verify binpkgs: "
|
xbps_dbg_printf("[trans] failed to fetch and verify binpkgs: "
|
||||||
"%s\n", strerror(rv));
|
"%s\n", strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
* Internalize metadata of downloaded binary packages.
|
* Internalize metadata of downloaded binary packages.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_transaction_internalize(xhp, iter)) < 0) {
|
if ((rv = xbps_transaction_internalize(xhp, iter)) < 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to internalize transaction binpkgs: "
|
xbps_dbg_printf("[trans] failed to internalize transaction binpkgs: "
|
||||||
"%s\n", strerror(-rv));
|
"%s\n", strerror(-rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
*/
|
*/
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_FILES, 0, NULL, NULL);
|
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_FILES, 0, NULL, NULL);
|
||||||
if ((rv = xbps_transaction_files(xhp, iter)) != 0) {
|
if ((rv = xbps_transaction_files(xhp, iter)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to verify transaction files: "
|
xbps_dbg_printf("[trans] failed to verify transaction files: "
|
||||||
"%s\n", strerror(rv));
|
"%s\n", strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -229,14 +229,14 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
ttype = xbps_transaction_pkg_type(obj);
|
ttype = xbps_transaction_pkg_type(obj);
|
||||||
if (ttype == XBPS_TRANS_INSTALL || ttype == XBPS_TRANS_HOLD || ttype == XBPS_TRANS_CONFIGURE) {
|
if (ttype == XBPS_TRANS_INSTALL || ttype == XBPS_TRANS_HOLD || ttype == XBPS_TRANS_CONFIGURE) {
|
||||||
xbps_dbg_printf(xhp, "%s: skipping pre-remove script for "
|
xbps_dbg_printf("%s: skipping pre-remove script for "
|
||||||
"%s: %d\n", __func__, pkgver, ttype);
|
"%s: %d\n", __func__, pkgver, ttype);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pkgdb_pkgd = xbps_pkgdb_get_pkg(xhp, pkgname)) == NULL) {
|
if ((pkgdb_pkgd = xbps_pkgdb_get_pkg(xhp, pkgname)) == NULL) {
|
||||||
rv = ENOENT;
|
rv = ENOENT;
|
||||||
xbps_dbg_printf(xhp, "[trans] cannot find %s in pkgdb: %s\n",
|
xbps_dbg_printf("[trans] cannot find %s in pkgdb: %s\n",
|
||||||
pkgname, strerror(rv));
|
pkgname, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||||
ttype = xbps_transaction_pkg_type(obj);
|
ttype = xbps_transaction_pkg_type(obj);
|
||||||
if (ttype == XBPS_TRANS_REMOVE || ttype == XBPS_TRANS_HOLD) {
|
if (ttype == XBPS_TRANS_REMOVE || ttype == XBPS_TRANS_HOLD) {
|
||||||
xbps_dbg_printf(xhp, "%s: skipping pre-install script for "
|
xbps_dbg_printf("%s: skipping pre-install script for "
|
||||||
"%s: %d\n", __func__, pkgver, ttype);
|
"%s: %d\n", __func__, pkgver, ttype);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
xbps_dictionary_get_bool(obj, "remove-and-update", &update);
|
xbps_dictionary_get_bool(obj, "remove-and-update", &update);
|
||||||
rv = xbps_remove_pkg(xhp, pkgver, update);
|
rv = xbps_remove_pkg(xhp, pkgver, update);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to "
|
xbps_dbg_printf("[trans] failed to "
|
||||||
"remove %s: %s\n", pkgver, strerror(rv));
|
"remove %s: %s\n", pkgver, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
* Unpack binary package.
|
* Unpack binary package.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_unpack_binary_pkg(xhp, obj)) != 0) {
|
if ((rv = xbps_unpack_binary_pkg(xhp, obj)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to unpack "
|
xbps_dbg_printf("[trans] failed to unpack "
|
||||||
"%s: %s\n", pkgver, strerror(rv));
|
"%s: %s\n", pkgver, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
* Register package.
|
* Register package.
|
||||||
*/
|
*/
|
||||||
if ((rv = xbps_register_pkg(xhp, obj)) != 0) {
|
if ((rv = xbps_register_pkg(xhp, obj)) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to register "
|
xbps_dbg_printf("[trans] failed to register "
|
||||||
"%s: %s\n", pkgver, strerror(rv));
|
"%s: %s\n", pkgver, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||||
ttype = xbps_transaction_pkg_type(obj);
|
ttype = xbps_transaction_pkg_type(obj);
|
||||||
if (ttype == XBPS_TRANS_REMOVE || ttype == XBPS_TRANS_HOLD) {
|
if (ttype == XBPS_TRANS_REMOVE || ttype == XBPS_TRANS_HOLD) {
|
||||||
xbps_dbg_printf(xhp, "%s: skipping configuration for "
|
xbps_dbg_printf("%s: skipping configuration for "
|
||||||
"%s: %d\n", __func__, pkgver, ttype);
|
"%s: %d\n", __func__, pkgver, ttype);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -411,7 +411,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
rv = xbps_configure_pkg(xhp, pkgver, false, update);
|
rv = xbps_configure_pkg(xhp, pkgver, false, update);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
xbps_dbg_printf(xhp, "%s: configure failed for "
|
xbps_dbg_printf("%s: configure failed for "
|
||||||
"%s: %s\n", __func__, pkgver, strerror(rv));
|
"%s: %s\n", __func__, pkgver, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ verify_binpkg(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
|
|||||||
*/
|
*/
|
||||||
if ((repo = xbps_rpool_get_repo(repoloc)) == NULL) {
|
if ((repo = xbps_rpool_get_repo(repoloc)) == NULL) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "%s: failed to get repository "
|
xbps_dbg_printf("%s: failed to get repository "
|
||||||
"%s: %s\n", pkgver, repoloc, strerror(errno));
|
"%s: %s\n", pkgver, repoloc, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ download_binpkg(struct xbps_handle *xhp, xbps_dictionary_t repo_pkgd)
|
|||||||
|
|
||||||
if ((repo = xbps_rpool_get_repo(repoloc)) == NULL) {
|
if ((repo = xbps_rpool_get_repo(repoloc)) == NULL) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "%s: failed to get repository "
|
xbps_dbg_printf("%s: failed to get repository "
|
||||||
"%s: %s\n", pkgver, repoloc, strerror(errno));
|
"%s: %s\n", pkgver, repoloc, strerror(errno));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -242,11 +242,11 @@ xbps_transaction_fetch(struct xbps_handle *xhp, xbps_object_iterator_t iter)
|
|||||||
n = xbps_array_count(fetch);
|
n = xbps_array_count(fetch);
|
||||||
if (n) {
|
if (n) {
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_DOWNLOAD, 0, NULL, NULL);
|
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_DOWNLOAD, 0, NULL, NULL);
|
||||||
xbps_dbg_printf(xhp, "[trans] downloading %d packages.\n", n);
|
xbps_dbg_printf("[trans] downloading %d packages.\n", n);
|
||||||
}
|
}
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if ((rv = download_binpkg(xhp, xbps_array_get(fetch, i))) != 0) {
|
if ((rv = download_binpkg(xhp, xbps_array_get(fetch, i))) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to download binpkgs: "
|
xbps_dbg_printf("[trans] failed to download binpkgs: "
|
||||||
"%s\n", strerror(rv));
|
"%s\n", strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -258,11 +258,11 @@ xbps_transaction_fetch(struct xbps_handle *xhp, xbps_object_iterator_t iter)
|
|||||||
n = xbps_array_count(verify);
|
n = xbps_array_count(verify);
|
||||||
if (n) {
|
if (n) {
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_VERIFY, 0, NULL, NULL);
|
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_VERIFY, 0, NULL, NULL);
|
||||||
xbps_dbg_printf(xhp, "[trans] verifying %d packages.\n", n);
|
xbps_dbg_printf("[trans] verifying %d packages.\n", n);
|
||||||
}
|
}
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if ((rv = verify_binpkg(xhp, xbps_array_get(verify, i))) != 0) {
|
if ((rv = verify_binpkg(xhp, xbps_array_get(verify, i))) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[trans] failed to check binpkgs: "
|
xbps_dbg_printf("[trans] failed to check binpkgs: "
|
||||||
"%s\n", strerror(rv));
|
"%s\n", strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ match_preserved_file(struct xbps_handle *xhp, const char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
can_delete_directory(struct xbps_handle *xhp, const char *file, size_t len, size_t max)
|
can_delete_directory(const char *file, size_t len, size_t max)
|
||||||
{
|
{
|
||||||
struct item *item;
|
struct item *item;
|
||||||
size_t rmcount = 0, fcount = 0;
|
size_t rmcount = 0, fcount = 0;
|
||||||
@ -150,7 +150,7 @@ can_delete_directory(struct xbps_handle *xhp, const char *file, size_t len, size
|
|||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "[files] %s: %s: %s\n",
|
xbps_dbg_printf("[files] %s: %s: %s\n",
|
||||||
__func__, file, strerror(errno));
|
__func__, file, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ can_delete_directory(struct xbps_handle *xhp, const char *file, size_t len, size
|
|||||||
fcount -= 2;
|
fcount -= 2;
|
||||||
|
|
||||||
if (fcount <= rmcount) {
|
if (fcount <= rmcount) {
|
||||||
xbps_dbg_printf(xhp, "[files] only removed %zu out of %zu files: %s\n",
|
xbps_dbg_printf("[files] only removed %zu out of %zu files: %s\n",
|
||||||
rmcount, fcount, file);
|
rmcount, fcount, file);
|
||||||
}
|
}
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
@ -233,7 +233,7 @@ collect_obsoletes(struct xbps_handle *xhp)
|
|||||||
item = items[i];
|
item = items[i];
|
||||||
|
|
||||||
if (match_preserved_file(xhp, item->file)) {
|
if (match_preserved_file(xhp, item->file)) {
|
||||||
xbps_dbg_printf(xhp, "[obsoletes] %s: file exists on disk"
|
xbps_dbg_printf("[obsoletes] %s: file exists on disk"
|
||||||
" and must be preserved: %s\n", item->old.pkgver, item->file);
|
" and must be preserved: %s\n", item->old.pkgver, item->file);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ collect_obsoletes(struct xbps_handle *xhp)
|
|||||||
* Probably obsolete.
|
* Probably obsolete.
|
||||||
*/
|
*/
|
||||||
if (item->old.preserve && item->old.update) {
|
if (item->old.preserve && item->old.update) {
|
||||||
xbps_dbg_printf(xhp, "[files] %s: skipping `preserve` %s: %s\n",
|
xbps_dbg_printf("[files] %s: skipping `preserve` %s: %s\n",
|
||||||
item->old.pkgver, typestr(item->old.type), item->file);
|
item->old.pkgver, typestr(item->old.type), item->file);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -276,9 +276,9 @@ collect_obsoletes(struct xbps_handle *xhp)
|
|||||||
* Directory replaced by a file or symlink.
|
* Directory replaced by a file or symlink.
|
||||||
* We MUST be able to delete the directory.
|
* We MUST be able to delete the directory.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "[files] %s: directory changed to %s: %s\n",
|
xbps_dbg_printf("[files] %s: directory changed to %s: %s\n",
|
||||||
item->new.pkgver, typestr(item->new.type), item->file);
|
item->new.pkgver, typestr(item->new.type), item->file);
|
||||||
if (!can_delete_directory(xhp, item->file, item->len, i)) {
|
if (!can_delete_directory(item->file, item->len, i)) {
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_FILES_FAIL,
|
xbps_set_cb_state(xhp, XBPS_STATE_FILES_FAIL,
|
||||||
ENOTEMPTY, item->old.pkgver,
|
ENOTEMPTY, item->old.pkgver,
|
||||||
"%s: directory `%s' can not be deleted.",
|
"%s: directory `%s' can not be deleted.",
|
||||||
@ -329,13 +329,13 @@ collect_obsoletes(struct xbps_handle *xhp)
|
|||||||
*/
|
*/
|
||||||
if (item->old.removepkg && !item->new.pkgname &&
|
if (item->old.removepkg && !item->new.pkgname &&
|
||||||
(xhp->flags & XBPS_FLAG_FORCE_REMOVE_FILES) != 0) {
|
(xhp->flags & XBPS_FLAG_FORCE_REMOVE_FILES) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[obsoletes] %s: SHA256 mismatch,"
|
xbps_dbg_printf("[obsoletes] %s: SHA256 mismatch,"
|
||||||
" force remove %s: %s\n",
|
" force remove %s: %s\n",
|
||||||
item->old.pkgname, typestr(item->old.type),
|
item->old.pkgname, typestr(item->old.type),
|
||||||
item->file+1);
|
item->file+1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "[obsoletes] %s: SHA256 mismatch,"
|
xbps_dbg_printf("[obsoletes] %s: SHA256 mismatch,"
|
||||||
" skipping remove %s: %s\n",
|
" skipping remove %s: %s\n",
|
||||||
item->old.pkgname, typestr(item->old.type),
|
item->old.pkgname, typestr(item->old.type),
|
||||||
item->file+1);
|
item->file+1);
|
||||||
@ -360,12 +360,12 @@ collect_obsoletes(struct xbps_handle *xhp)
|
|||||||
}
|
}
|
||||||
lnk = xbps_symlink_target(xhp, file, item->old.target);
|
lnk = xbps_symlink_target(xhp, file, item->old.target);
|
||||||
if (lnk == NULL) {
|
if (lnk == NULL) {
|
||||||
xbps_dbg_printf(xhp, "[obsoletes] %s "
|
xbps_dbg_printf("[obsoletes] %s "
|
||||||
"symlink_target: %s\n", item->file+1, strerror(errno));
|
"symlink_target: %s\n", item->file+1, strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strcmp(lnk, item->old.target) != 0) {
|
if (strcmp(lnk, item->old.target) != 0) {
|
||||||
xbps_dbg_printf(xhp, "[obsoletes] %s: skipping modified"
|
xbps_dbg_printf("[obsoletes] %s: skipping modified"
|
||||||
" symlink (stored `%s' current `%s'): %s\n",
|
" symlink (stored `%s' current `%s'): %s\n",
|
||||||
item->old.pkgname, item->old.target, lnk, item->file+1);
|
item->old.pkgname, item->old.target, lnk, item->file+1);
|
||||||
free(lnk);
|
free(lnk);
|
||||||
@ -390,7 +390,7 @@ collect_obsoletes(struct xbps_handle *xhp)
|
|||||||
}
|
}
|
||||||
assert(pkgname);
|
assert(pkgname);
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "[obsoletes] %s: removes %s: %s\n",
|
xbps_dbg_printf("[obsoletes] %s: removes %s: %s\n",
|
||||||
pkgname, typestr(item->old.type), item->file+1);
|
pkgname, typestr(item->old.type), item->file+1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -462,7 +462,7 @@ collect_file(struct xbps_handle *xhp, const char *file, size_t size,
|
|||||||
* Multiple packages removing the same file.
|
* Multiple packages removing the same file.
|
||||||
* Shouldn't happen, but its not fatal.
|
* Shouldn't happen, but its not fatal.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "[files] %s: file already removed"
|
xbps_dbg_printf("[files] %s: file already removed"
|
||||||
" by package `%s': %s\n", pkgver, item->old.pkgver, file);
|
" by package `%s': %s\n", pkgver, item->old.pkgver, file);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -546,11 +546,11 @@ add:
|
|||||||
*/
|
*/
|
||||||
if (strcmp(item->new.pkgname, item->old.pkgname) != 0) {
|
if (strcmp(item->new.pkgname, item->old.pkgname) != 0) {
|
||||||
if (removefile) {
|
if (removefile) {
|
||||||
xbps_dbg_printf(xhp, "[files] %s: %s moved to"
|
xbps_dbg_printf("[files] %s: %s moved to"
|
||||||
" package `%s': %s\n", pkgver, typestr(item->old.type),
|
" package `%s': %s\n", pkgver, typestr(item->old.type),
|
||||||
item->new.pkgver, file);
|
item->new.pkgver, file);
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "[files] %s: %s moved from"
|
xbps_dbg_printf("[files] %s: %s moved from"
|
||||||
" package `%s': %s\n", pkgver, typestr(item->new.type),
|
" package `%s': %s\n", pkgver, typestr(item->new.type),
|
||||||
item->old.pkgver, file);
|
item->old.pkgver, file);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool force)
|
|||||||
!xbps_pkg_reverts(pkg_repod, instpkgver)) {
|
!xbps_pkg_reverts(pkg_repod, instpkgver)) {
|
||||||
xbps_dictionary_get_cstring_nocopy(pkg_repod,
|
xbps_dictionary_get_cstring_nocopy(pkg_repod,
|
||||||
"repository", &repoloc);
|
"repository", &repoloc);
|
||||||
xbps_dbg_printf(xhp, "[rpool] Skipping `%s' "
|
xbps_dbg_printf("[rpool] Skipping `%s' "
|
||||||
"(installed: %s) from repository `%s'\n",
|
"(installed: %s) from repository `%s'\n",
|
||||||
repopkgver, instpkgver, repoloc);
|
repopkgver, instpkgver, repoloc);
|
||||||
return EEXIST;
|
return EEXIST;
|
||||||
@ -171,7 +171,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool force)
|
|||||||
*/
|
*/
|
||||||
if (ttype == XBPS_TRANS_UPDATE) {
|
if (ttype == XBPS_TRANS_UPDATE) {
|
||||||
if (xbps_find_pkg_in_array(pkgs, repopkgver, 0)) {
|
if (xbps_find_pkg_in_array(pkgs, repopkgver, 0)) {
|
||||||
xbps_dbg_printf(xhp, "[update] `%s' already queued in "
|
xbps_dbg_printf("[update] `%s' already queued in "
|
||||||
"transaction.\n", repopkgver);
|
"transaction.\n", repopkgver);
|
||||||
return EEXIST;
|
return EEXIST;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ xbps_autoupdate(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
rv = trans_find_pkg(xhp, pkgname, false);
|
rv = trans_find_pkg(xhp, pkgname, false);
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg xbps: %d\n", __func__, rv);
|
xbps_dbg_printf("%s: trans_find_pkg xbps: %d\n", __func__, rv);
|
||||||
|
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
if (xhp->flags & XBPS_FLAG_DOWNLOAD_ONLY) {
|
if (xhp->flags & XBPS_FLAG_DOWNLOAD_ONLY) {
|
||||||
@ -256,13 +256,13 @@ xbps_autoupdate(struct xbps_handle *xhp)
|
|||||||
char curpkgn[XBPS_NAME_SIZE] = {0};
|
char curpkgn[XBPS_NAME_SIZE] = {0};
|
||||||
|
|
||||||
xbps_array_get_cstring_nocopy(rdeps, i, &curpkgver);
|
xbps_array_get_cstring_nocopy(rdeps, i, &curpkgver);
|
||||||
xbps_dbg_printf(xhp, "%s: processing revdep %s\n", __func__, curpkgver);
|
xbps_dbg_printf("%s: processing revdep %s\n", __func__, curpkgver);
|
||||||
|
|
||||||
if (!xbps_pkg_name(curpkgn, sizeof(curpkgn), curpkgver)) {
|
if (!xbps_pkg_name(curpkgn, sizeof(curpkgn), curpkgver)) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
rv = trans_find_pkg(xhp, curpkgn, false);
|
rv = trans_find_pkg(xhp, curpkgn, false);
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg revdep %s: %d\n", __func__, curpkgver, rv);
|
xbps_dbg_printf("%s: trans_find_pkg revdep %s: %d\n", __func__, curpkgver, rv);
|
||||||
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV)
|
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rv = trans_find_pkg(xhp, pkgname, false);
|
rv = trans_find_pkg(xhp, pkgname, false);
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkgver, rv);
|
xbps_dbg_printf("%s: trans_find_pkg %s: %d\n", __func__, pkgver, rv);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
newpkg_found = true;
|
newpkg_found = true;
|
||||||
} else if (rv == ENOENT || rv == EEXIST || rv == ENODEV) {
|
} else if (rv == ENOENT || rv == EEXIST || rv == ENODEV) {
|
||||||
@ -349,7 +349,7 @@ xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg, bool force
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
rv = xbps_autoupdate(xhp);
|
rv = xbps_autoupdate(xhp);
|
||||||
xbps_dbg_printf(xhp, "%s: xbps_autoupdate %d\n", __func__, rv);
|
xbps_dbg_printf("%s: xbps_autoupdate %d\n", __func__, rv);
|
||||||
switch (rv) {
|
switch (rv) {
|
||||||
case 1:
|
case 1:
|
||||||
/* xbps needs to be updated, only allow xbps to be updated */
|
/* xbps needs to be updated, only allow xbps to be updated */
|
||||||
@ -382,14 +382,14 @@ xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg, bool force
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rv = trans_find_pkg(xhp, pkgname, false);
|
rv = trans_find_pkg(xhp, pkgname, false);
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkgver, rv);
|
xbps_dbg_printf("%s: trans_find_pkg %s: %d\n", __func__, pkgver, rv);
|
||||||
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV) {
|
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* add pkg repod */
|
/* add pkg repod */
|
||||||
rv = trans_find_pkg(xhp, pkg, force);
|
rv = trans_find_pkg(xhp, pkg, force);
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkg, rv);
|
xbps_dbg_printf("%s: trans_find_pkg %s: %d\n", __func__, pkg, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,13 +432,13 @@ xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg, bool forc
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rv = trans_find_pkg(xhp, pkgname, false);
|
rv = trans_find_pkg(xhp, pkgname, false);
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkgver, rv);
|
xbps_dbg_printf("%s: trans_find_pkg %s: %d\n", __func__, pkgver, rv);
|
||||||
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV) {
|
if (rv && rv != ENOENT && rv != EEXIST && rv != ENODEV) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rv = trans_find_pkg(xhp, pkg, force);
|
rv = trans_find_pkg(xhp, pkg, force);
|
||||||
xbps_dbg_printf(xhp, "%s: trans_find_pkg %s: %d\n", __func__, pkg, rv);
|
xbps_dbg_printf("%s: trans_find_pkg %s: %d\n", __func__, pkg, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ add_missing_reqdep(struct xbps_handle *xhp, const char *reqpkg)
|
|||||||
* if new dependency version is greater than current
|
* if new dependency version is greater than current
|
||||||
* one, store it.
|
* one, store it.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "Missing pkgdep name matched, curver: %s newver: %s\n", curver, pkgver);
|
xbps_dbg_printf("Missing pkgdep name matched, curver: %s newver: %s\n", curver, pkgver);
|
||||||
if (xbps_cmpver(curver, pkgver) <= 0) {
|
if (xbps_cmpver(curver, pkgver) <= 0) {
|
||||||
add_pkgdep = false;
|
add_pkgdep = false;
|
||||||
rv = EEXIST;
|
rv = EEXIST;
|
||||||
@ -151,15 +151,15 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
reqpkg = xbps_string_cstring_nocopy(obj);
|
reqpkg = xbps_string_cstring_nocopy(obj);
|
||||||
|
|
||||||
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
||||||
xbps_dbg_printf(xhp, "%s", "");
|
xbps_dbg_printf("%s", "");
|
||||||
for (unsigned short x = 0; x < *depth; x++) {
|
for (unsigned short x = 0; x < *depth; x++) {
|
||||||
xbps_dbg_printf_append(xhp, " ");
|
xbps_dbg_printf_append(" ");
|
||||||
}
|
}
|
||||||
xbps_dbg_printf_append(xhp, "%s: requires dependency '%s': ", curpkg ? curpkg : " ", reqpkg);
|
xbps_dbg_printf_append("%s: requires dependency '%s': ", curpkg ? curpkg : " ", reqpkg);
|
||||||
}
|
}
|
||||||
if ((!xbps_pkgpattern_name(pkgname, sizeof(pkgname), reqpkg)) &&
|
if ((!xbps_pkgpattern_name(pkgname, sizeof(pkgname), reqpkg)) &&
|
||||||
(!xbps_pkg_name(pkgname, sizeof(pkgname), reqpkg))) {
|
(!xbps_pkg_name(pkgname, sizeof(pkgname), reqpkg))) {
|
||||||
xbps_dbg_printf(xhp, "%s: can't guess pkgname for dependency: %s\n", curpkg, reqpkg);
|
xbps_dbg_printf("%s: can't guess pkgname for dependency: %s\n", curpkg, reqpkg);
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_INVALID_DEP, ENXIO, NULL,
|
xbps_set_cb_state(xhp, XBPS_STATE_INVALID_DEP, ENXIO, NULL,
|
||||||
"%s: can't guess pkgname for dependency '%s'", curpkg, reqpkg);
|
"%s: can't guess pkgname for dependency '%s'", curpkg, reqpkg);
|
||||||
rv = ENXIO;
|
rv = ENXIO;
|
||||||
@ -169,7 +169,7 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
* Pass 0: check if required dependency is ignored.
|
* Pass 0: check if required dependency is ignored.
|
||||||
*/
|
*/
|
||||||
if (xbps_pkg_is_ignored(xhp, pkgname)) {
|
if (xbps_pkg_is_ignored(xhp, pkgname)) {
|
||||||
xbps_dbg_printf_append(xhp, "%s ignored.\n", pkgname);
|
xbps_dbg_printf_append("%s ignored.\n", pkgname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -177,7 +177,7 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
* package via "provides", if true ignore dependency.
|
* package via "provides", if true ignore dependency.
|
||||||
*/
|
*/
|
||||||
if (pkg_provides && xbps_match_virtual_pkg_in_array(pkg_provides, reqpkg)) {
|
if (pkg_provides && xbps_match_virtual_pkg_in_array(pkg_provides, reqpkg)) {
|
||||||
xbps_dbg_printf_append(xhp, "%s is a vpkg provided by %s, ignored.\n", pkgname, curpkg);
|
xbps_dbg_printf_append("%s is a vpkg provided by %s, ignored.\n", pkgname, curpkg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -189,7 +189,7 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
xbps_trans_type_t ttype_q = xbps_transaction_pkg_type(curpkgd);
|
xbps_trans_type_t ttype_q = xbps_transaction_pkg_type(curpkgd);
|
||||||
xbps_dictionary_get_cstring_nocopy(curpkgd, "pkgver", &pkgver_q);
|
xbps_dictionary_get_cstring_nocopy(curpkgd, "pkgver", &pkgver_q);
|
||||||
if (ttype_q != XBPS_TRANS_REMOVE && ttype_q != XBPS_TRANS_HOLD) {
|
if (ttype_q != XBPS_TRANS_REMOVE && ttype_q != XBPS_TRANS_HOLD) {
|
||||||
xbps_dbg_printf_append(xhp, " (%s queued %d)\n", pkgver_q, ttype_q);
|
xbps_dbg_printf_append(" (%s queued %d)\n", pkgver_q, ttype_q);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,11 +216,11 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
if (errno && errno != ENOENT) {
|
if (errno && errno != ENOENT) {
|
||||||
/* error */
|
/* error */
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "failed to find installed pkg for `%s': %s\n", reqpkg, strerror(rv));
|
xbps_dbg_printf("failed to find installed pkg for `%s': %s\n", reqpkg, strerror(rv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Required dependency not installed */
|
/* Required dependency not installed */
|
||||||
xbps_dbg_printf_append(xhp, "not installed.\n");
|
xbps_dbg_printf_append("not installed.\n");
|
||||||
ttype = XBPS_TRANS_INSTALL;
|
ttype = XBPS_TRANS_INSTALL;
|
||||||
state = XBPS_PKG_STATE_NOT_INSTALLED;
|
state = XBPS_PKG_STATE_NOT_INSTALLED;
|
||||||
} else {
|
} else {
|
||||||
@ -240,7 +240,7 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
* Check if required dependency is a virtual package and is satisfied
|
* Check if required dependency is a virtual package and is satisfied
|
||||||
* by an installed package.
|
* by an installed package.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf_append(xhp, "[virtual] satisfied by `%s'.\n", pkgver_q);
|
xbps_dbg_printf_append("[virtual] satisfied by `%s'.\n", pkgver_q);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rv = xbps_pkgpattern_match(pkgver_q, reqpkg);
|
rv = xbps_pkgpattern_match(pkgver_q, reqpkg);
|
||||||
@ -254,23 +254,23 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(pkgname, curpkgname)) {
|
if (strcmp(pkgname, curpkgname)) {
|
||||||
xbps_dbg_printf_append(xhp, "not installed `%s (vpkg)'", pkgver_q);
|
xbps_dbg_printf_append("not installed `%s (vpkg)'", pkgver_q);
|
||||||
if (xbps_dictionary_get(curpkgd, "hold")) {
|
if (xbps_dictionary_get(curpkgd, "hold")) {
|
||||||
ttype = XBPS_TRANS_HOLD;
|
ttype = XBPS_TRANS_HOLD;
|
||||||
xbps_dbg_printf_append(xhp, " on hold state! ignoring package.\n");
|
xbps_dbg_printf_append(" on hold state! ignoring package.\n");
|
||||||
rv = ENODEV;
|
rv = ENODEV;
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf_append(xhp, "\n");
|
xbps_dbg_printf_append("\n");
|
||||||
ttype = XBPS_TRANS_INSTALL;
|
ttype = XBPS_TRANS_INSTALL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf_append(xhp, "installed `%s', must be updated", pkgver_q);
|
xbps_dbg_printf_append("installed `%s', must be updated", pkgver_q);
|
||||||
if (xbps_dictionary_get(curpkgd, "hold")) {
|
if (xbps_dictionary_get(curpkgd, "hold")) {
|
||||||
xbps_dbg_printf_append(xhp, " on hold state! ignoring package.\n");
|
xbps_dbg_printf_append(" on hold state! ignoring package.\n");
|
||||||
ttype = XBPS_TRANS_HOLD;
|
ttype = XBPS_TRANS_HOLD;
|
||||||
rv = ENODEV;
|
rv = ENODEV;
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf_append(xhp, "\n");
|
xbps_dbg_printf_append("\n");
|
||||||
ttype = XBPS_TRANS_UPDATE;
|
ttype = XBPS_TRANS_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,14 +280,14 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
if (rv == ENODEV) {
|
if (rv == ENODEV) {
|
||||||
rv = add_missing_reqdep(xhp, reqpkg);
|
rv = add_missing_reqdep(xhp, reqpkg);
|
||||||
if (rv != 0 && rv != EEXIST) {
|
if (rv != 0 && rv != EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "`%s': add_missing_reqdep failed\n", reqpkg);
|
xbps_dbg_printf("`%s': add_missing_reqdep failed\n", reqpkg);
|
||||||
break;
|
break;
|
||||||
} else if (rv == EEXIST) {
|
} else if (rv == EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "`%s' missing dep already added.\n", reqpkg);
|
xbps_dbg_printf("`%s' missing dep already added.\n", reqpkg);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "`%s' added into the missing deps array.\n", reqpkg);
|
xbps_dbg_printf("`%s' added into the missing deps array.\n", reqpkg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,19 +301,19 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
* Package matches the dependency pattern but was only unpacked,
|
* Package matches the dependency pattern but was only unpacked,
|
||||||
* configure pkg.
|
* configure pkg.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf_append(xhp, "installed `%s', must be configured.\n", pkgver_q);
|
xbps_dbg_printf_append("installed `%s', must be configured.\n", pkgver_q);
|
||||||
ttype = XBPS_TRANS_CONFIGURE;
|
ttype = XBPS_TRANS_CONFIGURE;
|
||||||
} else if (state == XBPS_PKG_STATE_INSTALLED) {
|
} else if (state == XBPS_PKG_STATE_INSTALLED) {
|
||||||
/*
|
/*
|
||||||
* Package matches the dependency pattern and is fully installed,
|
* Package matches the dependency pattern and is fully installed,
|
||||||
* skip to next one.
|
* skip to next one.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf_append(xhp, "installed `%s'.\n", pkgver_q);
|
xbps_dbg_printf_append("installed `%s'.\n", pkgver_q);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* error matching pkgpattern */
|
/* error matching pkgpattern */
|
||||||
xbps_dbg_printf(xhp, "failed to match pattern %s with %s\n", reqpkg, pkgver_q);
|
xbps_dbg_printf("failed to match pattern %s with %s\n", reqpkg, pkgver_q);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
if (xbps_dictionary_get(curpkgd, "repolock")) {
|
if (xbps_dictionary_get(curpkgd, "repolock")) {
|
||||||
const char *repourl = NULL;
|
const char *repourl = NULL;
|
||||||
struct xbps_repo *repo = NULL;
|
struct xbps_repo *repo = NULL;
|
||||||
xbps_dbg_printf(xhp, "`%s' is repolocked, looking at single repository.\n", reqpkg);
|
xbps_dbg_printf("`%s' is repolocked, looking at single repository.\n", reqpkg);
|
||||||
xbps_dictionary_get_cstring_nocopy(curpkgd, "repository", &repourl);
|
xbps_dictionary_get_cstring_nocopy(curpkgd, "repository", &repourl);
|
||||||
if (repourl && (repo = xbps_regget_repo(xhp, repourl))) {
|
if (repourl && (repo = xbps_regget_repo(xhp, repourl))) {
|
||||||
curpkgd = xbps_repo_get_pkg(repo, reqpkg);
|
curpkgd = xbps_repo_get_pkg(repo, reqpkg);
|
||||||
@ -341,20 +341,20 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
if (curpkgd == NULL) {
|
if (curpkgd == NULL) {
|
||||||
/* pkg not found, there was some error */
|
/* pkg not found, there was some error */
|
||||||
if (errno && errno != ENOENT) {
|
if (errno && errno != ENOENT) {
|
||||||
xbps_dbg_printf(xhp, "failed to find pkg for `%s' in rpool: %s\n", reqpkg, strerror(errno));
|
xbps_dbg_printf("failed to find pkg for `%s' in rpool: %s\n", reqpkg, strerror(errno));
|
||||||
rv = errno;
|
rv = errno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rv = add_missing_reqdep(xhp, reqpkg);
|
rv = add_missing_reqdep(xhp, reqpkg);
|
||||||
if (rv != 0 && rv != EEXIST) {
|
if (rv != 0 && rv != EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "`%s': add_missing_reqdep failed\n", reqpkg);
|
xbps_dbg_printf("`%s': add_missing_reqdep failed\n", reqpkg);
|
||||||
break;
|
break;
|
||||||
} else if (rv == EEXIST) {
|
} else if (rv == EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "`%s' missing dep already added.\n", reqpkg);
|
xbps_dbg_printf("`%s' missing dep already added.\n", reqpkg);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "`%s' added into the missing deps array.\n", reqpkg);
|
xbps_dbg_printf("`%s' added into the missing deps array.\n", reqpkg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strcmp(pkgname, reqpkgname) == 0) {
|
if (strcmp(pkgname, reqpkgname) == 0) {
|
||||||
xbps_dbg_printf_append(xhp, "[ignoring wrong dependency %s (depends on itself)]\n", reqpkg);
|
xbps_dbg_printf_append("[ignoring wrong dependency %s (depends on itself)]\n", reqpkg);
|
||||||
xbps_remove_string_from_array(pkg_rdeps, reqpkg);
|
xbps_remove_string_from_array(pkg_rdeps, reqpkg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -414,16 +414,16 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
* Process rundeps for current pkg found in rpool.
|
* Process rundeps for current pkg found in rpool.
|
||||||
*/
|
*/
|
||||||
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
||||||
xbps_dbg_printf(xhp, "%s", "");
|
xbps_dbg_printf("%s", "");
|
||||||
for (unsigned short x = 0; x < *depth; x++) {
|
for (unsigned short x = 0; x < *depth; x++) {
|
||||||
xbps_dbg_printf_append(xhp, " ");
|
xbps_dbg_printf_append(" ");
|
||||||
}
|
}
|
||||||
xbps_dbg_printf_append(xhp, "%s: finding dependencies:\n", pkgver_q);
|
xbps_dbg_printf_append("%s: finding dependencies:\n", pkgver_q);
|
||||||
}
|
}
|
||||||
(*depth)++;
|
(*depth)++;
|
||||||
rv = repo_deps(xhp, pkgs, curpkgd, depth);
|
rv = repo_deps(xhp, pkgs, curpkgd, depth);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
xbps_dbg_printf(xhp, "Error checking %s for rundeps: %s\n", reqpkg, strerror(rv));
|
xbps_dbg_printf("Error checking %s for rundeps: %s\n", reqpkg, strerror(rv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -437,12 +437,12 @@ repo_deps(struct xbps_handle *xhp,
|
|||||||
*/
|
*/
|
||||||
if (!xbps_transaction_pkg_type_set(curpkgd, ttype)) {
|
if (!xbps_transaction_pkg_type_set(curpkgd, ttype)) {
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
xbps_dbg_printf(xhp, "xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
|
xbps_dbg_printf("xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!xbps_transaction_store(xhp, pkgs, curpkgd, true)) {
|
if (!xbps_transaction_store(xhp, pkgs, curpkgd, true)) {
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
xbps_dbg_printf(xhp, "xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
|
xbps_dbg_printf("xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ xbps_transaction_pkg_deps(struct xbps_handle *xhp,
|
|||||||
assert(pkg_repod);
|
assert(pkg_repod);
|
||||||
|
|
||||||
xbps_dictionary_get_cstring_nocopy(pkg_repod, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(pkg_repod, "pkgver", &pkgver);
|
||||||
xbps_dbg_printf(xhp, "Finding required dependencies for '%s':\n", pkgver);
|
xbps_dbg_printf("Finding required dependencies for '%s':\n", pkgver);
|
||||||
/*
|
/*
|
||||||
* This will find direct and indirect deps, if any of them is not
|
* This will find direct and indirect deps, if any of them is not
|
||||||
* there it will be added into the missing_deps array.
|
* there it will be added into the missing_deps array.
|
||||||
|
@ -172,7 +172,7 @@ compute_transaction_stats(struct xbps_handle *xhp)
|
|||||||
|
|
||||||
/* Get free space from target rootdir: return ENOSPC if there's not enough space */
|
/* Get free space from target rootdir: return ENOSPC if there's not enough space */
|
||||||
if (statvfs(xhp->rootdir, &svfs) == -1) {
|
if (statvfs(xhp->rootdir, &svfs) == -1) {
|
||||||
xbps_dbg_printf(xhp, "%s: statvfs failed: %s\n", __func__, strerror(errno));
|
xbps_dbg_printf("%s: statvfs failed: %s\n", __func__, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* compute free space on disk */
|
/* compute free space on disk */
|
||||||
@ -297,7 +297,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
if ((edges = xbps_array_create()) == NULL)
|
if ((edges = xbps_array_create()) == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "%s: processing deps\n", __func__);
|
xbps_dbg_printf("%s: processing deps\n", __func__);
|
||||||
/*
|
/*
|
||||||
* The edges are also appended after its dependencies have been
|
* The edges are also appended after its dependencies have been
|
||||||
* collected; the edges at the original array are removed later.
|
* collected; the edges at the original array are removed later.
|
||||||
@ -350,7 +350,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
* If all pkgs in transaction are on hold, no need to check
|
* If all pkgs in transaction are on hold, no need to check
|
||||||
* for anything else.
|
* for anything else.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: checking on hold pkgs\n", __func__);
|
xbps_dbg_printf("%s: checking on hold pkgs\n", __func__);
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
tpkgd = xbps_array_get(pkgs, i);
|
tpkgd = xbps_array_get(pkgs, i);
|
||||||
if (xbps_transaction_pkg_type(tpkgd) != XBPS_TRANS_HOLD) {
|
if (xbps_transaction_pkg_type(tpkgd) != XBPS_TRANS_HOLD) {
|
||||||
@ -364,7 +364,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
/*
|
/*
|
||||||
* Check for packages to be replaced.
|
* Check for packages to be replaced.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: checking replaces\n", __func__);
|
xbps_dbg_printf("%s: checking replaces\n", __func__);
|
||||||
if (!xbps_transaction_check_replaces(xhp, pkgs)) {
|
if (!xbps_transaction_check_replaces(xhp, pkgs)) {
|
||||||
xbps_object_release(xhp->transd);
|
xbps_object_release(xhp->transd);
|
||||||
xhp->transd = NULL;
|
xhp->transd = NULL;
|
||||||
@ -373,7 +373,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
/*
|
/*
|
||||||
* Check if there are missing revdeps.
|
* Check if there are missing revdeps.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: checking revdeps\n", __func__);
|
xbps_dbg_printf("%s: checking revdeps\n", __func__);
|
||||||
if (!xbps_transaction_check_revdeps(xhp, pkgs)) {
|
if (!xbps_transaction_check_revdeps(xhp, pkgs)) {
|
||||||
xbps_object_release(xhp->transd);
|
xbps_object_release(xhp->transd);
|
||||||
xhp->transd = NULL;
|
xhp->transd = NULL;
|
||||||
@ -381,7 +381,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
}
|
}
|
||||||
if (xbps_dictionary_get(xhp->transd, "missing_deps")) {
|
if (xbps_dictionary_get(xhp->transd, "missing_deps")) {
|
||||||
if (xhp->flags & XBPS_FLAG_FORCE_REMOVE_REVDEPS) {
|
if (xhp->flags & XBPS_FLAG_FORCE_REMOVE_REVDEPS) {
|
||||||
xbps_dbg_printf(xhp, "[trans] continuing with broken reverse dependencies!");
|
xbps_dbg_printf("[trans] continuing with broken reverse dependencies!");
|
||||||
} else {
|
} else {
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
/*
|
/*
|
||||||
* Check for package conflicts.
|
* Check for package conflicts.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: checking conflicts\n", __func__);
|
xbps_dbg_printf("%s: checking conflicts\n", __func__);
|
||||||
if (!xbps_transaction_check_conflicts(xhp, pkgs)) {
|
if (!xbps_transaction_check_conflicts(xhp, pkgs)) {
|
||||||
xbps_object_release(xhp->transd);
|
xbps_object_release(xhp->transd);
|
||||||
xhp->transd = NULL;
|
xhp->transd = NULL;
|
||||||
@ -401,7 +401,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
/*
|
/*
|
||||||
* Check for unresolved shared libraries.
|
* Check for unresolved shared libraries.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: checking shlibs\n", __func__);
|
xbps_dbg_printf("%s: checking shlibs\n", __func__);
|
||||||
if (!xbps_transaction_check_shlibs(xhp, pkgs)) {
|
if (!xbps_transaction_check_shlibs(xhp, pkgs)) {
|
||||||
xbps_object_release(xhp->transd);
|
xbps_object_release(xhp->transd);
|
||||||
xhp->transd = NULL;
|
xhp->transd = NULL;
|
||||||
@ -409,7 +409,7 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
|
|||||||
}
|
}
|
||||||
if (xbps_dictionary_get(xhp->transd, "missing_shlibs")) {
|
if (xbps_dictionary_get(xhp->transd, "missing_shlibs")) {
|
||||||
if (xhp->flags & XBPS_FLAG_FORCE_REMOVE_REVDEPS) {
|
if (xhp->flags & XBPS_FLAG_FORCE_REMOVE_REVDEPS) {
|
||||||
xbps_dbg_printf(xhp, "[trans] continuing with unresolved shared libraries!");
|
xbps_dbg_printf("[trans] continuing with unresolved shared libraries!");
|
||||||
} else {
|
} else {
|
||||||
return ENOEXEC;
|
return ENOEXEC;
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ out:
|
|||||||
* number of packages to be installed, updated, configured
|
* number of packages to be installed, updated, configured
|
||||||
* and removed to the transaction dictionary.
|
* and removed to the transaction dictionary.
|
||||||
*/
|
*/
|
||||||
xbps_dbg_printf(xhp, "%s: computing stats\n", __func__);
|
xbps_dbg_printf("%s: computing stats\n", __func__);
|
||||||
if ((rv = compute_transaction_stats(xhp)) != 0) {
|
if ((rv = compute_transaction_stats(xhp)) != 0) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ xbps_transaction_store(struct xbps_handle *xhp, xbps_array_t pkgs,
|
|||||||
if (!xbps_remove_pkg_from_array_by_pkgver(pkgs, curpkgver)) {
|
if (!xbps_remove_pkg_from_array_by_pkgver(pkgs, curpkgver)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
xbps_dbg_printf(xhp, "[trans] replaced %s with %s\n", curpkgver, pkgver);
|
xbps_dbg_printf("[trans] replaced %s with %s\n", curpkgver, pkgver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ xbps_transaction_store(struct xbps_handle *xhp, xbps_array_t pkgs,
|
|||||||
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_ADDPKG, 0, pkgver,
|
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_ADDPKG, 0, pkgver,
|
||||||
"Found %s in repository %s", pkgver, repo);
|
"Found %s in repository %s", pkgver, repo);
|
||||||
|
|
||||||
xbps_dbg_printf(xhp, "[trans] `%s' stored (%s)\n", pkgver, repo);
|
xbps_dbg_printf("[trans] `%s' stored (%s)\n", pkgver, repo);
|
||||||
xbps_object_release(pkgd);
|
xbps_object_release(pkgd);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -58,7 +58,7 @@ rsa_verify_hash(struct xbps_repo *repo, xbps_data_t pubkey,
|
|||||||
|
|
||||||
rsa = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
rsa = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||||
if (rsa == NULL) {
|
if (rsa == NULL) {
|
||||||
xbps_dbg_printf(repo->xhp, "`%s' error reading public key: %s\n",
|
xbps_dbg_printf("`%s' error reading public key: %s\n",
|
||||||
repo->uri, ERR_error_string(ERR_get_error(), NULL));
|
repo->uri, ERR_error_string(ERR_get_error(), NULL));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -84,13 +84,13 @@ xbps_verify_signature(struct xbps_repo *repo, const char *sigfile,
|
|||||||
bool val = false;
|
bool val = false;
|
||||||
|
|
||||||
if (!xbps_dictionary_count(repo->idxmeta)) {
|
if (!xbps_dictionary_count(repo->idxmeta)) {
|
||||||
xbps_dbg_printf(repo->xhp, "%s: unsigned repository\n", repo->uri);
|
xbps_dbg_printf("%s: unsigned repository\n", repo->uri);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
hexfp = xbps_pubkey2fp(repo->xhp,
|
hexfp = xbps_pubkey2fp(repo->xhp,
|
||||||
xbps_dictionary_get(repo->idxmeta, "public-key"));
|
xbps_dictionary_get(repo->idxmeta, "public-key"));
|
||||||
if (hexfp == NULL) {
|
if (hexfp == NULL) {
|
||||||
xbps_dbg_printf(repo->xhp, "%s: incomplete signed repo, missing hexfp obj\n", repo->uri);
|
xbps_dbg_printf("%s: incomplete signed repo, missing hexfp obj\n", repo->uri);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ xbps_verify_signature(struct xbps_repo *repo, const char *sigfile,
|
|||||||
rkeyfile = xbps_xasprintf("%s/keys/%s.plist", repo->xhp->metadir, hexfp);
|
rkeyfile = xbps_xasprintf("%s/keys/%s.plist", repo->xhp->metadir, hexfp);
|
||||||
repokeyd = xbps_plist_dictionary_from_file(repo->xhp, rkeyfile);
|
repokeyd = xbps_plist_dictionary_from_file(repo->xhp, rkeyfile);
|
||||||
if (xbps_object_type(repokeyd) != XBPS_TYPE_DICTIONARY) {
|
if (xbps_object_type(repokeyd) != XBPS_TYPE_DICTIONARY) {
|
||||||
xbps_dbg_printf(repo->xhp, "cannot read rkey data at %s: %s\n",
|
xbps_dbg_printf("cannot read rkey data at %s: %s\n",
|
||||||
rkeyfile, strerror(errno));
|
rkeyfile, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ xbps_verify_signature(struct xbps_repo *repo, const char *sigfile,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!xbps_mmap_file(sigfile, (void *)&sig_buf, &sigbuflen, &sigfilelen)) {
|
if (!xbps_mmap_file(sigfile, (void *)&sig_buf, &sigbuflen, &sigfilelen)) {
|
||||||
xbps_dbg_printf(repo->xhp, "can't open signature file %s: %s\n",
|
xbps_dbg_printf("can't open signature file %s: %s\n",
|
||||||
sigfile, strerror(errno));
|
sigfile, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ xbps_verify_file_signature(struct xbps_repo *repo, const char *fname)
|
|||||||
bool val = false;
|
bool val = false;
|
||||||
|
|
||||||
if (!xbps_file_sha256_raw(digest, sizeof digest, fname)) {
|
if (!xbps_file_sha256_raw(digest, sizeof digest, fname)) {
|
||||||
xbps_dbg_printf(repo->xhp, "can't open file %s: %s\n", fname, strerror(errno));
|
xbps_dbg_printf("can't open file %s: %s\n", fname, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user