summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-05-15 04:19:57 +0200
committerJudd Vinet <judd@archlinux.org>2006-05-15 04:19:57 +0200
commitbb787e26ee01f961c76fbe4e568275a66e80009f (patch)
tree6b16de3f1d21f018ea1f2a0e53fc38562c4e89b1 /lib/libalpm/sync.c
parent3d3a29a80849f2aaa0baff93c1ae4478276e2b54 (diff)
downloadpacman-bb787e26ee01f961c76fbe4e568275a66e80009f.tar.gz
pacman-bb787e26ee01f961c76fbe4e568275a66e80009f.tar.xz
first stage of i18n stuff from VMiklos
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c101
1 files changed, 51 insertions, 50 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index a3553c27..3223c916 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -28,6 +28,7 @@
#include <limits.h> /* PATH_MAX */
#endif
#include <dirent.h>
+#include <libintl.h>
#include <libtar.h>
#include <zlib.h>
/* pacman */
@@ -54,7 +55,7 @@ pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data)
pmsyncpkg_t *sync;
if((sync = (pmsyncpkg_t *)malloc(sizeof(pmsyncpkg_t))) == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmsyncpkg_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmsyncpkg_t));
return(NULL);
}
@@ -138,7 +139,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
PMList *i, *j, *k;
/* check for "recommended" package replacements */
- _alpm_log(PM_LOG_FLOW1, "checking for package replacements");
+ _alpm_log(PM_LOG_FLOW1, _("checking for package replacements"));
for(i = dbs_sync; i; i = i->next) {
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
pmpkg_t *spkg = j->data;
@@ -147,9 +148,9 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
for(m = _alpm_db_get_pkgcache(db_local); m; m = m->next) {
pmpkg_t *lpkg = m->data;
if(!strcmp(k->data, lpkg->name)) {
- _alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'", k->data, spkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("checking replacement '%s' for package '%s'"), k->data, spkg->name);
if(_alpm_list_is_strin(lpkg->name, handle->ignorepkg)) {
- _alpm_log(PM_LOG_WARNING, "%s-%s: ignoring package upgrade (to be replaced by %s-%s)",
+ _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"),
lpkg->name, lpkg->version, spkg->name, spkg->version);
} else {
/* get confirmation for the replacement */
@@ -183,7 +184,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
sync->data = _alpm_list_add(NULL, dummy);
trans->packages = _alpm_list_add(trans->packages, sync);
}
- _alpm_log(PM_LOG_FLOW2, "%s-%s elected for upgrade (to be replaced by %s-%s)",
+ _alpm_log(PM_LOG_FLOW2, _("%s-%s elected for upgrade (to be replaced by %s-%s)"),
lpkg->name, lpkg->version, spkg->name, spkg->version);
}
}
@@ -195,7 +196,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
}
/* match installed packages with the sync dbs and compare versions */
- _alpm_log(PM_LOG_FLOW1, "checking for package upgrades");
+ _alpm_log(PM_LOG_FLOW1, _("checking for package upgrades"));
for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
int cmp;
int replace = 0;
@@ -207,7 +208,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
spkg = _alpm_db_get_pkgfromcache(j->data, local->name);
}
if(spkg == NULL) {
- _alpm_log(PM_LOG_DEBUG, "'%s' not found in sync db -- skipping", local->name);
+ _alpm_log(PM_LOG_DEBUG, _("'%s' not found in sync db -- skipping"), local->name);
continue;
}
@@ -221,7 +222,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
}
}
if(replace) {
- _alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping",
+ _alpm_log(PM_LOG_DEBUG, _("'%s' is already elected for removal -- skipping"),
spkg->name);
continue;
}
@@ -230,16 +231,16 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
cmp = _alpm_versioncmp(local->version, spkg->version);
if(cmp > 0 && !spkg->force) {
/* local version is newer */
- _alpm_log(PM_LOG_WARNING, "%s-%s: local version is newer",
+ _alpm_log(PM_LOG_WARNING, _("%s-%s: local version is newer"),
local->name, local->version);
} else if(cmp == 0) {
/* versions are identical */
} else if(_alpm_list_is_strin(i->data, handle->ignorepkg)) {
/* package should be ignored (IgnorePkg) */
- _alpm_log(PM_LOG_WARNING, "%s-%s: ignoring package upgrade (%s)",
+ _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
local->name, local->version, spkg->version);
} else {
- _alpm_log(PM_LOG_FLOW2, "%s-%s elected for upgrade (%s => %s)",
+ _alpm_log(PM_LOG_FLOW2, _("%s-%s elected for upgrade (%s => %s)"),
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);
@@ -290,12 +291,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
if(spkg == NULL) {
/* Search provides */
PMList *p;
- _alpm_log(PM_LOG_FLOW2, "target '%s' not found -- looking for provisions", targ);
+ _alpm_log(PM_LOG_FLOW2, _("target '%s' not found -- looking for provisions"), targ);
p = _alpm_db_whatprovides(dbs, targ);
if(p == NULL) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
- _alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'", p->data, targ);
+ _alpm_log(PM_LOG_DEBUG, _("found '%s' as a provision for '%s'"), p->data, targ);
spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
FREELISTPTR(p);
}
@@ -309,12 +310,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
}
if(spkg == NULL) {
/* Search provides */
- _alpm_log(PM_LOG_FLOW2, "target '%s' not found -- looking for provisions", targ);
+ _alpm_log(PM_LOG_FLOW2, _("target '%s' not found -- looking for provisions"), targ);
for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *dbs = j->data;
PMList *p = _alpm_db_whatprovides(dbs, targ);
if(p) {
- _alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'", p->data, targ);
+ _alpm_log(PM_LOG_DEBUG, _("found '%s' as a provision for '%s'"), p->data, targ);
spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
FREELISTPTR(p);
}
@@ -333,7 +334,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
int resp = 0;
QUESTION(trans, PM_TRANS_CONV_LOCAL_NEWER, local, NULL, NULL, &resp);
if(!resp) {
- _alpm_log(PM_LOG_WARNING, "%s-%s: local version is newer -- skipping", local->name, local->version);
+ _alpm_log(PM_LOG_WARNING, _("%s-%s: local version is newer -- skipping"), local->name, local->version);
return(0);
}
} else if(cmp == 0) {
@@ -341,7 +342,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
int resp = 0;
QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
if(!resp) {
- _alpm_log(PM_LOG_WARNING, "%s-%s is up to date -- skipping", local->name, local->version);
+ _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping"), local->name, local->version);
return(0);
}
}
@@ -361,7 +362,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
FREEPKG(dummy);
RET_ERR(PM_ERR_MEMORY, -1);
}
- _alpm_log(PM_LOG_FLOW2, "adding target '%s' to the transaction set", spkg->name);
+ _alpm_log(PM_LOG_FLOW2, _("adding target '%s' to the transaction set"), spkg->name);
trans->packages = _alpm_list_add(trans->packages, sync);
}
@@ -401,7 +402,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
/* Resolve targets dependencies */
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
- _alpm_log(PM_LOG_FLOW1, "resolving targets dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("resolving targets dependencies"));
for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg;
if(_alpm_resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) {
@@ -420,13 +421,13 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
goto cleanup;
}
trans->packages = _alpm_list_add(trans->packages, sync);
- _alpm_log(PM_LOG_FLOW2, "adding package %s-%s to the transaction targets",
+ _alpm_log(PM_LOG_FLOW2, _("adding package %s-%s to the transaction targets"),
spkg->name, spkg->version);
}
}
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
- _alpm_log(PM_LOG_FLOW1, "looking for unresolvable dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("looking for unresolvable dependencies"));
deps = _alpm_checkdeps(db_local, PM_TRANS_TYPE_UPGRADE, list);
if(deps) {
if(data) {
@@ -445,7 +446,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
/* check for inter-conflicts and whatnot */
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);
- _alpm_log(PM_LOG_FLOW1, "looking for conflicts");
+ _alpm_log(PM_LOG_FLOW1, _("looking for conflicts"));
deps = _alpm_checkconflicts(db_local, list);
if(deps) {
int errorout = 0;
@@ -456,7 +457,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
pmsyncpkg_t *sync;
pmpkg_t *local;
- _alpm_log(PM_LOG_FLOW2, "package '%s' is conflicting with '%s'",
+ _alpm_log(PM_LOG_FLOW2, _("package '%s' is conflicting with '%s'"),
miss->target, miss->depend.name);
/* check if the conflicting package is one that's about to be removed/replaced.
@@ -490,7 +491,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
/* so just treat it like a "replaces" item so the REQUIREDBY
* fields are inherited properly.
*/
- _alpm_log(PM_LOG_DEBUG, "package '%s' provides its own conflict", miss->target);
+ _alpm_log(PM_LOG_DEBUG, _("package '%s' provides its own conflict"), miss->target);
if(local) {
/* nothing to do for now: it will be handled later
* (not the same behavior as in pacman 2.x) */
@@ -513,12 +514,12 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
target = _alpm_list_is_strin(miss->target, trans->targets);
depend = _alpm_list_is_strin(miss->depend.name, trans->targets);
if(depend && !target) {
- _alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it",
+ _alpm_log(PM_LOG_DEBUG, _("'%s' is in the target list -- keeping it"),
miss->depend.name);
/* remove miss->target */
rmpkg = miss->target;
} else if(target && !depend) {
- _alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it",
+ _alpm_log(PM_LOG_DEBUG, _("'%s' is in the target list -- keeping it"),
miss->target);
/* remove miss->depend.name */
rmpkg = miss->depend.name;
@@ -528,7 +529,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
if(rmpkg) {
pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
pmsyncpkg_t *spkg = NULL;
- _alpm_log(PM_LOG_FLOW2, "removing '%s' from target list", rmpkg);
+ _alpm_log(PM_LOG_FLOW2, _("removing '%s' from target list"), rmpkg);
trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, (void **)&spkg);
FREESYNC(spkg);
continue;
@@ -538,7 +539,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
/* It's a conflict -- see if they want to remove it
*/
- _alpm_log(PM_LOG_DEBUG, "resolving package '%s' conflict", miss->target);
+ _alpm_log(PM_LOG_DEBUG, _("resolving package '%s' conflict"), miss->target);
if(local) {
int doremove = 0;
if(!_alpm_list_is_strin(miss->depend.name, asked)) {
@@ -561,22 +562,22 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
FREEPKG(sync->data);
}
/* append to the replaces list */
- _alpm_log(PM_LOG_FLOW2, "electing '%s' for removal", miss->depend.name);
+ _alpm_log(PM_LOG_FLOW2, _("electing '%s' for removal"), miss->depend.name);
sync->data = _alpm_list_add(sync->data, q);
if(rsync) {
/* remove it from the target list */
pmsyncpkg_t *spkg = NULL;
- _alpm_log(PM_LOG_FLOW2, "removing '%s' from target list", miss->depend.name);
+ _alpm_log(PM_LOG_FLOW2, _("removing '%s' from target list"), miss->depend.name);
trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, (void **)&spkg);
FREESYNC(spkg);
}
} else {
/* abort */
- _alpm_log(PM_LOG_ERROR, "unresolvable package conflicts detected");
+ _alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected"));
errorout = 1;
if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmdepmissing_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;
@@ -588,11 +589,11 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
}
}
} else {
- _alpm_log(PM_LOG_ERROR, "unresolvable package conflicts detected");
+ _alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected"));
errorout = 1;
if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmdepmissing_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;
@@ -654,7 +655,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
pmpkg_t *leavingp = _alpm_db_get_pkgfromcache(db_local, miss->target);
pmpkg_t *conflictp = _alpm_db_get_pkgfromcache(db_local, miss->depend.name);
if(!leavingp || !conflictp) {
- _alpm_log(PM_LOG_ERROR, "something has gone horribly wrong");
+ _alpm_log(PM_LOG_ERROR, _("something has gone horribly wrong"));
ret = -1;
goto cleanup;
}
@@ -673,7 +674,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
for(o = sp->pkg->provides; o && !pfound; o = o->next) {
if(!strcmp(m->data, o->data)) {
/* found matching provisio -- we're good to go */
- _alpm_log(PM_LOG_FLOW2, "found '%s' as a provision for '%s' -- conflict aborted",
+ _alpm_log(PM_LOG_FLOW2, _("found '%s' as a provision for '%s' -- conflict aborted"),
sp->pkg->name, (char *)o->data);
pfound = 1;
}
@@ -688,7 +689,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
}
if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmdepmissing_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;
@@ -732,14 +733,14 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
/* remove conflicting and to-be-replaced packages */
tr = _alpm_trans_new();
if(tr == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not create removal transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not create removal transaction"));
pm_errno = PM_ERR_MEMORY;
goto error;
}
if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVE, PM_TRANS_FLAG_NODEPS,
trans->cb_event, trans->cb_conv) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not initialize the removal transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not initialize the removal transaction"));
goto error;
}
@@ -759,31 +760,31 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
}
}
if(replaces) {
- _alpm_log(PM_LOG_FLOW1, "removing conflicting and to-be-replaced packages");
+ _alpm_log(PM_LOG_FLOW1, _("removing conflicting and to-be-replaced packages"));
if(_alpm_trans_prepare(tr, data) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not prepare removal transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not prepare removal transaction"));
goto error;
}
/* we want the frontend to be aware of commit details */
tr->cb_event = trans->cb_event;
if(_alpm_trans_commit(tr, NULL) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not commit removal transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not commit removal transaction"));
goto error;
}
}
FREETRANS(tr);
/* install targets */
- _alpm_log(PM_LOG_FLOW1, "installing packages");
+ _alpm_log(PM_LOG_FLOW1, _("installing packages"));
tr = _alpm_trans_new();
if(tr == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not create transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not create transaction"));
pm_errno = PM_ERR_MEMORY;
goto error;
}
if(_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags | PM_TRANS_FLAG_NODEPS,
trans->cb_event, trans->cb_conv) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not initialize transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not initialize transaction"));
goto error;
}
for(i = trans->packages; i; i = i->next) {
@@ -802,18 +803,18 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
}
}
if(_alpm_trans_prepare(tr, data) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not prepare transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not prepare transaction"));
goto error;
}
if(_alpm_trans_commit(tr, NULL) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not commit transaction");
+ _alpm_log(PM_LOG_ERROR, _("could not commit transaction"));
goto error;
}
FREETRANS(tr);
/* propagate replaced packages' requiredby fields to their new owners */
if(replaces) {
- _alpm_log(PM_LOG_FLOW1, "updating database for replaced packages dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("updating database for replaced packages dependencies"));
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
@@ -842,7 +843,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
}
}
if(_alpm_db_write(db_local, depender, INFRQ_DEPENDS) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not update requiredby for database entry %s-%s",
+ _alpm_log(PM_LOG_ERROR, _("could not update requiredby for database entry %s-%s"),
new->name, new->version);
}
/* add the new requiredby */
@@ -851,7 +852,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
}
}
if(_alpm_db_write(db_local, new, INFRQ_DEPENDS) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not update new database entry %s-%s",
+ _alpm_log(PM_LOG_ERROR, _("could not update new database entry %s-%s"),
new->name, new->version);
}
}