Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=4a0172af84b2c3ea501add9f9c07df654815f891

commit 4a0172af84b2c3ea501add9f9c07df654815f891
Author: Michel Hermier <[email protected]>
Date:   Fri Apr 26 13:39:03 2013 +0200

libpacman: Remove spurus obvious db parameters.

diff --git a/lib/libpacman/conflict.c b/lib/libpacman/conflict.c
index 13b6501..104ca37 100644
--- a/lib/libpacman/conflict.c
+++ b/lib/libpacman/conflict.c
@@ -48,7 +48,7 @@
*
* conflicts are always name only
*/
-pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmdb_t *db, pmlist_t 
*packages)
+pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmlist_t *packages)
{
pmpkg_t *info = NULL;
pmlist_t *i, *j, *k;
@@ -57,10 +57,6 @@ pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmdb_t 
*db, pmlist_t *package
int howmany, remain;
double percent;

-       if(db == NULL) {
-               return(NULL);
-       }
-
howmany = _pacman_list_count(packages);

for(i = packages; i; i = i->next) {
@@ -84,7 +80,7 @@ pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmdb_t 
*db, pmlist_t *package
}
/* CHECK 1: check targets against database */
_pacman_log(PM_LOG_DEBUG, _("checkconflicts: targ '%s' vs db"), tp->name);
-                       for(k = _pacman_db_get_pkgcache(db); k; k = k->next) {
+                       for(k = 
_pacman_db_get_pkgcache(trans->handle->db_local); k; k = k->next) {
pmpkg_t *dp = (pmpkg_t *)k->data;
if(!strcmp(dp->name, tp->name)) {
/* a package cannot conflict with itself -- that's just not nice */
@@ -156,7 +152,7 @@ pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmdb_t 
*db, pmlist_t *package
}
/* CHECK 3: check database against targets */
_pacman_log(PM_LOG_DEBUG, _("checkconflicts: db vs targ '%s'"), tp->name);
-               for(k = _pacman_db_get_pkgcache(db); k; k = k->next) {
+               for(k = _pacman_db_get_pkgcache(trans->handle->db_local); k; k 
= k->next) {
pmlist_t *conflicts = NULL;
int usenewconflicts = 0;

@@ -253,7 +249,7 @@ static pmlist_t *chk_fileconflicts(pmlist_t *filesA, 
pmlist_t *filesB)
return(ret);
}

-pmlist_t *_pacman_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, 
pmlist_t **skip_list)
+pmlist_t *_pacman_db_find_conflicts(pmtrans_t *trans, pmlist_t **skip_list)
{
pmlist_t *i, *j, *k;
char *filestr = NULL;
@@ -264,8 +260,9 @@ pmlist_t *_pacman_db_find_conflicts(pmdb_t *db, pmtrans_t 
*trans, char *root, pm
pmpkg_t *p, *dbpkg;
double percent;
int howmany, remain;
+       pmdb_t *db = trans->handle->db_local;

-       if(db == NULL || targets == NULL || root == NULL) {
+       if(db == NULL || targets == NULL) {
return(NULL);
}
howmany = _pacman_list_count(targets);
@@ -300,7 +297,7 @@ pmlist_t *_pacman_db_find_conflicts(pmdb_t *db, pmtrans_t 
*trans, char *root, pm
dbpkg = NULL;
for(j = p->files; j; j = j->next) {
filestr = (char*)j->data;
-                       snprintf(path, PATH_MAX, "%s%s", root, filestr);
+                       snprintf(path, PATH_MAX, "%s%s", trans->handle->root, 
filestr);
/* is this target a file or directory? */
if(path[strlen(path)-1] == '/') {
path[strlen(path)-1] = '\0';
diff --git a/lib/libpacman/conflict.h b/lib/libpacman/conflict.h
index 1cdc1d9..324b08f 100644
--- a/lib/libpacman/conflict.h
+++ b/lib/libpacman/conflict.h
@@ -33,8 +33,8 @@ typedef struct __pmconflict_t {
char ctarget[PKG_NAME_LEN];
} pmconflict_t;

-pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmdb_t *db, pmlist_t 
*packages);
-pmlist_t *_pacman_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, 
pmlist_t **skip_list);
+pmlist_t *_pacman_checkconflicts(pmtrans_t *trans, pmlist_t *packages);
+pmlist_t *_pacman_db_find_conflicts(pmtrans_t *trans, pmlist_t **skip_list);

#endif /* _PACMAN_CONFLICT_H */

diff --git a/lib/libpacman/sync.c b/lib/libpacman/sync.c
index 3f79de7..a38a373 100644
--- a/lib/libpacman/sync.c
+++ b/lib/libpacman/sync.c
@@ -190,7 +190,7 @@ int _pacman_sync_prepare(pmtrans_t *trans, pmlist_t **data)
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);

_pacman_log(PM_LOG_FLOW1, _("looking for conflicts"));
-               deps = _pacman_checkconflicts(trans, db_local, list);
+               deps = _pacman_checkconflicts(trans, list);
if(deps) {
int errorout = 0;

diff --git a/lib/libpacman/trans.c b/lib/libpacman/trans.c
index 862338b..fed1ab6 100644
--- a/lib/libpacman/trans.c
+++ b/lib/libpacman/trans.c
@@ -32,6 +32,7 @@
/* pacman-g2 */
#include "trans.h"

+#include "conflict.h"
#include "deps.h"
#include "error.h"
#include "package.h"
@@ -556,7 +557,7 @@ int _pacman_trans_prepare(pmtrans_t *trans, pmlist_t **data)

/* no unsatisfied deps, so look for conflicts */
_pacman_log(PM_LOG_FLOW1, _("looking for conflicts"));
-                       lp = _pacman_checkconflicts(trans, db_local, 
trans->_packages);
+                       lp = _pacman_checkconflicts(trans, trans->_packages);
if(lp != NULL) {
if(data) {
*data = lp;
@@ -594,7 +595,7 @@ int _pacman_trans_prepare(pmtrans_t *trans, pmlist_t **data)
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);

_pacman_log(PM_LOG_FLOW1, _("looking for file conflicts"));
-                       lp = _pacman_db_find_conflicts(db_local, trans, 
handle->root, &skiplist);
+                       lp = _pacman_db_find_conflicts(trans, &skiplist);
if(lp != NULL) {
if(data) {
*data = lp;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to