FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-07-2011, 09:36 PM
Dan McGee
 
Default Switch all logging to use handle directly

This is the last user of our global handle object. Once again the diff
is large but the functional changes are not.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/add.c | 114 +++++++++++++++++++++++-----------------------
lib/libalpm/be_local.c | 47 ++++++++++---------
lib/libalpm/be_package.c | 34 +++++++-------
lib/libalpm/be_sync.c | 38 ++++++++-------
lib/libalpm/conflict.c | 70 +++++++++++++++-------------
lib/libalpm/db.c | 42 ++++++++---------
lib/libalpm/delta.c | 6 +--
lib/libalpm/deps.c | 48 +++++++------------
lib/libalpm/deps.h | 2 +-
lib/libalpm/diskspace.c | 22 ++++----
lib/libalpm/dload.c | 19 ++++----
lib/libalpm/group.c | 5 +--
lib/libalpm/handle.c | 6 +-
lib/libalpm/log.c | 2 +-
lib/libalpm/log.h | 3 +-
lib/libalpm/pkghash.c | 5 +-
lib/libalpm/remove.c | 84 +++++++++++++++++----------------
lib/libalpm/signing.c | 39 ++++++++--------
lib/libalpm/sync.c | 89 ++++++++++++++++++-----------------
lib/libalpm/trans.c | 14 +++---
lib/libalpm/util.c | 51 ++++++++++----------
lib/libalpm/util.h | 6 +-
22 files changed, 370 insertions(+), 376 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 20d6745..4ea6c34 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -53,28 +53,28 @@
int SYMEXPORT alpm_add_pkg(pmpkg_t *pkg)
{
const char *pkgname, *pkgver;
+ pmhandle_t *handle;
pmtrans_t *trans;
- pmdb_t *db_local;
pmpkg_t *local;

/* Sanity checks */
ASSERT(pkg != NULL, return -1);
- trans = pkg->handle->trans;
- ASSERT(trans != NULL, RET_ERR(pkg->handle, PM_ERR_TRANS_NULL, -1));
+ handle = pkg->handle;
+ trans = handle->trans;
+ ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_INITIALIZED,
- RET_ERR(pkg->handle, PM_ERR_TRANS_NOT_INITIALIZED, -1));
- db_local = pkg->handle->db_local;
+ RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1));

pkgname = pkg->name;
pkgver = pkg->version;

