* Re-added a compare function for syncpkg's - it was removed without thinking
properly * Error when re-reading the DB for replacements, wrong info level * Removed an duplicate debug message "checking for package replacements" * Check ignorepkg for REAL upgrades... * Properly check the NOSAVE flag * some unlink_file (remove.c) cleanup * fix indent level on handle.c * Force libalpm paths to end with a '/' char * Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t) * Added some debug output to cache and db scanning ** All pactest tests succeed again, yay **
This commit is contained in:
parent
1334f5c56c
commit
436f36c76b
9 changed files with 114 additions and 62 deletions
|
@ -35,8 +35,8 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PM_ROOT "/"
|
#define PM_ROOT "/"
|
||||||
#define PM_DBPATH "var/lib/pacman"
|
#define PM_DBPATH "var/lib/pacman/"
|
||||||
#define PM_CACHEDIR "var/cache/pacman/pkg"
|
#define PM_CACHEDIR "var/cache/pacman/pkg/"
|
||||||
#define PM_LOCK "tmp/pacman.lck"
|
#define PM_LOCK "tmp/pacman.lck"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ int _alpm_db_open(pmdb_t *db)
|
||||||
RET_ERR(PM_ERR_DB_NULL, -1);
|
RET_ERR(PM_ERR_DB_NULL, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("opening database from path '%s'"), db->path);
|
||||||
db->handle = opendir(db->path);
|
db->handle = opendir(db->path);
|
||||||
if(db->handle == NULL) {
|
if(db->handle == NULL) {
|
||||||
RET_ERR(PM_ERR_DB_OPEN, -1);
|
RET_ERR(PM_ERR_DB_OPEN, -1);
|
||||||
|
@ -154,8 +155,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
|
||||||
if(!found) {
|
if(!found) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else { /* target == NULL, full scan */
|
||||||
/* normal iteration */
|
|
||||||
int isdir = 0;
|
int isdir = 0;
|
||||||
while(!isdir) {
|
while(!isdir) {
|
||||||
ent = readdir(db->handle);
|
ent = readdir(db->handle);
|
||||||
|
@ -176,6 +176,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
|
||||||
|
|
||||||
pkg = _alpm_pkg_new(NULL, NULL);
|
pkg = _alpm_pkg_new(NULL, NULL);
|
||||||
if(pkg == NULL) {
|
if(pkg == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("db scan could not find package: %s"), target);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
if(_alpm_pkg_splitname(ent->d_name, pkg->name, pkg->version, 0) == -1) {
|
if(_alpm_pkg_splitname(ent->d_name, pkg->name, pkg->version, 0) == -1) {
|
||||||
|
@ -188,6 +189,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("db scan found package: %s"), pkg->name);
|
||||||
return(pkg);
|
return(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
|
||||||
|
|
||||||
_alpm_db_rewind(db);
|
_alpm_db_rewind(db);
|
||||||
while((info = _alpm_db_scan(db, NULL, infolevel)) != NULL) {
|
while((info = _alpm_db_scan(db, NULL, infolevel)) != NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("adding '%s' to package cache for db '%s'"), info->name, db->treename);
|
||||||
info->origin = PKG_FROM_CACHE;
|
info->origin = PKG_FROM_CACHE;
|
||||||
info->data = db;
|
info->data = db;
|
||||||
/* add to the collection */
|
/* add to the collection */
|
||||||
|
@ -104,6 +105,9 @@ alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
|
||||||
|
|
||||||
_alpm_db_ensure_pkgcache(db, infolevel);
|
_alpm_db_ensure_pkgcache(db, infolevel);
|
||||||
|
|
||||||
|
if(!db->pkgcache) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("error: pkgcache is NULL for db %s"), db->treename);
|
||||||
|
}
|
||||||
return(db->pkgcache);
|
return(db->pkgcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -379,9 +379,16 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||||
|
|
||||||
/* stat the file - if it exists and is not a dir, do some checks */
|
/* stat the file - if it exists and is not a dir, do some checks */
|
||||||
if(lstat(path, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
if(lstat(path, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
|
||||||
|
|
||||||
/* Look at all the targets to see if file has changed hands */
|
/* Look at all the targets to see if file has changed hands */
|
||||||
for(k = targets; k; k = k->next) {
|
for(k = targets; k; k = k->next) {
|
||||||
p2 = (pmpkg_t *)k->data;
|
pmsyncpkg_t *sync = k->data;
|
||||||
|
if(!sync) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
p2 = sync->pkg;
|
||||||
|
|
||||||
/* Ensure we aren't looking at current package */
|
/* Ensure we aren't looking at current package */
|
||||||
if(p2 == p1) {
|
if(p2 == p1) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -404,6 +411,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||||
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s", filestr);
|
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s", filestr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s", filestr);
|
||||||
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
|
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
|
||||||
filestr, p1->name, NULL);
|
filestr, p1->name, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -71,7 +71,7 @@ pmdb_t *_alpm_db_new(char *root, char* dbpath, char *treename)
|
||||||
FREE(db);
|
FREE(db);
|
||||||
RET_ERR(PM_ERR_MEMORY, NULL);
|
RET_ERR(PM_ERR_MEMORY, NULL);
|
||||||
}
|
}
|
||||||
sprintf(db->path, "%s%s/%s", root, dbpath, treename);
|
sprintf(db->path, "%s%s%s", root, dbpath, treename);
|
||||||
|
|
||||||
STRNCPY(db->treename, treename, PATH_MAX);
|
STRNCPY(db->treename, treename, PATH_MAX);
|
||||||
|
|
||||||
|
|
|
@ -66,28 +66,29 @@ pmhandle_t *_alpm_handle_new()
|
||||||
/* see if we're root or not (fakeroot does not count) */
|
/* see if we're root or not (fakeroot does not count) */
|
||||||
#ifndef FAKEROOT
|
#ifndef FAKEROOT
|
||||||
if(handle->uid == 0 && !getenv("FAKEROOTKEY")) {
|
if(handle->uid == 0 && !getenv("FAKEROOTKEY")) {
|
||||||
|
/* } make vim indent work - stupid ifdef's */
|
||||||
#else
|
#else
|
||||||
if(handle->uid == 0) {
|
if(handle->uid == 0) {
|
||||||
#endif
|
#endif
|
||||||
handle->access = PM_ACCESS_RW;
|
handle->access = PM_ACCESS_RW;
|
||||||
} else {
|
} else {
|
||||||
handle->access = PM_ACCESS_RO;
|
handle->access = PM_ACCESS_RO;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
handle->access = PM_ACCESS_RW;
|
handle->access = PM_ACCESS_RW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
handle->root = strdup(PM_ROOT);
|
handle->root = strdup(PM_ROOT);
|
||||||
handle->dbpath = strdup(PM_DBPATH);
|
handle->dbpath = strdup(PM_DBPATH);
|
||||||
handle->cachedir = strdup(PM_CACHEDIR);
|
handle->cachedir = strdup(PM_CACHEDIR);
|
||||||
handle->logmask = PM_LOG_ERROR | PM_LOG_WARNING;
|
handle->logmask = PM_LOG_ERROR | PM_LOG_WARNING;
|
||||||
|
|
||||||
return(handle);
|
return(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_handle_free(pmhandle_t *handle)
|
int _alpm_handle_free(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ unsigned short alpm_option_get_usecolor() { return handle->use_color; }
|
||||||
pmdb_t *alpm_option_get_localdb() { return handle->db_local; }
|
pmdb_t *alpm_option_get_localdb() { return handle->db_local; }
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs()
|
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs()
|
||||||
{
|
{
|
||||||
return handle->dbs_sync;
|
return handle->dbs_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_logcb(alpm_cb_log cb) { handle->logcb = cb; }
|
void SYMEXPORT alpm_option_set_logcb(alpm_cb_log cb) { handle->logcb = cb; }
|
||||||
|
@ -151,24 +152,54 @@ void SYMEXPORT alpm_option_set_logmask(unsigned short mask) { handle->logmask =
|
||||||
void alpm_option_set_root(const char *root)
|
void alpm_option_set_root(const char *root)
|
||||||
{
|
{
|
||||||
if(handle->root) FREE(handle->root);
|
if(handle->root) FREE(handle->root);
|
||||||
if(root) handle->root = strdup(root);
|
if(root) {
|
||||||
|
/* verify root ends in a '/' */
|
||||||
|
int rootlen = strlen(root);
|
||||||
|
if(root[rootlen-1] != '/') {
|
||||||
|
rootlen += 1;
|
||||||
|
}
|
||||||
|
handle->root = calloc(rootlen+1, sizeof(char));
|
||||||
|
strncpy(handle->root, root, rootlen);
|
||||||
|
handle->root[rootlen-1] = '/';
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("option 'root' = %s"), handle->root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
|
void SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
|
||||||
{
|
{
|
||||||
if(handle->dbpath) FREE(handle->dbpath);
|
if(handle->dbpath) FREE(handle->dbpath);
|
||||||
if(dbpath) handle->dbpath = strdup(dbpath);
|
if(dbpath) {
|
||||||
|
/* verify dbpath ends in a '/' */
|
||||||
|
int dbpathlen = strlen(dbpath);
|
||||||
|
if(dbpath[dbpathlen-1] != '/') {
|
||||||
|
dbpathlen += 1;
|
||||||
|
}
|
||||||
|
handle->dbpath = calloc(dbpathlen+1, sizeof(char));
|
||||||
|
strncpy(handle->dbpath, dbpath, dbpathlen);
|
||||||
|
handle->dbpath[dbpathlen-1] = '/';
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("option 'dbpath' = %s"), handle->dbpath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void alpm_option_set_cachedir(const char *cachedir)
|
void alpm_option_set_cachedir(const char *cachedir)
|
||||||
{
|
{
|
||||||
if(handle->cachedir) FREE(handle->cachedir);
|
if(handle->cachedir) FREE(handle->cachedir);
|
||||||
if(cachedir) handle->cachedir = strdup(cachedir);
|
if(cachedir) {
|
||||||
|
/* verify cachedir ends in a '/' */
|
||||||
|
int cachedirlen = strlen(cachedir);
|
||||||
|
if(cachedir[cachedirlen-1] != '/') {
|
||||||
|
cachedirlen += 1;
|
||||||
|
}
|
||||||
|
handle->cachedir = calloc(cachedirlen+1, sizeof(char));
|
||||||
|
strncpy(handle->cachedir, cachedir, cachedirlen);
|
||||||
|
handle->cachedir[cachedirlen-1] = '/';
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("option 'cachedir' = %s"), handle->cachedir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void alpm_option_set_logfile(const char *logfile)
|
void alpm_option_set_logfile(const char *logfile)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(handle->logfile) {
|
if(handle->logfile) {
|
||||||
FREE(handle->logfile);
|
FREE(handle->logfile);
|
||||||
|
@ -185,12 +216,12 @@ void alpm_option_set_logfile(const char *logfile)
|
||||||
|
|
||||||
void alpm_option_set_usesyslog(unsigned short usesyslog)
|
void alpm_option_set_usesyslog(unsigned short usesyslog)
|
||||||
{
|
{
|
||||||
handle->usesyslog = usesyslog;
|
handle->usesyslog = usesyslog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alpm_option_add_noupgrade(char *pkg)
|
void alpm_option_add_noupgrade(char *pkg)
|
||||||
{
|
{
|
||||||
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
|
void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
|
||||||
|
@ -201,7 +232,7 @@ void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
|
||||||
|
|
||||||
void alpm_option_add_noextract(char *pkg)
|
void alpm_option_add_noextract(char *pkg)
|
||||||
{
|
{
|
||||||
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
||||||
}
|
}
|
||||||
void alpm_option_set_noextracts(alpm_list_t *noextract)
|
void alpm_option_set_noextracts(alpm_list_t *noextract)
|
||||||
{
|
{
|
||||||
|
@ -211,7 +242,7 @@ void alpm_option_set_noextracts(alpm_list_t *noextract)
|
||||||
|
|
||||||
void SYMEXPORT alpm_option_add_ignorepkg(char *pkg)
|
void SYMEXPORT alpm_option_add_ignorepkg(char *pkg)
|
||||||
{
|
{
|
||||||
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
||||||
}
|
}
|
||||||
void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
|
void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +252,7 @@ void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
|
||||||
|
|
||||||
void alpm_option_add_holdpkg(char *pkg)
|
void alpm_option_add_holdpkg(char *pkg)
|
||||||
{
|
{
|
||||||
handle->holdpkg = alpm_list_add(handle->holdpkg, strdup(pkg));
|
handle->holdpkg = alpm_list_add(handle->holdpkg, strdup(pkg));
|
||||||
}
|
}
|
||||||
void alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
|
void alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +262,7 @@ void alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
|
||||||
|
|
||||||
void alpm_option_set_upgradedelay(time_t delay)
|
void alpm_option_set_upgradedelay(time_t delay)
|
||||||
{
|
{
|
||||||
handle->upgradedelay = delay;
|
handle->upgradedelay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alpm_option_set_xfercommand(const char *cmd)
|
void alpm_option_set_xfercommand(const char *cmd)
|
||||||
|
@ -242,14 +273,14 @@ void alpm_option_set_xfercommand(const char *cmd)
|
||||||
|
|
||||||
void alpm_option_set_nopassiveftp(unsigned short nopasv)
|
void alpm_option_set_nopassiveftp(unsigned short nopasv)
|
||||||
{
|
{
|
||||||
handle->nopassiveftp = nopasv;
|
handle->nopassiveftp = nopasv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alpm_option_set_chomp(unsigned short chomp) { handle->chomp = chomp; }
|
void alpm_option_set_chomp(unsigned short chomp) { handle->chomp = chomp; }
|
||||||
|
|
||||||
void alpm_option_set_usecolor(unsigned short usecolor)
|
void alpm_option_set_usecolor(unsigned short usecolor)
|
||||||
{
|
{
|
||||||
handle->use_color = usecolor;
|
handle->use_color = usecolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 et: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|
|
@ -69,7 +69,7 @@ extern pmhandle_t *handle;
|
||||||
|
|
||||||
#define FREEHANDLE(p) do { if (p) { _alpm_handle_free(p); p = NULL; } } while (0)
|
#define FREEHANDLE(p) do { if (p) { _alpm_handle_free(p); p = NULL; } } while (0)
|
||||||
|
|
||||||
pmhandle_t *_alpm_handle_new(void);
|
pmhandle_t *_alpm_handle_new();
|
||||||
int _alpm_handle_free(pmhandle_t *handle);
|
int _alpm_handle_free(pmhandle_t *handle);
|
||||||
|
|
||||||
#endif /* _ALPM_HANDLE_H */
|
#endif /* _ALPM_HANDLE_H */
|
||||||
|
|
|
@ -206,10 +206,11 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
|
||||||
FREE(hash);
|
FREE(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!needbackup && trans->type == PM_TRANS_TYPE_UPGRADE) {
|
if(trans->type == PM_TRANS_TYPE_UPGRADE) {
|
||||||
/* check noupgrade */
|
/* check noupgrade */
|
||||||
if(alpm_list_find_str(handle->noupgrade, lp->data)) {
|
if(alpm_list_find_str(handle->noupgrade, lp->data)) {
|
||||||
needbackup = 1;
|
_alpm_log(PM_LOG_DEBUG, _("Skipping removal of '%s' due to NoUpgrade"), file);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,28 +233,31 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
|
||||||
* explanation. */
|
* explanation. */
|
||||||
if(alpm_list_find_str(trans->skip_remove, file)) {
|
if(alpm_list_find_str(trans->skip_remove, file)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, _("%s is in trans->skip_remove, skipping removal"), file);
|
_alpm_log(PM_LOG_DEBUG, _("%s is in trans->skip_remove, skipping removal"), file);
|
||||||
|
return;
|
||||||
} else if(needbackup) {
|
} else if(needbackup) {
|
||||||
/* if the file is flagged, back it up to .pacsave */
|
/* if the file is flagged, back it up to .pacsave */
|
||||||
if(!(trans->type == PM_TRANS_TYPE_UPGRADE)) {
|
if(!(trans->type == PM_TRANS_TYPE_UPGRADE)) {
|
||||||
/* if it was an upgrade, the file would be left alone because
|
/* if it was an upgrade, the file would be left alone because
|
||||||
* pacman_add() would handle it */
|
* pacman_add() would handle it */
|
||||||
if(!(trans->type & PM_TRANS_FLAG_NOSAVE)) {
|
if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) {
|
||||||
char newpath[PATH_MAX];
|
char newpath[PATH_MAX];
|
||||||
snprintf(newpath, PATH_MAX, "%s.pacsave", file);
|
snprintf(newpath, PATH_MAX, "%s.pacsave", file);
|
||||||
rename(file, newpath);
|
rename(file, newpath);
|
||||||
_alpm_log(PM_LOG_WARNING, _("%s saved as %s"), file, newpath);
|
_alpm_log(PM_LOG_WARNING, _("%s saved as %s"), file, newpath);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("transaction is set to NOSAVE, not backing up '%s'"), file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, _("unlinking %s"), file);
|
_alpm_log(PM_LOG_DEBUG, _("unlinking %s"), file);
|
||||||
int list_count = alpm_list_count(trans->packages); /* this way we don't have to call alpm_list_count twice during PROGRESS */
|
int list_count = alpm_list_count(trans->packages); /* this way we don't have to call alpm_list_count twice during PROGRESS */
|
||||||
|
|
||||||
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - alpm_list_count(targ) + 1));
|
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - alpm_list_count(targ) + 1));
|
||||||
++(*position);
|
++(*position);
|
||||||
|
|
||||||
if(unlink(file) == -1) {
|
if(unlink(file) == -1) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), lp->data, strerror(errno));
|
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), lp->data, strerror(errno));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
|
||||||
/* check for "recommended" package replacements */
|
/* check for "recommended" package replacements */
|
||||||
_alpm_log(PM_LOG_DEBUG, _("checking for package replacements"));
|
_alpm_log(PM_LOG_DEBUG, _("checking for package replacements"));
|
||||||
for(i = dbs_sync; i; i = i->next) {
|
for(i = dbs_sync; i; i = i->next) {
|
||||||
for(j = _alpm_db_get_pkgcache(i->data, INFRQ_DESC); j; j = j->next) {
|
for(j = _alpm_db_get_pkgcache(i->data, INFRQ_DEPENDS); j; j = j->next) {
|
||||||
pmpkg_t *spkg = j->data;
|
pmpkg_t *spkg = j->data;
|
||||||
for(k = spkg->replaces; k; k = k->next) {
|
for(k = spkg->replaces; k; k = k->next) {
|
||||||
alpm_list_t *m;
|
alpm_list_t *m;
|
||||||
|
@ -194,7 +194,6 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
/* check for "recommended" package replacements */
|
/* check for "recommended" package replacements */
|
||||||
_alpm_log(PM_LOG_DEBUG, _("checking for package replacements"));
|
|
||||||
if( find_replacements(trans, db_local, dbs_sync) == 0 ) {
|
if( find_replacements(trans, db_local, dbs_sync) == 0 ) {
|
||||||
/* match installed packages with the sync dbs and compare versions */
|
/* match installed packages with the sync dbs and compare versions */
|
||||||
_alpm_log(PM_LOG_DEBUG, _("checking for package upgrades"));
|
_alpm_log(PM_LOG_DEBUG, _("checking for package upgrades"));
|
||||||
|
@ -229,19 +228,24 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
|
||||||
|
|
||||||
/* compare versions and see if we need to upgrade */
|
/* compare versions and see if we need to upgrade */
|
||||||
if(alpm_pkg_compare_versions(local, spkg)) {
|
if(alpm_pkg_compare_versions(local, spkg)) {
|
||||||
_alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
|
if(alpm_list_find_str(handle->ignorepkg, local->name)) {
|
||||||
local->name, local->version, local->version, spkg->version);
|
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s => %s)"),
|
||||||
if(!find_pkginsync(spkg->name, trans->packages)) {
|
local->name, local->version, local->version, spkg->version);
|
||||||
pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
|
} else {
|
||||||
if(dummy == NULL) {
|
_alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
|
||||||
goto error;
|
local->name, local->version, local->version, spkg->version);
|
||||||
|
if(!find_pkginsync(spkg->name, trans->packages)) {
|
||||||
|
pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
|
||||||
|
if(dummy == NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
|
||||||
|
if(sync == NULL) {
|
||||||
|
FREEPKG(dummy);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
trans->packages = alpm_list_add(trans->packages, sync);
|
||||||
}
|
}
|
||||||
sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
|
|
||||||
if(sync == NULL) {
|
|
||||||
FREEPKG(dummy);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
trans->packages = alpm_list_add(trans->packages, sync);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,11 +362,10 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
|
||||||
|
|
||||||
/* Helper functions for alpm_list_remove
|
/* Helper functions for alpm_list_remove
|
||||||
*/
|
*/
|
||||||
/* removed - use pkg_cmp all of the time
|
static int syncpkg_cmp(const void *s1, const void *s2)
|
||||||
static int ptr_cmp(const void *s1, const void *s2)
|
|
||||||
{
|
{
|
||||||
return(strcmp(((pmsyncpkg_t *)s1)->pkg->name, ((pmsyncpkg_t *)s2)->pkg->name));
|
return(strcmp(((pmsyncpkg_t *)s1)->pkg->name, ((pmsyncpkg_t *)s2)->pkg->name));
|
||||||
}*/
|
}
|
||||||
|
|
||||||
static int pkg_cmp(const void *p1, const void *p2)
|
static int pkg_cmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
|
@ -554,8 +557,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
if(rmpkg) {
|
if(rmpkg) {
|
||||||
pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
|
pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
|
||||||
void *vpkg;
|
void *vpkg;
|
||||||
_alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), rmpkg);
|
_alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), rsync->pkg->name);
|
||||||
trans->packages = alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
|
trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg);
|
||||||
FREESYNC(vpkg);
|
FREESYNC(vpkg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -592,7 +595,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
/* remove it from the target list */
|
/* remove it from the target list */
|
||||||
void *vpkg;
|
void *vpkg;
|
||||||
_alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), miss->depend.name);
|
_alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), miss->depend.name);
|
||||||
trans->packages = alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
|
trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg);
|
||||||
FREESYNC(vpkg);
|
FREESYNC(vpkg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue