index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-07-03 14:44:57 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-07-03 14:44:57 -0500 |
commit | 1ce7f39ad73c5c96870c6036014afad3d49a8edf (patch) | |
tree | 616b3259a2a6c4bcad5a5433a02985352c60699d /lib/libalpm/sync.c | |
parent | c839415e3fb4bcde11de3cb7595cec93501bed13 (diff) | |
parent | afc96f2ab3d05f14a73e81f871164f01423b5572 (diff) |
-rw-r--r-- | lib/libalpm/sync.c | 174 |
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 8f038400..d6b54ba0 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -66,14 +66,14 @@ alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_syn } if(spkg == NULL) { - _alpm_log(pkg->handle, PM_LOG_DEBUG, "'%s' not found in sync db => no upgrade\n", + _alpm_log(pkg->handle, ALPM_LOG_DEBUG, "'%s' not found in sync db => no upgrade\n", alpm_pkg_get_name(pkg)); return NULL; } /* compare versions and see if spkg is an upgrade */ if(_alpm_pkg_compare_versions(spkg, pkg) > 0) { - _alpm_log(pkg->handle, PM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n", + _alpm_log(pkg->handle, ALPM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg), alpm_pkg_get_version(spkg)); return spkg; @@ -94,15 +94,15 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) trans = handle->trans; db_local = handle->db_local; dbs_sync = handle->dbs_sync; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1)); - _alpm_log(handle, PM_LOG_DEBUG, "checking for package upgrades\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "checking for package upgrades\n"); for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) { alpm_pkg_t *lpkg = i->data; if(_alpm_pkg_find(trans->add, lpkg->name)) { - _alpm_log(handle, PM_LOG_DEBUG, "%s is already in the target list -- skipping\n", lpkg->name); + _alpm_log(handle, ALPM_LOG_DEBUG, "%s is already in the target list -- skipping\n", lpkg->name); continue; } @@ -116,15 +116,15 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) /* 1. literal was found in sdb */ int cmp = _alpm_pkg_compare_versions(spkg, lpkg); if(cmp > 0) { - _alpm_log(handle, PM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "new version of '%s' found (%s => %s)\n", lpkg->name, lpkg->version, spkg->version); /* check IgnorePkg/IgnoreGroup */ if(_alpm_pkg_should_ignore(handle, spkg) || _alpm_pkg_should_ignore(handle, lpkg)) { - _alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"), lpkg->name, lpkg->version, spkg->version); } else { - _alpm_log(handle, PM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n", spkg->name, spkg->version); trans->add = alpm_list_add(trans->add, spkg); } @@ -133,15 +133,15 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) /* check IgnorePkg/IgnoreGroup */ if(_alpm_pkg_should_ignore(handle, spkg) || _alpm_pkg_should_ignore(handle, lpkg)) { - _alpm_log(handle, PM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"), lpkg->name, lpkg->version, spkg->version); } else { - _alpm_log(handle, PM_LOG_WARNING, _("%s: downgrading from version %s to version %s\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("%s: downgrading from version %s to version %s\n"), lpkg->name, lpkg->version, spkg->version); trans->add = alpm_list_add(trans->add, spkg); } } else { - _alpm_log(handle, PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)\n"), lpkg->name, lpkg->version, sdb->treename, spkg->version); } } @@ -157,13 +157,13 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) /* check IgnorePkg/IgnoreGroup */ if(_alpm_pkg_should_ignore(handle, spkg) || _alpm_pkg_should_ignore(handle, lpkg)) { - _alpm_log(handle, PM_LOG_WARNING, _("ignoring package replacement (%s-%s => %s-%s)\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package replacement (%s-%s => %s-%s)\n"), lpkg->name, lpkg->version, spkg->name, spkg->version); continue; } int doreplace = 0; - QUESTION(trans, PM_TRANS_CONV_REPLACE_PKG, lpkg, spkg, sdb->treename, &doreplace); + QUESTION(trans, ALPM_TRANS_CONV_REPLACE_PKG, lpkg, spkg, sdb->treename, &doreplace); if(!doreplace) { continue; } @@ -174,23 +174,23 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) if(tpkg) { /* sanity check, multiple repos can contain spkg->name */ if(tpkg->origin_data.db != sdb) { - _alpm_log(handle, PM_LOG_WARNING, _("cannot replace %s by %s\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("cannot replace %s by %s\n"), lpkg->name, spkg->name); continue; } - _alpm_log(handle, PM_LOG_DEBUG, "appending %s to the removes list of %s\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "appending %s to the removes list of %s\n", lpkg->name, tpkg->name); tpkg->removes = alpm_list_add(tpkg->removes, lpkg); /* check the to-be-replaced package's reason field */ - if(alpm_pkg_get_reason(lpkg) == PM_PKG_REASON_EXPLICIT) { - tpkg->reason = PM_PKG_REASON_EXPLICIT; + if(alpm_pkg_get_reason(lpkg) == ALPM_PKG_REASON_EXPLICIT) { + tpkg->reason = ALPM_PKG_REASON_EXPLICIT; } } else { /* add spkg to the target list */ /* copy over reason */ spkg->reason = alpm_pkg_get_reason(lpkg); spkg->removes = alpm_list_add(NULL, lpkg); - _alpm_log(handle, PM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n", spkg->name, spkg->version); trans->add = alpm_list_add(trans->add, spkg); } @@ -234,7 +234,7 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs, if(_alpm_pkg_should_ignore(db->handle, pkg)) { ignorelist = alpm_list_add(ignorelist, pkg); int install = 0; - QUESTION(db->handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg, + QUESTION(db->handle->trans, ALPM_TRANS_CONV_INSTALL_IGNOREPKG, pkg, NULL, NULL, &install); if(!install) continue; @@ -266,7 +266,7 @@ static int compute_download_size(alpm_pkg_t *newpkg) } fname = alpm_pkg_get_filename(newpkg); - ASSERT(fname != NULL, RET_ERR(handle, PM_ERR_PKG_INVALID_NAME, -1)); + ASSERT(fname != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1)); fpath = _alpm_filecache_find(handle, fname); if(fpath) { @@ -282,10 +282,10 @@ static int compute_download_size(alpm_pkg_t *newpkg) &newpkg->delta_path); if(newpkg->delta_path && (dltsize < pkgsize * MAX_DELTA_RATIO)) { - _alpm_log(handle, PM_LOG_DEBUG, "using delta size\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "using delta size\n"); size = dltsize; } else { - _alpm_log(handle, PM_LOG_DEBUG, "using package size\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "using package size\n"); size = alpm_pkg_get_size(newpkg); alpm_list_free(newpkg->delta_path); newpkg->delta_path = NULL; @@ -294,7 +294,7 @@ static int compute_download_size(alpm_pkg_t *newpkg) size = alpm_pkg_get_size(newpkg); } - _alpm_log(handle, PM_LOG_DEBUG, "setting download size %jd for pkg %s\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "setting download size %jd for pkg %s\n", (intmax_t)size, alpm_pkg_get_name(newpkg)); newpkg->infolevel |= INFRQ_DSIZE; @@ -315,13 +315,13 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) *data = NULL; } - if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) { + if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) { alpm_list_t *resolved = NULL; /* target list after resolvedeps */ /* Build up list by repeatedly resolving each transaction package */ /* Resolve targets dependencies */ - EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL); - _alpm_log(handle, PM_LOG_DEBUG, "resolving target's dependencies\n"); + EVENT(trans, ALPM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL); + _alpm_log(handle, ALPM_LOG_DEBUG, "resolving target's dependencies\n"); /* build remove list for resolvedeps */ for(i = trans->add; i; i = i->next) { @@ -353,7 +353,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) see if they'd like to ignore them rather than failing the sync */ if(unresolvable != NULL) { int remove_unresolvable = 0; - QUESTION(trans, PM_TRANS_CONV_REMOVE_PKGS, unresolvable, + QUESTION(trans, ALPM_TRANS_CONV_REMOVE_PKGS, unresolvable, NULL, NULL, &remove_unresolvable); if(remove_unresolvable) { /* User wants to remove the unresolvable packages from the @@ -378,7 +378,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) for(i = resolved; i; i = i->next) { alpm_pkg_t *pkg = i->data; if(!_alpm_pkg_find(trans->add, pkg->name)) { - pkg->reason = PM_PKG_REASON_DEPEND; + pkg->reason = ALPM_PKG_REASON_DEPEND; } } @@ -391,17 +391,17 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) trans->add = _alpm_sortbydeps(handle, resolved, 0); alpm_list_free(resolved); - EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL); } - if(!(trans->flags & PM_TRANS_FLAG_NOCONFLICTS)) { + if(!(trans->flags & ALPM_TRANS_FLAG_NOCONFLICTS)) { /* check for inter-conflicts and whatnot */ - EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL); - _alpm_log(handle, PM_LOG_DEBUG, "looking for conflicts\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "looking for conflicts\n"); /* 1. check for conflicts in the target list */ - _alpm_log(handle, PM_LOG_DEBUG, "check targets vs targets\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "check targets vs targets\n"); deps = _alpm_innerconflicts(handle, trans->add); for(i = deps; i; i = i->next) { @@ -415,7 +415,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) continue; } - _alpm_log(handle, PM_LOG_DEBUG, "conflicting packages in the sync list: '%s' <-> '%s'\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "conflicting packages in the sync list: '%s' <-> '%s'\n", conflict->package1, conflict->package2); /* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */ @@ -428,8 +428,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) rsync = sync1; sync = sync2; } else { - _alpm_log(handle, PM_LOG_ERROR, _("unresolvable package conflicts detected\n")); - handle->pm_errno = PM_ERR_CONFLICTING_DEPS; + _alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n")); + handle->pm_errno = ALPM_ERR_CONFLICTING_DEPS; ret = -1; if(data) { alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); @@ -447,7 +447,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) _alpm_dep_free(dep2); /* Prints warning */ - _alpm_log(handle, PM_LOG_WARNING, + _alpm_log(handle, ALPM_LOG_WARNING, _("removing '%s' from target list because it conflicts with '%s'\n"), rsync->name, sync->name); trans->add = alpm_list_remove(trans->add, rsync, _alpm_pkg_cmp, NULL); @@ -460,7 +460,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) deps = NULL; /* 2. we check for target vs db conflicts (and resolve)*/ - _alpm_log(handle, PM_LOG_DEBUG, "check targets vs db and db vs targets\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "check targets vs db and db vs targets\n"); deps = _alpm_outerconflicts(handle->db_local, trans->add); for(i = deps; i; i = i->next) { @@ -479,21 +479,21 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) continue; } - _alpm_log(handle, PM_LOG_DEBUG, "package '%s' conflicts with '%s'\n", + _alpm_log(handle, ALPM_LOG_DEBUG, "package '%s' conflicts with '%s'\n", conflict->package1, conflict->package2); alpm_pkg_t *sync = _alpm_pkg_find(trans->add, conflict->package1); alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2); int doremove = 0; - QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, conflict->package1, + QUESTION(trans, ALPM_TRANS_CONV_CONFLICT_PKG, conflict->package1, conflict->package2, conflict->reason, &doremove); if(doremove) { /* append to the removes list */ - _alpm_log(handle, PM_LOG_DEBUG, "electing '%s' for removal\n", conflict->package2); + _alpm_log(handle, ALPM_LOG_DEBUG, "electing '%s' for removal\n", conflict->package2); sync->removes = alpm_list_add(sync->removes, local); } else { /* abort */ - _alpm_log(handle, PM_LOG_ERROR, _("unresolvable package conflicts detected\n")); - handle->pm_errno = PM_ERR_CONFLICTING_DEPS; + _alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n")); + handle->pm_errno = ALPM_ERR_CONFLICTING_DEPS; ret = -1; if(data) { alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); @@ -506,7 +506,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) goto cleanup; } } - EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL); alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free); alpm_list_free(deps); } @@ -517,18 +517,18 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) for(j = spkg->removes; j; j = j->next) { alpm_pkg_t *rpkg = j->data; if(!_alpm_pkg_find(trans->remove, rpkg->name)) { - _alpm_log(handle, PM_LOG_DEBUG, "adding '%s' to remove list\n", rpkg->name); + _alpm_log(handle, ALPM_LOG_DEBUG, "adding '%s' to remove list\n", rpkg->name); trans->remove = alpm_list_add(trans->remove, _alpm_pkg_dup(rpkg)); } } } - if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) { - _alpm_log(handle, PM_LOG_DEBUG, "checking dependencies\n"); + if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) { + _alpm_log(handle, ALPM_LOG_DEBUG, "checking dependencies\n"); deps = alpm_checkdeps(handle, _alpm_db_get_pkgcache(handle->db_local), trans->remove, trans->add, 1); if(deps) { - handle->pm_errno = PM_ERR_UNSATISFIED_DEPS; + handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; ret = -1; if(data) { *data = deps; @@ -612,11 +612,11 @@ static int apply_deltas(alpm_handle_t *handle) } else { /* len = cachedir len + from len + '/' + null */ len = strlen(cachedir) + strlen(d->from) + 2; - CALLOC(from, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, 1)); + CALLOC(from, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, 1)); snprintf(from, len, "%s/%s", cachedir, d->from); } len = strlen(cachedir) + strlen(d->to) + 2; - CALLOC(to, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, 1)); + CALLOC(to, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, 1)); snprintf(to, len, "%s/%s", cachedir, d->to); /* build the patch command */ @@ -627,13 +627,13 @@ static int apply_deltas(alpm_handle_t *handle) snprintf(command, PATH_MAX, "xdelta3 -d -q -s %s %s %s", from, delta, to); } - _alpm_log(handle, PM_LOG_DEBUG, "command: %s\n", command); + _alpm_log(handle, ALPM_LOG_DEBUG, "command: %s\n", command); - EVENT(trans, PM_TRANS_EVT_DELTA_PATCH_START, d->to, d->delta); + EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_START, d->to, d->delta); int retval = system(command); if(retval == 0) { - EVENT(trans, PM_TRANS_EVT_DELTA_PATCH_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_DONE, NULL, NULL); /* delete the delta file */ unlink(delta); @@ -651,8 +651,8 @@ static int apply_deltas(alpm_handle_t *handle) if(retval != 0) { /* one delta failed for this package, cancel the remaining ones */ - EVENT(trans, PM_TRANS_EVT_DELTA_PATCH_FAILED, NULL, NULL); - handle->pm_errno = PM_ERR_DLT_PATCHFAILED; + EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_FAILED, NULL, NULL); + handle->pm_errno = ALPM_ERR_DLT_PATCHFAILED; ret = 1; break; } @@ -679,7 +679,7 @@ static int test_md5sum(alpm_trans_t *trans, const char *filepath, int ret = _alpm_test_md5sum(filepath, md5sum); if(ret == 1) { int doremove = 0; - QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, (char *)filepath, + QUESTION(trans, ALPM_TRANS_CONV_CORRUPTED_PKG, (char *)filepath, NULL, NULL, &doremove); if(doremove) { unlink(filepath); @@ -701,7 +701,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas, } /* Check integrity of deltas */ - EVENT(trans, PM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL); for(i = deltas; i; i = i->next) { alpm_delta_t *d = alpm_list_getdata(i); @@ -714,15 +714,15 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas, FREE(filepath); } if(errors) { - handle->pm_errno = PM_ERR_DLT_INVALID; + handle->pm_errno = ALPM_ERR_DLT_INVALID; return -1; } - EVENT(trans, PM_TRANS_EVT_DELTA_INTEGRITY_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE, NULL, NULL); /* Use the deltas to generate the packages */ - EVENT(trans, PM_TRANS_EVT_DELTA_PATCHES_START, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCHES_START, NULL, NULL); ret = apply_deltas(handle); - EVENT(trans, PM_TRANS_EVT_DELTA_PATCHES_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCHES_DONE, NULL, NULL); return ret; } @@ -760,7 +760,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) const char *fname = NULL; fname = alpm_pkg_get_filename(spkg); - ASSERT(fname != NULL, RET_ERR(handle, PM_ERR_PKG_INVALID_NAME, -1)); + ASSERT(fname != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1)); alpm_list_t *delta_path = spkg->delta_path; if(delta_path) { /* using deltas */ @@ -782,7 +782,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) } if(files) { - EVENT(handle->trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL); + EVENT(handle->trans, ALPM_TRANS_EVT_RETRIEVE_START, current->treename, NULL); for(j = files; j; j = j->next) { const char *filename = j->data; alpm_list_t *server; @@ -794,7 +794,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) /* print server + filename into a buffer */ len = strlen(server_url) + strlen(filename) + 2; - CALLOC(fileurl, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, -1)); + CALLOC(fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(fileurl, len, "%s/%s", server_url, filename); ret = _alpm_download(handle, fileurl, cachedir, 0, 1, 0); @@ -810,10 +810,10 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) FREELIST(files); if(errors) { - _alpm_log(handle, PM_LOG_WARNING, _("failed to retrieve some files from %s\n"), + _alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"), current->treename); if(handle->pm_errno == 0) { - handle->pm_errno = PM_ERR_RETRIEVE; + handle->pm_errno = ALPM_ERR_RETRIEVE; } return -1; } @@ -854,7 +854,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) /* Check integrity of packages */ numtargs = alpm_list_count(trans->add); - EVENT(trans, PM_TRANS_EVT_INTEGRITY_START, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_INTEGRITY_START, NULL, NULL); errors = 0; @@ -865,7 +865,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) char *filepath; pgp_verify_t check_sig; - PROGRESS(trans, PM_TRANS_PROGRESS_INTEGRITY_START, "", percent, + PROGRESS(trans, ALPM_TRANS_PROGRESS_INTEGRITY_START, "", percent, numtargs, current); if(spkg->origin == PKG_FROM_FILE) { continue; /* pkg_load() has been already called, this package is valid */ @@ -878,7 +878,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) /* load the package file and replace pkgcache entry with it in the target list */ /* TODO: alpm_pkg_get_db() will not work on this target anymore */ - _alpm_log(handle, PM_LOG_DEBUG, + _alpm_log(handle, ALPM_LOG_DEBUG, "replacing pkgcache entry with package file for target %s\n", spkg->name); alpm_pkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1, spkg->md5sum, @@ -895,16 +895,16 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) _alpm_pkg_free_trans(spkg); /* spkg has been removed from the target list */ } - PROGRESS(trans, PM_TRANS_PROGRESS_INTEGRITY_START, "", 100, + PROGRESS(trans, ALPM_TRANS_PROGRESS_INTEGRITY_START, "", 100, numtargs, current); - EVENT(trans, PM_TRANS_EVT_INTEGRITY_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_INTEGRITY_DONE, NULL, NULL); if(errors) { - RET_ERR(handle, PM_ERR_PKG_INVALID, -1); + RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1); } - if(trans->flags & PM_TRANS_FLAG_DOWNLOADONLY) { + if(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY) { return 0; } @@ -913,10 +913,10 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) replaces = alpm_list_count(trans->remove); /* fileconflict check */ - if(!(trans->flags & PM_TRANS_FLAG_FORCE)) { - EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL); + if(!(trans->flags & ALPM_TRANS_FLAG_FORCE)) { + EVENT(trans, ALPM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL); - _alpm_log(handle, PM_LOG_DEBUG, "looking for file conflicts\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "looking for file conflicts\n"); alpm_list_t *conflict = _alpm_db_find_fileconflicts(handle, trans->add, trans->remove); if(conflict) { @@ -926,39 +926,39 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) alpm_list_free_inner(conflict, (alpm_list_fn_free)_alpm_fileconflict_free); alpm_list_free(conflict); } - RET_ERR(handle, PM_ERR_FILE_CONFLICTS, -1); + RET_ERR(handle, ALPM_ERR_FILE_CONFLICTS, -1); } - EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL); } /* check available disk space */ if(handle->checkspace) { - EVENT(trans, PM_TRANS_EVT_DISKSPACE_START, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DISKSPACE_START, NULL, NULL); - _alpm_log(handle, PM_LOG_DEBUG, "checking available disk space\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "checking available disk space\n"); if(_alpm_check_diskspace(handle) == -1) { - _alpm_log(handle, PM_LOG_ERROR, "%s\n", _("not enough free disk space")); + _alpm_log(handle, ALPM_LOG_ERROR, "%s\n", _("not enough free disk space")); return -1; } - EVENT(trans, PM_TRANS_EVT_DISKSPACE_DONE, NULL, NULL); + EVENT(trans, ALPM_TRANS_EVT_DISKSPACE_DONE, NULL, NULL); } /* remove conflicting and to-be-replaced packages */ if(replaces) { - _alpm_log(handle, PM_LOG_DEBUG, "removing conflicting and to-be-replaced packages\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "removing conflicting and to-be-replaced packages\n"); /* we want the frontend to be aware of commit details */ if(_alpm_remove_packages(handle) == -1) { - _alpm_log(handle, PM_LOG_ERROR, _("could not commit removal transaction\n")); + _alpm_log(handle, ALPM_LOG_ERROR, _("could not commit removal transaction\n")); return -1; } } /* install targets */ - _alpm_log(handle, PM_LOG_DEBUG, "installing packages\n"); + _alpm_log(handle, ALPM_LOG_DEBUG, "installing packages\n"); if(_alpm_upgrade_packages(handle) == -1) { - _alpm_log(handle, PM_LOG_ERROR, _("could not commit transaction\n")); + _alpm_log(handle, ALPM_LOG_ERROR, _("could not commit transaction\n")); return -1; } |