Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-01-31 06:10:21 +0000
committerAaron Griffin <aaron@archlinux.org>2007-01-31 06:10:21 +0000
commit670319c2fb41f5ce5b446ad52bf2d8ddcf8c1548 (patch)
tree61fd4b3e50f695aa6887b39958f902dcf2708037 /lib/libalpm/alpm.c
parentf4340129d59377b32a7be64e09f71cb8faa3ac07 (diff)
Debug logging changes:
* The --debug params were goofy. New setup allows --debug without params, --debug=<level> where level 1=debug output, 2=debug and download output, 3=debug, download, and function tracing output. This seems more sane to me. * Removed PM_LOG_FLOW1 and PM_LOG_FLOW2. They were just confusing. When adding new functions, it is near impossible to determin if your output should be "flow1" or "flow2" without tracking all the way up the call chain. Rarely would one ever say "ok, lets just show "flow2" output. These have both been replaced with PM_LOG_DEBUG * Removed the need for the root parameter on alpm_initialize. it is now defaulted to PM_ROOT just like dbpath and cachedir. This allows alpm to be initialized BEFORE option parsing in the front end, saving us some duplicate variables in the frontend. * Cleaned up front end variables due to early alpm_initialize call.
Diffstat (limited to 'lib/libalpm/alpm.c')
-rw-r--r--lib/libalpm/alpm.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 77c8f91b..de89fb21 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -72,13 +72,10 @@ enum _pmerrno_t pm_errno SYMEXPORT;
/** Initializes the library. This must be called before any other
* functions are called.
- * @param root the full path of the root we'll be installing to (usually /)
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int SYMEXPORT alpm_initialize(const char *root)
+int SYMEXPORT alpm_initialize()
{
- char str[PATH_MAX];
-
ASSERT(handle == NULL, RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1));
handle = _alpm_handle_new();
@@ -86,13 +83,6 @@ int SYMEXPORT alpm_initialize(const char *root)
RET_ERR(PM_ERR_MEMORY, -1);
}
- STRNCPY(str, (root) ? root : PM_ROOT, PATH_MAX);
- /* add a trailing '/' if there isn't one */
- if(str[strlen(str)-1] != '/') {
- strcat(str, "/");
- }
- handle->root = strdup(str);
-
return(0);
}
@@ -185,7 +175,7 @@ int alpm_db_unregister(pmdb_t *db)
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
- _alpm_log(PM_LOG_FLOW1, _("unregistering database '%s'"), db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("unregistering database '%s'"), db->treename);
/* Cleanup */
_alpm_db_free_pkgcache(db);
@@ -236,11 +226,11 @@ int alpm_db_setserver(pmdb_t *db, const char *url)
return(-1);
}
db->servers = alpm_list_add(db->servers, server);
- _alpm_log(PM_LOG_FLOW2, _("adding new server to database '%s': protocol '%s', server '%s', path '%s'"),
+ _alpm_log(PM_LOG_DEBUG, _("adding new server to database '%s': protocol '%s', server '%s', path '%s'"),
db->treename, server->s_url->scheme, server->s_url->host, server->s_url->doc);
} else {
FREELIST(db->servers);
- _alpm_log(PM_LOG_FLOW2, _("serverlist flushed for '%s'"), db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("serverlist flushed for '%s'"), db->treename);
}
return(0);
@@ -312,7 +302,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, handle->root, handle->dbpath, db->treename);
/* remove the old dir */
- _alpm_log(PM_LOG_FLOW2, _("flushing database %s/%s"), handle->dbpath, db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("flushing database %s/%s"), handle->dbpath, db->treename);
for(lp = _alpm_db_get_pkgcache(db, INFRQ_NONE); lp; lp = lp->next) {
if(_alpm_db_remove(db, lp->data) == -1) {
if(lp->data) {
@@ -497,7 +487,7 @@ int alpm_pkg_checksha1sum(pmpkg_t *pkg)
}
if(strcmp(sha1sum, pkg->sha1sum) == 0) {
- _alpm_log(PM_LOG_FLOW1, _("checksums for package %s-%s are matching"),
+ _alpm_log(PM_LOG_DEBUG, _("checksums for package %s-%s are matching"),
pkg->name, pkg->version);
} else {
_alpm_log(PM_LOG_ERROR, _("sha1sums do not match for package %s-%s"),
@@ -546,7 +536,7 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg)
}
if(strcmp(md5sum, pkg->md5sum) == 0) {
- _alpm_log(PM_LOG_FLOW1, _("checksums for package %s-%s are matching"),
+ _alpm_log(PM_LOG_DEBUG, _("checksums for package %s-%s are matching"),
pkg->name, pkg->version);
} else {
_alpm_log(PM_LOG_ERROR, _("md5sums do not match for package %s-%s"),