summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-12-01 10:32:29 +0100
committerAaron Griffin <aaron@archlinux.org>2006-12-01 10:32:29 +0100
commit08dca1593f82dfa4b5f1199b5b1f4d7099719be9 (patch)
treeb1b383f93524ebfcb5bfcc98924668f29dc88ba3
parent6c68723905ba1d8cee83e4af88b0ac8ee9a408aa (diff)
downloadpacman-08dca1593f82dfa4b5f1199b5b1f4d7099719be9.tar.gz
pacman-08dca1593f82dfa4b5f1199b5b1f4d7099719be9.tar.xz
* Cosmetic changes and typo fixes
* IgnorePkg and --ignore work again * Partial changes to support removal of conflicts for -U and -A (INCOMPLETE)
-rw-r--r--lib/libalpm/add.c20
-rw-r--r--lib/libalpm/alpm.c9
-rw-r--r--lib/libalpm/be_files.c2
-rw-r--r--lib/libalpm/db.c2
-rw-r--r--lib/libalpm/deps.c5
-rw-r--r--lib/libalpm/error.h2
-rw-r--r--lib/libalpm/remove.c3
-rw-r--r--lib/libalpm/sync.c9
-rw-r--r--src/pacman/pacman.c1
-rw-r--r--src/pacman/sync.c8
10 files changed, 44 insertions, 17 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 2c33947b..957cd69b 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -206,9 +206,15 @@ error:
return(-1);
}
+
+static int name_cmp(const void *p1, const void *p2)
+{
+ return(strcmp(((pmpkg_t *)p1)->name, (const char *)p2));
+}
+
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
{
- pmlist_t *lp;
+ pmlist_t *lp = NULL, *i = NULL;
pmlist_t *rmlist = NULL;
char rm_fname[PATH_MAX];
pmpkg_t *info = NULL;
@@ -236,6 +242,18 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
/* no unsatisfied deps, so look for conflicts */
_alpm_log(PM_LOG_FLOW1, _("looking for conflicts"));
lp = _alpm_checkconflicts(db, trans->packages);
+ for(i = lp; i; i = i->next) {
+ int skip_this = 0;
+ pmdepmissing_t *miss = i->data;
+
+ /* Attempt to resolve conflicts */
+ QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &skip_this);
+ if(skip_this) {
+ pmpkg_t *pkg = NULL;
+ lp = _alpm_list_remove(lp, miss->depend.name, name_cmp, (void **)&pkg);
+ FREEPKG(pkg);
+ }
+ }
if(lp != NULL) {
if(data) {
*data = lp;
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 1bda976c..a7fb0a99 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -261,8 +261,13 @@ int alpm_db_update(int force, pmdb_t *db)
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- /* Do not update a database if a transaction is on-going */
- ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
+ /* Verify we are in a transaction. This is done _mainly_ because we need a DB
+ * lock - if we update without a db lock, we may kludge some other pacman
+ * process that _has_ a lock.
+ */
+ ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
+ ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
+ ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
if(!_alpm_list_is_in(db, handle->dbs_sync)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index ccd0b246..24adabb4 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -180,7 +180,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
FILE *fp = NULL;
struct stat buf;
char path[PATH_MAX+1];
- char line[513];
+ char line[513] = {0};
pmlist_t *tmplist;
char *locale;
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index c3e071b0..6cb6fe8f 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -184,7 +184,7 @@ pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback)
for(i = handle->dbs_sync; i; i = i->next) {
pmdb_t *sdb = i->data;
if(strcmp(treename, sdb->treename) == 0) {
- _alpm_log(PM_LOG_DEBUG, _("attempt to re-register the '%s' databse, using existing"), sdb->treename);
+ _alpm_log(PM_LOG_DEBUG, _("attempt to re-register the '%s' database, using existing"), sdb->treename);
return sdb;
}
}
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 97c527ab..7b870085 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -332,7 +332,8 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
found=0;
for(j = tp->requiredby; j; j = j->next) {
- if(!_alpm_list_is_strin((char *)j->data, packages)) {
+ char *reqname = j->data;
+ if(!_alpm_list_is_strin(reqname, packages)) {
/* check if a package in trans->packages provides this package */
for(k=trans->packages; !found && k; k=k->next) {
pmpkg_t *spkg = NULL;
@@ -347,7 +348,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
}
}
if(!found) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), (char *)j->data, tp->name);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), reqname, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = _alpm_list_add(baddeps, miss);
diff --git a/lib/libalpm/error.h b/lib/libalpm/error.h
index 5f53712a..6294f05b 100644
--- a/lib/libalpm/error.h
+++ b/lib/libalpm/error.h
@@ -22,7 +22,7 @@
#define _ALPM_ERROR_H
#define RET_ERR(err, ret) do { pm_errno = (err); \
- _alpm_log(PM_LOG_DEBUG, _("returning error %d: %s\n"), err, alpm_strerror(err)); \
+ _alpm_log(PM_LOG_DEBUG, _("returning error %d from %s : %s\n"), err, __func__, alpm_strerror(err)); \
return(ret); } while(0)
#endif /* _ALPM_ERROR_H */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 6fce2d35..84c5da2f 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -71,7 +71,8 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
if((info = _alpm_db_scan(db, name, INFRQ_ALL)) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not find %s in database"), name);
+ /* Unimportant - just ignore it if we can't find it */
+ _alpm_log(PM_LOG_DEBUG, _("could not find %s in database"), name);
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 470216cb..a2645a38 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -220,7 +220,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync
local->name, local->version, db->treename, spkg->version);
} else if(cmp == 0) {
/* versions are identical */
- } else if(_alpm_list_is_strin(i->data, handle->ignorepkg)) {
+ } else if(_alpm_list_is_strin(spkg->name, handle->ignorepkg)) {
/* package should be ignored (IgnorePkg) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
local->name, local->version, spkg->version);
@@ -367,10 +367,11 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync,
/* Helper functions for _alpm_list_remove
*/
+/* removed - use pkg_cmp all of the time
static int ptr_cmp(const void *s1, const void *s2)
{
return(strcmp(((pmsyncpkg_t *)s1)->pkg->name, ((pmsyncpkg_t *)s2)->pkg->name));
-}
+}*/
static int pkg_cmp(const void *p1, const void *p2)
{
@@ -562,7 +563,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
void *vpkg;
_alpm_log(PM_LOG_FLOW2, _("removing '%s' from target list"), rmpkg);
- trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, &vpkg);
+ trans->packages = _alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
FREESYNC(vpkg);
continue;
}
@@ -599,7 +600,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
/* remove it from the target list */
void *vpkg;
_alpm_log(PM_LOG_FLOW2, _("removing '%s' from target list"), miss->depend.name);
- trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, &vpkg);
+ trans->packages = _alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
FREESYNC(vpkg);
}
} else {
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 05738c33..42cd2f85 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -146,6 +146,7 @@ static void usage(int op, char *myname)
printf(_(" -e, --dependsonly install dependencies only\n"));
printf(_(" -f, --force force install, overwrite conflicting files\n"));
printf(_(" -g, --groups view all members of a package group\n"));
+ printf(_(" -i, --info view package information\n"));
printf(_(" -p, --print-uris print out URIs for given packages and their dependencies\n"));
printf(_(" -s, --search search remote repositories for matching strings\n"));
printf(_(" -u, --sysupgrade upgrade all packages that are out of date\n"));
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 29a8b6c6..1e9bbd89 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -361,7 +361,7 @@ int pacman_sync(list_t *targets)
int confirm = 0;
int retval = 0;
list_t *i = NULL;
- pmlist_t *packages, *data, *lp;
+ pmlist_t *packages = NULL, *data = NULL, *lp = NULL;
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
ERR(NL, _("no usable package repositories configured.\n"));
@@ -449,7 +449,7 @@ int pacman_sync(list_t *targets)
return(1);
}
if(alpm_trans_addtarget("pacman") == -1) {
- ERR(NL, _("could not add target '%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
+ ERR(NL, _("'%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -470,7 +470,7 @@ int pacman_sync(list_t *targets)
continue;
}
if(pm_errno != PM_ERR_PKG_NOT_FOUND) {
- ERR(NL, _("could not add target '%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
+ ERR(NL, _("'%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
goto cleanup;
}
@@ -518,7 +518,7 @@ int pacman_sync(list_t *targets)
/* targ is provided by pname */
targets = list_add(targets, strdup(pname));
} else {
- ERR(NL, _("could not add target '%s': not found in sync db\n"), targ);
+ ERR(NL, _("'%s': not found in sync db\n"), targ);
retval = 1;
goto cleanup;
}