* Cosmetic changes and typo fixes

* IgnorePkg and --ignore work again
* Partial changes to support removal of conflicts for -U and -A (INCOMPLETE)
This commit is contained in:
Aaron Griffin 2006-12-01 09:32:29 +00:00
parent 6c68723905
commit 08dca1593f
10 changed files with 44 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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 */

View File

@ -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);
}

View File

@ -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 {

View File

@ -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"));

View File

@ -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;
}