- _alpm_log(PM_LOG_DEBUG, "adding package '%s'
", pkgname);
+ _alpm_log(handle, PM_LOG_DEBUG, "adding package '%s'
", pkgname);

if(_alpm_pkg_find(trans->add, pkgname)) {
- RET_ERR(pkg->handle, PM_ERR_TRANS_DUP_TARGET, -1);
+ RET_ERR(handle, PM_ERR_TRANS_DUP_TARGET, -1);
}

- local = _alpm_db_get_pkgfromcache(db_local, pkgname);
+ local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname);
if(local) {
const char *localpkgname = alpm_pkg_get_name(local);
const char *localpkgver = alpm_pkg_get_version(local);
@@ -83,23 +83,23 @@ int SYMEXPORT alpm_add_pkg(pmpkg_t *pkg)
if(cmp == 0) {
if(trans->flags & PM_TRANS_FLAG_NEEDED) {
/* with the NEEDED flag, packages up to date are not reinstalled */
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping
"),
+ _alpm_log(handle, PM_LOG_WARNING, _("%s-%s is up to date -- skipping
"),
localpkgname, localpkgver);
return 0;
} else if(!(trans->flags & PM_TRANS_FLAG_DOWNLOADONLY)) {
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling
"),
+ _alpm_log(handle, PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling
"),
localpkgname, localpkgver);
}
} else if(cmp < 0) {
/* local version is newer */
- _alpm_log(PM_LOG_WARNING, _("downgrading package %s (%s => %s)
"),
+ _alpm_log(handle, PM_LOG_WARNING, _("downgrading package %s (%s => %s)
"),
localpkgname, localpkgver, pkgver);
}
}

/* add the package to the transaction */
pkg->reason = PM_PKG_REASON_EXPLICIT;
- _alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction add list
",
+ _alpm_log(handle, PM_LOG_DEBUG, "adding package %s-%s to the transaction add list
",
pkgname, pkgver);
trans->add = alpm_list_add(trans->add, pkg);

@@ -119,10 +119,10 @@ static int perform_extraction(pmhandle_t *handle, struct archive *archive,
ret = archive_read_extract(archive, entry, archive_flags);
if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) {
/* operation succeeded but a "non-critical" error was encountered */
- _alpm_log(PM_LOG_WARNING, _("warning given when extracting %s (%s)
"),
+ _alpm_log(handle, PM_LOG_WARNING, _("warning given when extracting %s (%s)
"),
origname, archive_error_string(archive));
} else if(ret != ARCHIVE_OK) {
- _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not extract %s (%s)
"),
origname, archive_error_string(archive));
alpm_logaction(handle, "error: could not extract %s (%s)
",
origname, archive_error_string(archive));
@@ -160,7 +160,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
} else if(*entryname == '.') {
/* for now, ignore all files starting with '.' that haven't
* already been handled (for future possibilities) */
- _alpm_log(PM_LOG_DEBUG, "skipping extraction of '%s'
", entryname);
+ _alpm_log(handle, PM_LOG_DEBUG, "skipping extraction of '%s'
", entryname);
archive_read_data_skip(archive);
return 0;
} else {
@@ -170,7 +170,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,

/* if a file is in NoExtract then we never extract it */
if(alpm_list_find_str(handle->noextract, entryname)) {
- _alpm_log(PM_LOG_DEBUG, "%s is in NoExtract, skipping extraction
",
+ _alpm_log(handle, PM_LOG_DEBUG, "%s is in NoExtract, skipping extraction
",
entryname);
alpm_logaction(handle, "note: %s is in NoExtract, skipping extraction
",
entryname);
@@ -209,20 +209,20 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
if(lsbuf.st_mode != entrymode) {
/* if filesystem perms are different than pkg perms, warn user */
mode_t mask = 07777;
- _alpm_log(PM_LOG_WARNING, _("directory permissions differ on %s
"
+ _alpm_log(handle, PM_LOG_WARNING, _("directory permissions differ on %s
"
"filesystem: %o package: %o
"), entryname, lsbuf.st_mode & mask,
entrymode & mask);
alpm_logaction(handle, "warning: directory permissions differ on %s
"
"filesystem: %o package: %o
", entryname, lsbuf.st_mode & mask,
entrymode & mask);
}
- _alpm_log(PM_LOG_DEBUG, "extract: skipping dir extraction of %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "extract: skipping dir extraction of %s
",
entryname);
archive_read_data_skip(archive);
return 0;
} else {
/* case 10/11: trying to overwrite dir with file/symlink, don't allow it */
- _alpm_log(PM_LOG_ERROR, _("extract: not overwriting dir with file %s
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("extract: not overwriting dir with file %s
"),
entryname);
archive_read_data_skip(archive);
return 1;
@@ -231,20 +231,20 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
/* case 9: existing symlink, dir in package */
if(S_ISDIR(sbuf.st_mode)) {
/* the symlink on FS is to a directory, so we'll use it */
- _alpm_log(PM_LOG_DEBUG, "extract: skipping symlink overwrite of %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "extract: skipping symlink overwrite of %s
",
entryname);
archive_read_data_skip(archive);
return 0;
} else {
/* this is BAD. symlink was not to a directory */
- _alpm_log(PM_LOG_ERROR, _("extract: symlink %s does not point to dir
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("extract: symlink %s does not point to dir
"),
entryname);
archive_read_data_skip(archive);
return 1;
}
} else if(S_ISREG(lsbuf.st_mode) && S_ISDIR(entrymode)) {
/* case 6: trying to overwrite file with dir */
- _alpm_log(PM_LOG_DEBUG, "extract: overwriting file with dir %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "extract: overwriting file with dir %s
",
entryname);
} else if(S_ISREG(entrymode)) {
/* case 4,7: */
@@ -318,10 +318,10 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
backups->data = backup;
}

- _alpm_log(PM_LOG_DEBUG, "checking hashes for %s
", entryname_orig);
- _alpm_log(PM_LOG_DEBUG, "current: %s
", hash_local);
- _alpm_log(PM_LOG_DEBUG, "new: %s
", hash_pkg);
- _alpm_log(PM_LOG_DEBUG, "original: %s
", hash_orig);
+ _alpm_log(handle, PM_LOG_DEBUG, "checking hashes for %s
", entryname_orig);
+ _alpm_log(handle, PM_LOG_DEBUG, "current: %s
", hash_local);
+ _alpm_log(handle, PM_LOG_DEBUG, "new: %s
", hash_pkg);
+ _alpm_log(handle, PM_LOG_DEBUG, "original: %s
", hash_orig);

if(!oldpkg) {
if(strcmp(hash_local, hash_pkg) != 0) {
@@ -332,7 +332,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,

/* move the existing file to the "pacorig" */
if(rename(filename, newpath)) {
- _alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not rename %s to %s (%s)
"),
filename, newpath, strerror(errno));
alpm_logaction(handle, "error: could not rename %s to %s (%s)
",
filename, newpath, strerror(errno));
@@ -340,13 +340,13 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
} else {
/* rename the file we extracted to the real name */
if(rename(checkfile, filename)) {
- _alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not rename %s to %s (%s)
"),
checkfile, filename, strerror(errno));
alpm_logaction(handle, "error: could not rename %s to %s (%s)
",
checkfile, filename, strerror(errno));
errors++;
} else {
- _alpm_log(PM_LOG_WARNING, _("%s saved as %s
"), filename, newpath);
+ _alpm_log(handle, PM_LOG_WARNING, _("%s saved as %s
"), filename, newpath);
alpm_logaction(handle, "warning: %s saved as %s
", filename, newpath);
}
}
@@ -360,11 +360,11 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
if(strcmp(hash_orig, hash_local) == 0) {
/* installed file has NOT been changed by user */
if(strcmp(hash_orig, hash_pkg) != 0) {
- _alpm_log(PM_LOG_DEBUG, "action: installing new file: %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "action: installing new file: %s
",
entryname_orig);

if(rename(checkfile, filename)) {
- _alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not rename %s to %s (%s)
"),
checkfile, filename, strerror(errno));
alpm_logaction(handle, "error: could not rename %s to %s (%s)
",
checkfile, filename, strerror(errno));
@@ -373,33 +373,33 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
} else {
/* there's no sense in installing the same file twice, install
* ONLY is the original and package hashes differ */
- _alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place
");
+ _alpm_log(handle, PM_LOG_DEBUG, "action: leaving existing file in place
");
unlink(checkfile);
}
} else if(strcmp(hash_orig, hash_pkg) == 0) {
/* originally installed file and new file are the same - this
* implies the case above failed - i.e. the file was changed by a
* user */
- _alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place
");
+ _alpm_log(handle, PM_LOG_DEBUG, "action: leaving existing file in place
");
unlink(checkfile);
} else if(strcmp(hash_local, hash_pkg) == 0) {
/* this would be magical. The above two cases failed, but the
* user changes just so happened to make the new file exactly the
* same as the one in the package... skip it */
- _alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place
");
+ _alpm_log(handle, PM_LOG_DEBUG, "action: leaving existing file in place
");
unlink(checkfile);
} else {
char newpath[PATH_MAX];
- _alpm_log(PM_LOG_DEBUG, "action: keeping current file and installing"
+ _alpm_log(handle, PM_LOG_DEBUG, "action: keeping current file and installing"
" new one with .pacnew ending
");
snprintf(newpath, PATH_MAX, "%s.pacnew", filename);
if(rename(checkfile, newpath)) {
- _alpm_log(PM_LOG_ERROR, _("could not install %s as %s (%s)
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not install %s as %s (%s)
"),
filename, newpath, strerror(errno));
alpm_logaction(handle, "error: could not install %s as %s (%s)
",
filename, newpath, strerror(errno));
} else {
- _alpm_log(PM_LOG_WARNING, _("%s installed as %s
"),
+ _alpm_log(handle, PM_LOG_WARNING, _("%s installed as %s
"),
filename, newpath);
alpm_logaction(handle, "warning: %s installed as %s
",
filename, newpath);
@@ -416,12 +416,12 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
/* we didn't need a backup */
if(notouch) {
/* change the path to a .pacnew extension */
- _alpm_log(PM_LOG_DEBUG, "%s is in NoUpgrade -- skipping
", filename);
- _alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew
"), filename, filename);
+ _alpm_log(handle, PM_LOG_DEBUG, "%s is in NoUpgrade -- skipping
", filename);
+ _alpm_log(handle, PM_LOG_WARNING, _("extracting %s as %s.pacnew
"), filename, filename);
alpm_logaction(handle, "warning: extracting %s as %s.pacnew
", filename, filename);
strncat(filename, ".pacnew", PATH_MAX - strlen(filename));
} else {
- _alpm_log(PM_LOG_DEBUG, "extracting %s
", filename);
+ _alpm_log(handle, PM_LOG_DEBUG, "extracting %s
", filename);
}

if(handle->trans->flags & PM_TRANS_FLAG_FORCE) {
@@ -449,7 +449,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive,
if(!oldbackup || strcmp(oldbackup, entryname_orig) != 0) {
continue;
}
- _alpm_log(PM_LOG_DEBUG, "appending backup entry for %s
", filename);
+ _alpm_log(handle, PM_LOG_DEBUG, "appending backup entry for %s
", filename);

hash = alpm_compute_md5sum(filename);
MALLOC(backup, backup_len, RET_ERR(handle, PM_ERR_MEMORY, -1));
@@ -491,7 +491,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
_alpm_local_db_read(oldpkg->origin_data.db, oldpkg, INFRQ_ALL);

EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, oldpkg);
- _alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "upgrading package %s-%s
",
newpkg->name, newpkg->version);

/* copy over the install reason */
@@ -506,7 +506,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
is_upgrade = 0;

EVENT(trans, PM_TRANS_EVT_ADD_START, newpkg, NULL);
- _alpm_log(PM_LOG_DEBUG, "adding package %s-%s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "adding package %s-%s
",
newpkg->name, newpkg->version);

/* pre_install scriptlet */
@@ -548,7 +548,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
char cwd[PATH_MAX] = "";
int restore_cwd = 0;

- _alpm_log(PM_LOG_DEBUG, "extracting files
");
+ _alpm_log(handle, PM_LOG_DEBUG, "extracting files
");

if((archive = archive_read_new()) == NULL) {
handle->pm_errno = PM_ERR_LIBARCHIVE;
@@ -559,7 +559,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);

- _alpm_log(PM_LOG_DEBUG, "archive: %s
", newpkg->origin_data.file);
+ _alpm_log(handle, PM_LOG_DEBUG, "archive: %s
", newpkg->origin_data.file);
if(archive_read_open_filename(archive, newpkg->origin_data.file,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
handle->pm_errno = PM_ERR_PKG_OPEN;
@@ -569,15 +569,15 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,

/* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not get current working directory
"));
+ _alpm_log(handle, PM_LOG_ERROR, _("could not get current working directory
"));
} else {
restore_cwd = 1;
}

/* libarchive requires this for extracting hard links */
- if(chdir(newpkg->handle->root) != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)
"),
- newpkg->handle->root, strerror(errno));
+ if(chdir(handle->root) != 0) {
+ _alpm_log(handle, PM_LOG_ERROR, _("could not change directory to %s (%s)
"),
+ handle->root, strerror(errno));
ret = -1;
goto cleanup;
}
@@ -600,7 +600,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
* (missing metadata sizes) */
int64_t pos = archive_position_compressed(archive);
percent = (pos * 100) / newpkg->size;
- _alpm_log(PM_LOG_DEBUG, "decompression progress: "
+ _alpm_log(handle, PM_LOG_DEBUG, "decompression progress: "
"%d%% (%"PRId64" / %jd)
",
percent, pos, (intmax_t)newpkg->size);
if(percent >= 100) {
@@ -627,18 +627,18 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,

/* restore the old cwd if we have it */
if(restore_cwd && chdir(cwd) != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)
"), cwd, strerror(errno));
+ _alpm_log(handle, PM_LOG_ERROR, _("could not change directory to %s (%s)
"), cwd, strerror(errno));
}

if(errors) {
ret = -1;
if(is_upgrade) {
- _alpm_log(PM_LOG_ERROR, _("problem occurred while upgrading %s
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("problem occurred while upgrading %s
"),
newpkg->name);
alpm_logaction(handle, "error: problem occurred while upgrading %s
",
newpkg->name);
} else {
- _alpm_log(PM_LOG_ERROR, _("problem occurred while installing %s
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("problem occurred while installing %s
"),
newpkg->name);
alpm_logaction(handle, "error: problem occurred while installing %s
",
newpkg->name);
@@ -649,11 +649,11 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
/* make an install date (in UTC) */
newpkg->installdate = time(NULL);

- _alpm_log(PM_LOG_DEBUG, "updating database
");
- _alpm_log(PM_LOG_DEBUG, "adding database entry '%s'
", newpkg->name);
+ _alpm_log(handle, PM_LOG_DEBUG, "updating database
");
+ _alpm_log(handle, PM_LOG_DEBUG, "adding database entry '%s'
", newpkg->name);

if(_alpm_local_db_write(db, newpkg, INFRQ_ALL)) {
- _alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not update database entry %s-%s
"),
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
alpm_logaction(handle, "error: could not update database entry %s-%s
",
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
@@ -663,7 +663,7 @@ static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg,
}

if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
- _alpm_log(PM_LOG_ERROR, _("could not add entry '%s' in cache
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("could not add entry '%s' in cache
"),
alpm_pkg_get_name(newpkg));
}

diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index d7d1812..d9a76cc 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -279,13 +279,13 @@ static int checkdbdir(pmdb_t *db)
const char *path = _alpm_db_path(db);

if(stat(path, &buf) != 0) {
- _alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "database dir '%s' does not exist, creating it
",
path);
if(_alpm_makepath(path) != 0) {
RET_ERR(db->handle, PM_ERR_SYSTEM, -1);
}
} else if(!S_ISDIR(buf.st_mode)) {
- _alpm_log(PM_LOG_WARNING, _("removing invalid database: %s
"), path);
+ _alpm_log(db->handle, PM_LOG_WARNING, _("removing invalid database: %s
"), path);
if(unlink(path) != 0 || _alpm_makepath(path) != 0) {
RET_ERR(db->handle, PM_ERR_SYSTEM, -1);
}
@@ -383,7 +383,7 @@ static int local_db_populate(pmdb_t *db)
}
/* split the db entry name */
if(_alpm_splitname(name, pkg) != 0) {
- _alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'
"),
+ _alpm_log(db->handle, PM_LOG_ERROR, _("invalid name for database entry '%s'
"),
name);
_alpm_pkg_free(pkg);
continue;
@@ -391,7 +391,7 @@ static int local_db_populate(pmdb_t *db)

/* duplicated database entries are not allowed */
if(_alpm_pkghash_find(db->pkgcache, pkg->name)) {
- _alpm_log(PM_LOG_ERROR, _("duplicated database entry '%s'
"), pkg->name);
+ _alpm_log(db->handle, PM_LOG_ERROR, _("duplicated database entry '%s'
"), pkg->name);
_alpm_pkg_free(pkg);
continue;
}
@@ -403,13 +403,13 @@ static int local_db_populate(pmdb_t *db)

/* explicitly read with only 'BASE' data, accessors will handle the rest */
if(_alpm_local_db_read(db, pkg, INFRQ_BASE) == -1) {
- _alpm_log(PM_LOG_ERROR, _("corrupted database entry '%s'
"), name);
+ _alpm_log(db->handle, PM_LOG_ERROR, _("corrupted database entry '%s'
"), name);
_alpm_pkg_free(pkg);
continue;
}

/* add to the collection */
- _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'
",
+ _alpm_log(db->handle, PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'
",
pkg->name, db->treename);
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
count++;
@@ -419,7 +419,7 @@ static int local_db_populate(pmdb_t *db)
if(count > 0) {
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
}
- _alpm_log(PM_LOG_DEBUG, "added %d packages to package cache for db '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "added %d packages to package cache for db '%s'
",
count, db->treename);

return count;
@@ -448,12 +448,13 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
char *pkgpath = NULL;

if(info == NULL || info->name == NULL || info->version == NULL) {
- _alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_local_db_read, skipping
");
+ _alpm_log(db->handle, PM_LOG_DEBUG,
+ "invalid package entry provided to _alpm_local_db_read, skipping
");
return -1;
}

if(info->origin != PKG_FROM_LOCALDB) {
- _alpm_log(PM_LOG_DEBUG,
+ _alpm_log(db->handle, PM_LOG_DEBUG,
"request to read info for a non-local package '%s', skipping...
",
info->name);
return -1;
@@ -468,7 +469,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
/* already loaded all of this info, do nothing */
return 0;
}
- _alpm_log(PM_LOG_FUNCTION, "loading package data for %s : level=0x%x
",
+ _alpm_log(db->handle, PM_LOG_FUNCTION, "loading package data for %s : level=0x%x
",
info->name, inforeq);

/* clear out 'line', to be certain - and to make valgrind happy */
@@ -478,7 +479,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)

if(access(pkgpath, F_OK)) {
/* directory doesn't exist or can't be opened */
- _alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'
",
info->name, info->version, db->treename);
goto error;
}
@@ -487,7 +488,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) {
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s
"), path, strerror(errno));
+ _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s
"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@@ -500,7 +501,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
goto error;
}
if(strcmp(_alpm_strtrim(line), info->name) != 0) {
- _alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
+ _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s
"), db->treename, info->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
@@ -508,7 +509,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
goto error;
}
if(strcmp(_alpm_strtrim(line), info->version) != 0) {
- _alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
+ _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s
"), db->treename, info->name);
}
} else if(strcmp(line, "%DESC%") == 0) {
@@ -611,7 +612,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) {
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s
"), path, strerror(errno));
+ _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s
"), path, strerror(errno));
goto error;
}
while(fgets(line, sizeof(line), fp)) {
@@ -670,7 +671,7 @@ int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info)
pkgpath = get_pkgpath(db, info);

if((retval = mkdir(pkgpath, 0755)) != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s
"),
+ _alpm_log(db->handle, PM_LOG_ERROR, _("could not create directory %s: %s
"),
pkgpath, strerror(errno));
}

@@ -704,11 +705,12 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)

/* DESC */
if(inforeq & INFRQ_DESC) {
- _alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "writing %s-%s DESC information back to db
",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s
"), path, strerror(errno));
+ _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s
"),
+ path, strerror(errno));
retval = -1;
goto cleanup;
}
@@ -805,11 +807,12 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)

/* FILES */
if(inforeq & INFRQ_FILES) {
- _alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "writing %s-%s FILES information back to db
",
info->name, info->version);
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s
"), path, strerror(errno));
+ _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s
"),
+ path, strerror(errno));
retval = -1;
goto cleanup;
}
@@ -908,7 +911,7 @@ done:
closedir(dbdir);
}

- _alpm_log(PM_LOG_DEBUG, "local database version %d
", version);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "local database version %d
", version);
return version;
}

@@ -922,7 +925,7 @@ pmdb_t *_alpm_db_register_local(pmhandle_t *handle)
{
pmdb_t *db;

- _alpm_log(PM_LOG_DEBUG, "registering local database
");
+ _alpm_log(handle, PM_LOG_DEBUG, "registering local database
");

db = _alpm_db_new("local", 1);
if(db == NULL) {
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 20b9f52..a77e286 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -137,7 +137,7 @@ static struct pkg_operations *get_file_pkg_ops(void)
*
* @return 0 on success, -1 on error
*/
-static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
+static int parse_descfile(pmhandle_t *handle, struct archive *a, pmpkg_t *newpkg)
{
char *ptr = NULL;
char *key = NULL;
@@ -159,7 +159,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
ptr = line;
key = strsep(&ptr, "=");
if(key == NULL || ptr == NULL) {
- _alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d
",
+ _alpm_log(handle, PM_LOG_DEBUG, "%s: syntax error in description file line %d
",
newpkg->name ? newpkg->name : "error", linenum);
} else {
key = _alpm_strtrim(key);
@@ -207,14 +207,14 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
} else if(strcmp(key, "makepkgopt") == 0) {
/* not used atm */
} else {
- _alpm_log(PM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d
",
+ _alpm_log(handle, PM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d
",
newpkg->name ? newpkg->name : "error", key, linenum);
}
}
line[0] = '';
}
if(ret != ARCHIVE_EOF) {
- _alpm_log(PM_LOG_DEBUG, "error parsing package descfile
");
+ _alpm_log(handle, PM_LOG_DEBUG, "error parsing package descfile
");
return -1;
}

@@ -258,18 +258,18 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
}

/* first steps- validate the package file */
- _alpm_log(PM_LOG_DEBUG, "md5sum: %s
", md5sum);
+ _alpm_log(handle, PM_LOG_DEBUG, "md5sum: %s
", md5sum);
if(md5sum) {
- _alpm_log(PM_LOG_DEBUG, "checking md5sum for %s
", pkgfile);
+ _alpm_log(handle, PM_LOG_DEBUG, "checking md5sum for %s
", pkgfile);
if(_alpm_test_md5sum(pkgfile, md5sum) != 0) {
alpm_pkg_free(newpkg);
RET_ERR(handle, PM_ERR_PKG_INVALID, NULL);
}
}

- _alpm_log(PM_LOG_DEBUG, "base64_sig: %s
", base64_sig);
+ _alpm_log(handle, PM_LOG_DEBUG, "base64_sig: %s
", base64_sig);
if(check_sig != PM_PGP_VERIFY_NEVER) {
- _alpm_log(PM_LOG_DEBUG, "checking signature for %s
", pkgfile);
+ _alpm_log(handle, PM_LOG_DEBUG, "checking signature for %s
", pkgfile);
ret = _alpm_gpgme_checksig(handle, pkgfile, base64_sig);
if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
(check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
@@ -292,7 +292,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
RET_ERR(handle, PM_ERR_PKG_OPEN, NULL);
}

- _alpm_log(PM_LOG_DEBUG, "starting package load for %s
", pkgfile);
+ _alpm_log(handle, PM_LOG_DEBUG, "starting package load for %s
", pkgfile);

/* If full is false, only read through the archive until we find our needed
* metadata. If it is true, read through the entire archive, which serves
@@ -302,17 +302,17 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,

if(strcmp(entry_name, ".PKGINFO") == 0) {
/* parse the info file */
- if(parse_descfile(archive, newpkg) != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not parse package description file in %s
"),
+ if(parse_descfile(handle, archive, newpkg) != 0) {
+ _alpm_log(handle, PM_LOG_ERROR, _("could not parse package description file in %s
"),
pkgfile);
goto pkg_invalid;
}
if(newpkg->name == NULL || strlen(newpkg->name) == 0) {
- _alpm_log(PM_LOG_ERROR, _("missing package name in %s
"), pkgfile);
+ _alpm_log(handle, PM_LOG_ERROR, _("missing package name in %s
"), pkgfile);
goto pkg_invalid;
}
if(newpkg->version == NULL || strlen(newpkg->version) == 0) {
- _alpm_log(PM_LOG_ERROR, _("missing package version in %s
"), pkgfile);
+ _alpm_log(handle, PM_LOG_ERROR, _("missing package version in %s
"), pkgfile);
goto pkg_invalid;
}
config = 1;
@@ -328,7 +328,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
}

if(archive_read_data_skip(archive)) {
- _alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("error while reading package %s: %s
"),
pkgfile, archive_error_string(archive));
handle->pm_errno = PM_ERR_LIBARCHIVE;
goto error;
@@ -341,14 +341,14 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
}

if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
- _alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s
"),
+ _alpm_log(handle, PM_LOG_ERROR, _("error while reading package %s: %s
"),
pkgfile, archive_error_string(archive));
handle->pm_errno = PM_ERR_LIBARCHIVE;
goto error;
}

if(!config) {
- _alpm_log(PM_LOG_ERROR, _("missing package metadata in %s
"), pkgfile);
+ _alpm_log(handle, PM_LOG_ERROR, _("missing package metadata in %s
"), pkgfile);
goto pkg_invalid;
}

@@ -362,7 +362,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,

if(full) {
/* "checking for conflicts" requires a sorted list, ensure that here */
- _alpm_log(PM_LOG_DEBUG, "sorting package filelist for %s
", pkgfile);
+ _alpm_log(handle, PM_LOG_DEBUG, "sorting package filelist for %s
", pkgfile);
newpkg->files = alpm_list_msort(newpkg->files, alpm_list_count(newpkg->files),
_alpm_str_cmp);
newpkg->infolevel = INFRQ_ALL;
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index ecef7a5..0469c63 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -103,14 +103,14 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
oldmask = umask(0022);

if(stat(syncpath, &buf) != 0) {
- _alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it
",
+ _alpm_log(handle, PM_LOG_DEBUG, "database dir '%s' does not exist, creating it
",
syncpath);
if(_alpm_makepath(syncpath) != 0) {
free(syncpath);
RET_ERR(handle, PM_ERR_SYSTEM, -1);
}
} else if(!S_ISDIR(buf.st_mode)) {
- _alpm_log(PM_LOG_WARNING, _("removing invalid file: %s
"), syncpath);
+ _alpm_log(handle, PM_LOG_WARNING, _("removing invalid file: %s
"), syncpath);
if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
free(syncpath);
RET_ERR(handle, PM_ERR_SYSTEM, -1);
@@ -155,7 +155,8 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
goto cleanup;
} else if(ret == -1) {
/* pm_errno was set by the download code */
- _alpm_log(PM_LOG_DEBUG, "failed to sync db: %s
", alpm_strerror(handle->pm_errno));
+ _alpm_log(handle, PM_LOG_DEBUG, "failed to sync db: %s
",
+ alpm_strerror(handle->pm_errno));
goto cleanup;
}

@@ -255,11 +256,11 @@ static int sync_db_populate(pmdb_t *db)
return -1;
}

- _alpm_log(PM_LOG_DEBUG, "opening database archive %s
", dbpath);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "opening database archive %s
", dbpath);

if(archive_read_open_filename(archive, dbpath,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
- _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s
"), dbpath,
+ _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s
"), dbpath,
archive_error_string(archive));
archive_read_finish(archive);
RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
@@ -292,7 +293,7 @@ static int sync_db_populate(pmdb_t *db)
name = archive_entry_pathname(entry);

if(_alpm_splitname(name, pkg) != 0) {
- _alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'
"),
+ _alpm_log(db->handle, PM_LOG_ERROR, _("invalid name for database entry '%s'
"),
name);
_alpm_pkg_free(pkg);
pkg = NULL;
@@ -301,7 +302,7 @@ static int sync_db_populate(pmdb_t *db)

/* duplicated database entries are not allowed */
if(_alpm_pkghash_find(db->pkgcache, pkg->name)) {
- _alpm_log(PM_LOG_ERROR, _("duplicated database entry '%s'
"), pkg->name);
+ _alpm_log(db->handle, PM_LOG_ERROR, _("duplicated database entry '%s'
"), pkg->name);
_alpm_pkg_free(pkg);
pkg = NULL;
continue;
@@ -313,14 +314,14 @@ static int sync_db_populate(pmdb_t *db)
pkg->handle = db->handle;

/* add to the collection */
- _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'
",
+ _alpm_log(db->handle, PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'
",
pkg->name, db->treename);
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
count++;
} else {
/* we have desc, depends or deltas - parse it */
if(sync_db_read(db, archive, entry, pkg) != 0) {
- _alpm_log(PM_LOG_ERROR,
+ _alpm_log(db->handle, PM_LOG_ERROR,
_("could not parse package '%s' description file from db '%s'
"),
pkg->name, db->treename);
_alpm_pkg_free(pkg);
@@ -334,7 +335,7 @@ static int sync_db_populate(pmdb_t *db)
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
}
archive_read_finish(archive);
- _alpm_log(PM_LOG_DEBUG, "added %d packages to package cache for db '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "added %d packages to package cache for db '%s'
",
count, db->treename);

return count;
@@ -368,11 +369,12 @@ static int sync_db_read(pmdb_t *db, struct archive *archive,

entryname = archive_entry_pathname(entry);
if(entryname == NULL) {
- _alpm_log(PM_LOG_DEBUG, "invalid archive entry provided to _alpm_sync_db_read, skipping
");
+ _alpm_log(db->handle, PM_LOG_DEBUG,
+ "invalid archive entry provided to _alpm_sync_db_read, skipping
");
return -1;
}

- _alpm_log(PM_LOG_FUNCTION, "loading package data from archive entry %s
",
+ _alpm_log(db->handle, PM_LOG_FUNCTION, "loading package data from archive entry %s
",
entryname);

memset(&buf, 0, sizeof(buf));
@@ -398,7 +400,7 @@ static int sync_db_read(pmdb_t *db, struct archive *archive,
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);
}
if(pkg == NULL) {
- _alpm_log(PM_LOG_DEBUG, "package %s not found in %s sync database",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "package %s not found in %s sync database",
pkgname, db->treename);
return -1;
}
@@ -412,13 +414,13 @@ static int sync_db_read(pmdb_t *db, struct archive *archive,
if(strcmp(line, "%NAME%") == 0) {
READ_NEXT(line);
if(strcmp(line, pkg->name) != 0) {
- _alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
+ _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s
"), db->treename, pkg->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
READ_NEXT(line);
if(strcmp(line, pkg->version) != 0) {
- _alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
+ _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s
"), db->treename, pkg->name);
}
} else if(strcmp(line, "%FILENAME%") == 0) {
@@ -490,13 +492,13 @@ static int sync_db_read(pmdb_t *db, struct archive *archive,
/* currently do nothing with this file */
} else {
/* unknown database file */
- _alpm_log(PM_LOG_DEBUG, "unknown database file: %s
", filename);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "unknown database file: %s
", filename);
}

return 0;

error:
- _alpm_log(PM_LOG_DEBUG, "error parsing database file: %s
", filename);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "error parsing database file: %s
", filename);
FREE(pkgname);
return -1;
}
@@ -516,7 +518,7 @@ pmdb_t *_alpm_db_register_sync(pmhandle_t *handle, const char *treename)
{
pmdb_t *db;

- _alpm_log(PM_LOG_DEBUG, "registering sync database '%s'
", treename);
+ _alpm_log(handle, PM_LOG_DEBUG, "registering sync database '%s'
", treename);

db = _alpm_db_new(treename, 0);
if(db == NULL) {
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 1d3f0e7..b64604f 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -93,19 +93,21 @@ static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
return 0;
}

-/** Adds the pkg1/pkg2 conflict to the baddeps list
- * @param *baddeps list to add conflict to
+/** Adds the pkg1/pkg2 conflict to the baddeps list.
+ * @param handle the context handle
+ * @param baddeps list to add conflict to
* @param pkg1 first package
* @param pkg2 package causing conflict
+ * @param reason reason for this conflict
*/
-static int add_conflict(alpm_list_t **baddeps, const char *pkg1,
- const char *pkg2, const char *reason)
+static int add_conflict(pmhandle_t *handle, alpm_list_t **baddeps,
+ const char *pkg1, const char *pkg2, const char *reason)
{
pmconflict_t *conflict = conflict_new(pkg1, pkg2, reason);
if(!conflict) {
return -1;
}
- _alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)
",
+ _alpm_log(handle, PM_LOG_DEBUG, "package %s conflicts with %s (by %s)
",
pkg1, pkg2, reason);
if(!conflict_isin(conflict, *baddeps)) {
*baddeps = alpm_list_add(*baddeps, conflict);
@@ -121,14 +123,16 @@ static int add_conflict(alpm_list_t **baddeps, const char *pkg1,
* If a conflict (pkg1, pkg2) is found, it is added to the baddeps list
* in this order if order >= 0, or reverse order (pkg2,pkg1) otherwise.
*
+ * @param handle the context handle
* @param list1 first list of packages
* @param list2 second list of packages
- * @param *baddeps list to store conflicts
+ * @param baddeps list to store conflicts
* @param order if >= 0 the conflict order is preserved, if < 0 it's reversed
*/
-static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
+static void check_conflict(pmhandle_t *handle,
+ alpm_list_t *list1, alpm_list_t *list2,
alpm_list_t **baddeps, int order) {
- alpm_list_t *i, *j, *k;
+ alpm_list_t *i;

if(!baddeps) {
return;
@@ -136,9 +140,11 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
for(i = list1; i; i = i->next) {
pmpkg_t *pkg1 = i->data;
const char *pkg1name = alpm_pkg_get_name(pkg1);
+ alpm_list_t *j;

for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
const char *conflict = j->data;
+ alpm_list_t *k;
pmdepend_t *parsed_conflict = _alpm_splitdep(conflict);

for(k = list2; k; k = k->next) {
@@ -152,9 +158,9 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,

if(_alpm_depcmp(pkg2, parsed_conflict)) {
if(order >= 0) {
- add_conflict(baddeps, pkg1name, pkg2name, conflict);
+ add_conflict(handle, baddeps, pkg1name, pkg2name, conflict);
} else {
- add_conflict(baddeps, pkg2name, pkg1name, conflict);
+ add_conflict(handle, baddeps, pkg2name, pkg1name, conflict);
}
}
}
@@ -168,8 +174,8 @@ alpm_list_t *_alpm_innerconflicts(pmhandle_t *handle, alpm_list_t *packages)
{
alpm_list_t *baddeps = NULL;

- _alpm_log(PM_LOG_DEBUG, "check targets vs targets
");
- check_conflict(packages, packages, &baddeps, 0);
+ _alpm_log(handle, PM_LOG_DEBUG, "check targets vs targets
");
+ check_conflict(handle, packages, packages, &baddeps, 0);

return baddeps;
}
@@ -190,10 +196,10 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
packages, _alpm_pkg_cmp);

/* two checks to be done here for conflicts */
- _alpm_log(PM_LOG_DEBUG, "check targets vs db
");
- check_conflict(packages, dblist, &baddeps, 1);
- _alpm_log(PM_LOG_DEBUG, "check db vs targets
");
- check_conflict(dblist, packages, &baddeps, -1);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "check targets vs db
");
+ check_conflict(db->handle, packages, dblist, &baddeps, 1);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "check db vs targets
");
+ check_conflict(db->handle, dblist, packages, &baddeps, -1);

alpm_list_free(dblist);
return baddeps;
@@ -206,7 +212,8 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
* @return an alpm_list_t of pmconflict_t
*/
alpm_list_t SYMEXPORT *alpm_checkconflicts(pmhandle_t *handle,
- alpm_list_t *pkglist) {
+ alpm_list_t *pkglist)
+{
return _alpm_innerconflicts(handle, pkglist);
}

@@ -272,9 +279,9 @@ static alpm_list_t *filelist_operation(alpm_list_t *filesA, alpm_list_t *filesB,
* two package names or one package name and NULL. This is a wrapper for former
* functionality that was done inline.
*/
-static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
- pmfileconflicttype_t type, const char *filestr,
- const char* name1, const char* name2)
+static alpm_list_t *add_fileconflict(pmhandle_t *handle,
+ alpm_list_t *conflicts, pmfileconflicttype_t type, const char *filestr,
+ const char *name1, const char *name2)
{
pmfileconflict_t *conflict;
MALLOC(conflict, sizeof(pmfileconflict_t), return NULL);
@@ -289,7 +296,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
}

conflicts = alpm_list_add(conflicts, conflict);
- _alpm_log(PM_LOG_DEBUG, "found file conflict %s, packages %s and %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "found file conflict %s, packages %s and %s
",
filestr, name1, name2 ? name2 : "(filesystem)");

return conflicts;
@@ -381,7 +388,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", percent,
numtargs, current);
/* CHECK 1: check every target against every target */
- _alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "searching for file conflicts: %s
",
alpm_pkg_get_name(p1));
for(j = i->next; j; j = j->next) {
p2 = j->data;
@@ -394,7 +401,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
if(tmpfiles) {
for(k = tmpfiles; k; k = k->next) {
snprintf(path, PATH_MAX, "%s%s", handle->root, (char *)k->data);
- conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_TARGET, path,
+ conflicts = add_fileconflict(handle, conflicts, PM_FILECONFLICT_TARGET, path,
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
if(!conflicts) {
FREELIST(conflicts);
@@ -411,7 +418,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
char *filestr = NULL;

/* CHECK 2: check every target against the filesystem */
- _alpm_log(PM_LOG_DEBUG, "searching for filesystem conflicts: %s
", p1->name);
+ _alpm_log(handle, PM_LOG_DEBUG, "searching for filesystem conflicts: %s
", p1->name);
dbpkg = _alpm_db_get_pkgfromcache(handle->db_local, p1->name);

/* Do two different checks here. If the package is currently installed,
@@ -439,15 +446,15 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,

if(path[strlen(path)-1] == '/') {
if(S_ISDIR(lsbuf.st_mode)) {
- _alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict
", path);
+ _alpm_log(handle, PM_LOG_DEBUG, "%s is a directory, not a conflict
", path);
continue;
} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
- _alpm_log(PM_LOG_DEBUG,
+ _alpm_log(handle, PM_LOG_DEBUG,
"%s is a symlink to a dir, hopefully not a conflict
", path);
continue;
}
}
- _alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s
", path);
+ _alpm_log(handle, PM_LOG_DEBUG, "checking possible conflict: %s
", path);

int resolved_conflict = 0; /* have we acted on this conflict? */

@@ -455,7 +462,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
for(k = remove; k && !resolved_conflict; k = k->next) {
pmpkg_t *rempkg = k->data;
if(rempkg && alpm_list_find_str(alpm_pkg_get_files(rempkg), filestr)) {
- _alpm_log(PM_LOG_DEBUG, "local file will be removed, not a conflict: %s
", filestr);
+ _alpm_log(handle, PM_LOG_DEBUG, "local file will be removed, not a conflict: %s
", filestr);
resolved_conflict = 1;
}
}
@@ -475,7 +482,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
* by its new owner (whether the file is in backup array or not */
handle->trans->skip_remove =
alpm_list_add(handle->trans->skip_remove, strdup(filestr));
- _alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s
", filestr);
+ _alpm_log(handle, PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s
", filestr);
resolved_conflict = 1;
}
}
@@ -485,7 +492,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
char *dir = malloc(strlen(filestr) + 2);
sprintf(dir, "%s/", filestr);
if(alpm_list_find_str(alpm_pkg_get_files(dbpkg),di r)) {
- _alpm_log(PM_LOG_DEBUG, "check if all files in %s belongs to %s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "check if all files in %s belongs to %s
",
dir, dbpkg->name);
resolved_conflict = dir_belongsto_pkg(handle->root, filestr, dbpkg);
}
@@ -506,8 +513,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
}

if(!resolved_conflict) {
- _alpm_log(PM_LOG_DEBUG, "file found in conflict: %s
", path);
- conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_FILESYSTEM,
+ conflicts = add_fileconflict(handle, conflicts, PM_FILECONFLICT_FILESYSTEM,
path, p1->name, NULL);
if(!conflicts) {
FREELIST(conflicts);
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 17dde95..b2f3762 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -64,7 +64,7 @@ void _alpm_db_unregister(pmdb_t *db)
return;
}

- _alpm_log(PM_LOG_DEBUG, "unregistering database '%s'
", db->treename);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "unregistering database '%s'
", db->treename);
_alpm_db_free(db);
}

@@ -128,18 +128,14 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db)
/** Get the serverlist of a database. */
alpm_list_t SYMEXPORT *alpm_db_get_servers(const pmdb_t *db)
{
- /* Sanity checks */
ASSERT(db != NULL, return NULL);
-
return(db->servers);
}

/** Set the serverlist of a database. */
int SYMEXPORT alpm_db_set_servers(pmdb_t *db, alpm_list_t *servers)
{
- /* Sanity checks */
ASSERT(db != NULL, return -1);
-
if(db->servers) FREELIST(db->servers);
db->servers = servers;
return 0;
@@ -176,7 +172,7 @@ int SYMEXPORT alpm_db_add_server(pmdb_t *db, const char *url)
return -1;
}
db->servers = alpm_list_add(db->servers, newurl);
- _alpm_log(PM_LOG_DEBUG, "adding new server URL to database '%s': %s
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "adding new server URL to database '%s': %s
",
db->treename, newurl);

return 0;
@@ -203,7 +199,7 @@ int SYMEXPORT alpm_db_remove_server(pmdb_t *db, const char *url)
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
free(newurl);
if(vdata) {
- _alpm_log(PM_LOG_DEBUG, "removed server URL from database '%s': %s
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "removed server URL from database '%s': %s
",
db->treename, newurl);
free(vdata);
return 0;
@@ -222,7 +218,7 @@ int SYMEXPORT alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify)
ASSERT(db != NULL, return -1);

db->pgp_verify = verify;
- _alpm_log(PM_LOG_DEBUG, "adding VerifySig option to database '%s': %d
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "adding VerifySig option to database '%s': %d
",
db->treename, verify);

return(0);
@@ -302,7 +298,7 @@ int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t
RET_ERR(db->handle, PM_ERR_PKG_NOT_FOUND, -1);
}

- _alpm_log(PM_LOG_DEBUG, "setting install reason %u for %s/%s
", reason, db->treename, name);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "setting install reason %u for %s/%s
", reason, db->treename, name);
if(alpm_pkg_get_reason(pkg) == reason) {
/* we are done */
return 0;
@@ -354,7 +350,7 @@ const char *_alpm_db_path(pmdb_t *db)

dbpath = alpm_option_get_dbpath(db->handle);
if(!dbpath) {
- _alpm_log(PM_LOG_ERROR, _("database path is undefined
"));
+ _alpm_log(db->handle, PM_LOG_ERROR, _("database path is undefined
"));
RET_ERR(db->handle, PM_ERR_DB_OPEN, NULL);
}

@@ -368,7 +364,7 @@ const char *_alpm_db_path(pmdb_t *db)
/* all sync DBs now reside in the sync/ subdir of the dbpath */
sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
}
- _alpm_log(PM_LOG_DEBUG, "database path for tree %s set to %s
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "database path for tree %s set to %s
",
db->treename, db->_path);
}
return db->_path;
@@ -405,7 +401,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
}
ret = NULL;
targ = i->data;
- _alpm_log(PM_LOG_DEBUG, "searching for target '%s'
", targ);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "searching for target '%s'
", targ);

if(regcomp(&reg, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
RET_ERR(db->handle, PM_ERR_INVALID_REGEX, NULL);
@@ -447,7 +443,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
}

if(matched != NULL) {
- _alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, " search target '%s' matched '%s'
",
targ, matched);
ret = alpm_list_add(ret, pkg);
}
@@ -473,10 +469,10 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
}
_alpm_db_free_pkgcache(db);

- _alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "loading package cache for repository '%s'
",
db->treename);
if(db->ops->populate(db) == -1) {
- _alpm_log(PM_LOG_DEBUG,
+ _alpm_log(db->handle, PM_LOG_DEBUG,
"failed to load package cache for repository '%s'
", db->treename);
return -1;
}
@@ -491,7 +487,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
return;
}

- _alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "freeing package cache for repository '%s'
",
db->treename);

alpm_list_free_inner(_alpm_db_get_pkgcache(db),
@@ -514,7 +510,7 @@ pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db)

/* hmmm, still NULL ?*/
if(!db->pkgcache) {
- _alpm_log(PM_LOG_DEBUG, "warning: pkgcache is NULL for db '%s'
", db->treename);
+ _alpm_log(db->handle, PM_LOG_DEBUG, "warning: pkgcache is NULL for db '%s'
", db->treename);
}

return db->pkgcache;
@@ -545,7 +541,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
return -1;
}

- _alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "adding entry '%s' in '%s' cache
",
alpm_pkg_get_name(newpkg), db->treename);
db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);

@@ -562,13 +558,13 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
return -1;
}

- _alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "removing entry '%s' from '%s' cache
",
alpm_pkg_get_name(pkg), db->treename);

db->pkgcache = _alpm_pkghash_remove(db->pkgcache, pkg, &data);
if(data == NULL) {
/* package not found */
- _alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found
",
alpm_pkg_get_name(pkg), db->treename);
return -1;
}
@@ -588,7 +584,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)

pmpkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db);
if(!pkgcache) {
- _alpm_log(PM_LOG_DEBUG, "warning: failed to get '%s' from NULL pkgcache
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "warning: failed to get '%s' from NULL pkgcache
",
target);
return NULL;
}
@@ -606,7 +602,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
return -1;
}

- _alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "loading group cache for repository '%s'
",
db->treename);

for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
@@ -656,7 +652,7 @@ void _alpm_db_free_grpcache(pmdb_t *db)
return;
}

- _alpm_log(PM_LOG_DEBUG, "freeing group cache for repository '%s'
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "freeing group cache for repository '%s'
",
db->treename);

for(lg = db->grpcache; lg; lg = lg->next) {
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index ad2be77..aa76b49 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -235,14 +235,14 @@ off_t _alpm_shortest_delta_path(pmhandle_t *handle, alpm_list_t *deltas,
return bestsize;
}

- _alpm_log(PM_LOG_DEBUG, "started delta shortest-path search for '%s'
", to);
+ _alpm_log(handle, PM_LOG_DEBUG, "started delta shortest-path search for '%s'
", to);

vertices = graph_init(deltas, 0);
graph_init_size(handle, vertices);
dijkstra(vertices);
bestsize = shortest_path(vertices, to, &bestpath);

- _alpm_log(PM_LOG_DEBUG, "delta shortest-path search complete : '%jd'
", (intmax_t)bestsize);
+ _alpm_log(handle, PM_LOG_DEBUG, "delta shortest-path search complete : '%jd'
", (intmax_t)bestsize);

alpm_list_free_inner(vertices, _alpm_graph_free);
alpm_list_free(vertices);
@@ -340,8 +340,6 @@ pmdelta_t *_alpm_delta_parse(char *line)
tmp2 = tmp;
STRDUP(delta->to, tmp2, return NULL);

- _alpm_log(PM_LOG_DEBUG, "delta : %s %s '%jd'
", delta->from, delta->to, (intmax_t)delta->delta_size);
-
return delta;
}

diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index bcec8c7..2877640 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -126,7 +126,8 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets)
* This function returns the new alpm_list_t* target list.
*
*/
-alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
+alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle,
+ alpm_list_t *targets, int reverse)
{
alpm_list_t *newtargs = NULL;
alpm_list_t *vertices = NULL;
@@ -137,7 +138,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
return NULL;
}

- _alpm_log(PM_LOG_DEBUG, "started sorting dependencies
");
+ _alpm_log(handle, PM_LOG_DEBUG, "started sorting dependencies
");

vertices = dep_graph_init(targets);

@@ -160,13 +161,13 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
pmpkg_t *childpkg = nextchild->data;
const char *message;

- _alpm_log(PM_LOG_WARNING, _("dependency cycle detected:
"));
+ _alpm_log(handle, PM_LOG_WARNING, _("dependency cycle detected:
"));
if(reverse) {
message =_("%s will be removed after its %s dependency
");
} else {
message =_("%s will be installed before its %s dependency
");
}
- _alpm_log(PM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
+ _alpm_log(handle, PM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
}
}
if(!found) {
@@ -185,7 +186,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
}
}

- _alpm_log(PM_LOG_DEBUG, "sorting dependencies finished
");
+ _alpm_log(handle, PM_LOG_DEBUG, "sorting dependencies finished
");

if(reverse) {
/* reverse the order */
@@ -288,7 +289,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
/* look for unsatisfied dependencies of the upgrade list */
for(i = upgrade; i; i = i->next) {
pmpkg_t *tp = i->data;
- _alpm_log(PM_LOG_DEBUG, "checkdeps: package %s-%s
",
+ _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: package %s-%s
",
alpm_pkg_get_name(tp), alpm_pkg_get_version(tp));

for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
@@ -301,7 +302,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
/* Unsatisfied dependency in the upgrade list */
pmdepmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
- _alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'
",
+ _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'
",
missdepstring, alpm_pkg_get_name(tp));
free(missdepstring);
miss = depmiss_new(alpm_pkg_get_name(tp), depend, NULL);
@@ -328,7 +329,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
!find_dep_satisfier(dblist, depend)) {
pmdepmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
- _alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'
",
+ _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'
",
missdepstring, alpm_pkg_get_name(lp));
free(missdepstring);
miss = depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg));
@@ -481,7 +482,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
if(!include_explicit) {
/* see if it was explicitly installed */
if(alpm_pkg_get_reason(pkg) == PM_PKG_REASON_EXPLICIT) {
- _alpm_log(PM_LOG_DEBUG, "excluding %s -- explicitly installed
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "excluding %s -- explicitly installed
",
alpm_pkg_get_name(pkg));
return 0;
}
@@ -529,7 +530,7 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
pmpkg_t *deppkg = j->data;
if(_alpm_dep_edge(pkg, deppkg)
&& can_remove_package(db, deppkg, targs, include_explicit)) {
- _alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets
",
+ _alpm_log(db->handle, PM_LOG_DEBUG, "adding '%s' to the targets
",
alpm_pkg_get_name(deppkg));
/* add it to the target list */
targs = alpm_list_add(targs, _alpm_pkg_dup(deppkg));
@@ -570,7 +571,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
NULL, NULL, &install);
} else {
- _alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
+ _alpm_log(handle, PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
}
if(!install) {
ignored = 1;
@@ -592,14 +593,14 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep,
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
pkg, NULL, NULL, &install);
} else {
- _alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
+ _alpm_log(handle, PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
}
if(!install) {
ignored = 1;
continue;
}
}
- _alpm_log(PM_LOG_DEBUG, "provider found (%s provides %s)
",
+ _alpm_log(handle, PM_LOG_DEBUG, "provider found (%s provides %s)
",
pkg->name, dep->name);
providers = alpm_list_add(providers, pkg);
/* keep looking for other providers in the all dbs */
@@ -706,7 +707,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
on that list */
*packages = alpm_list_add(*packages, pkg);

- _alpm_log(PM_LOG_DEBUG, "started resolving dependencies
");
+ _alpm_log(handle, PM_LOG_DEBUG, "started resolving dependencies
");
for(i = alpm_list_last(*packages); i; i = i->next) {
pmpkg_t *tpkg = i->data;
targ = alpm_list_add(NULL, tpkg);
@@ -732,7 +733,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
if(!spkg) {
handle->pm_errno = PM_ERR_UNSATISFIED_DEPS;
char *missdepstring = alpm_dep_compute_string(missdep);
- _alpm_log(PM_LOG_WARNING,
+ _alpm_log(handle, PM_LOG_WARNING,
_("cannot resolve "%s", a dependency of "%s"
"),
missdepstring, tpkg->name);
free(missdepstring);
@@ -741,7 +742,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
}
ret = -1;
} else {
- _alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)
",
+ _alpm_log(handle, PM_LOG_DEBUG, "pulling dependency %s (needed by %s)
",
alpm_pkg_get_name(spkg), alpm_pkg_get_name(tpkg));
*packages = alpm_list_add(*packages, spkg);
_alpm_depmiss_free(miss);
@@ -756,55 +757,43 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
} else {
alpm_list_free(packages_copy);
}
- _alpm_log(PM_LOG_DEBUG, "finished resolving dependencies
");
+ _alpm_log(handle, PM_LOG_DEBUG, "finished resolving dependencies
");
return ret;
}

const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
{
- /* Sanity checks */
ASSERT(miss != NULL, return NULL);
-
return miss->target;
}

const char SYMEXPORT *alpm_miss_get_causingpkg(const pmdepmissing_t *miss)
{
- /* Sanity checks */
ASSERT(miss != NULL, return NULL);
-
return miss->causingpkg;
}

pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
{
- /* Sanity checks */
ASSERT(miss != NULL, return NULL);
-
return miss->depend;
}

pmdepmod_t SYMEXPORT alpm_dep_get_mod(const pmdepend_t *dep)
{
- /* Sanity checks */
ASSERT(dep != NULL, return -1);
-
return dep->mod;
}

const char SYMEXPORT *alpm_dep_get_name(const pmdepend_t *dep)
{
- /* Sanity checks */
ASSERT(dep != NULL, return NULL);
-
return dep->name;
}

const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
{
- /* Sanity checks */
ASSERT(dep != NULL, return NULL);
-
return dep->version;
}

@@ -819,7 +808,6 @@ char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep)
char *str;
size_t len;

- /* Sanity checks */
ASSERT(dep != NULL, return NULL);

if(dep->name) {
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index 2d61653..97c0918 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -45,7 +45,7 @@ struct __pmdepmissing_t {
void _alpm_dep_free(pmdepend_t *dep);
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
void _alpm_depmiss_free(pmdepmissing_t *miss);
-alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
+alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle, alpm_list_t *targets, int reverse);
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index c24b65d..079e683 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -77,11 +77,11 @@ static alpm_list_t *mount_point_list(pmhandle_t *handle)

whi
 

Thread Tools




All times are GMT. The time now is 11:56 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org