summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c119
-rw-r--r--lib/libalpm/alpm.c35
-rw-r--r--lib/libalpm/be_files.c9
-rw-r--r--lib/libalpm/cache.c11
-rw-r--r--lib/libalpm/conflict.c27
-rw-r--r--lib/libalpm/db.c5
-rw-r--r--lib/libalpm/deps.c37
-rw-r--r--lib/libalpm/error.c76
-rw-r--r--lib/libalpm/group.c3
-rw-r--r--lib/libalpm/handle.c27
-rw-r--r--lib/libalpm/md5driver.c4
-rw-r--r--lib/libalpm/package.c17
-rw-r--r--lib/libalpm/remove.c57
-rw-r--r--lib/libalpm/sync.c101
-rw-r--r--lib/libalpm/trans.c3
-rw-r--r--lib/libalpm/util.c27
-rw-r--r--lib/libalpm/util.h2
17 files changed, 290 insertions, 270 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 687774db..7b96cf08 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <limits.h>
#include <zlib.h>
+#include <libintl.h>
#include <libtar.h>
/* pacman */
#include "util.h"
@@ -81,7 +82,7 @@ static int add_faketarget(pmtrans_t *trans, char *name)
} else if(strncmp("depend", p, q-p) == 0) {
dummy->depends = _alpm_list_add(dummy->depends, strdup(q+1));
} else {
- _alpm_log(PM_LOG_ERROR, "could not parse token %s", p);
+ _alpm_log(PM_LOG_ERROR, _("could not parse token %s"), p);
}
}
FREE(str);
@@ -113,7 +114,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
return(add_faketarget(trans, name));
}
- _alpm_log(PM_LOG_FLOW2, "loading target '%s'", name);
+ _alpm_log(PM_LOG_FLOW2, _("loading target '%s'"), name);
if(stat(name, &buf)) {
pm_errno = PM_ERR_NOT_A_FILE;
@@ -155,7 +156,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
if(strcmp(pkg->name, pkgname) == 0) {
if(_alpm_versioncmp(pkg->version, pkgver) < 0) {
pmpkg_t *newpkg;
- _alpm_log(PM_LOG_WARNING, "replacing older version %s-%s by %s in target list",
+ _alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list"),
pkg->name, pkg->version, pkgver);
if((newpkg = _alpm_pkg_load(name)) == NULL) {
/* pm_errno is already set by pkg_load() */
@@ -164,14 +165,14 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
FREEPKG(i->data);
i->data = newpkg;
} else {
- _alpm_log(PM_LOG_WARNING, "newer version %s-%s is in the target list -- skipping",
+ _alpm_log(PM_LOG_WARNING, _("newer version %s-%s is in the target list -- skipping"),
pkg->name, pkg->version, pkgver);
}
return(0);
}
}
- _alpm_log(PM_LOG_FLOW2, "reading '%s' metadata", pkgname);
+ _alpm_log(PM_LOG_FLOW2, _("reading '%s' metadata"), pkgname);
info = _alpm_pkg_load(name);
if(info == NULL) {
/* pm_errno is already set by pkg_load() */
@@ -210,7 +211,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
/* look for unsatisfied dependencies */
- _alpm_log(PM_LOG_FLOW1, "looking for unsatisfied dependencies");
+ _alpm_log(PM_LOG_FLOW1,_( "looking for unsatisfied dependencies"));
lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) {
if(data) {
@@ -222,7 +223,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
}
/* no unsatisfied deps, so look for conflicts */
- _alpm_log(PM_LOG_FLOW1, "looking for conflicts");
+ _alpm_log(PM_LOG_FLOW1, _("looking for conflicts"));
lp = _alpm_checkconflicts(db, trans->packages);
if(lp != NULL) {
if(data) {
@@ -234,7 +235,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
}
/* re-order w.r.t. dependencies */
- _alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("sorting by dependencies"));
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
/* free the old alltargs */
FREELISTPTR(trans->packages);
@@ -250,7 +251,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
- _alpm_log(PM_LOG_FLOW1, "looking for file conflicts");
+ _alpm_log(PM_LOG_FLOW1, _("looking for file conflicts"));
lp = _alpm_db_find_conflicts(db, trans->packages, handle->root, &skiplist);
if(lp != NULL) {
if(data) {
@@ -306,13 +307,13 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
pmpkg_t *local = _alpm_db_get_pkgfromcache(db, info->name);
if(local) {
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, info, NULL);
- _alpm_log(PM_LOG_FLOW1, "upgrading package %s-%s", info->name, info->version);
+ _alpm_log(PM_LOG_FLOW1, _("upgrading package %s-%s"), info->name, info->version);
/* we'll need to save some record for backup checks later */
oldpkg = _alpm_pkg_new(local->name, local->version);
if(oldpkg) {
if(!(local->infolevel & INFRQ_FILES)) {
- _alpm_log(PM_LOG_DEBUG, "loading FILES info for '%s'", local->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), local->name);
_alpm_db_read(db, INFRQ_FILES, local);
}
oldpkg->backup = _alpm_list_strdup(local->backup);
@@ -320,7 +321,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
/* copy over the install reason */
if(!(local->infolevel & INFRQ_DESC)) {
- _alpm_log(PM_LOG_DEBUG, "loading DESC info for '%s'", local->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading DESC info for '%s'"), local->name);
_alpm_db_read(db, INFRQ_DESC, local);
}
info->reason = local->reason;
@@ -332,7 +333,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if(oldpkg) {
pmtrans_t *tr;
- _alpm_log(PM_LOG_FLOW1, "removing old package first (%s-%s)", oldpkg->name, oldpkg->version);
+ _alpm_log(PM_LOG_FLOW1, _("removing old package first (%s-%s)"), oldpkg->name, oldpkg->version);
tr = _alpm_trans_new();
if(tr == NULL) {
RET_ERR(PM_ERR_TRANS_ABORT, -1);
@@ -361,18 +362,18 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
}
if(!pmo_upgrade) {
EVENT(trans, PM_TRANS_EVT_ADD_START, info, NULL);
- _alpm_log(PM_LOG_FLOW1, "adding package %s-%s", info->name, info->version);
+ _alpm_log(PM_LOG_FLOW1, _("adding package %s-%s"), info->name, info->version);
/* pre_install scriptlet */
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
_alpm_runscriptlet(handle->root, info->data, "pre_install", info->version, NULL);
}
} else {
- _alpm_log(PM_LOG_FLOW1, "adding new package %s-%s", info->name, info->version);
+ _alpm_log(PM_LOG_FLOW1, _("adding new package %s-%s"), info->name, info->version);
}
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
- _alpm_log(PM_LOG_FLOW1, "extracting files");
+ _alpm_log(PM_LOG_FLOW1, _("extracting files"));
/* Extract the .tar.gz package */
if(tar_open(&tar, info->data, &gztype, O_RDONLY, 0, TAR_GNU) == -1) {
@@ -407,7 +408,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
* could be used.
*/
if(_alpm_list_is_strin(pathname, handle->noextract)) {
- alpm_logaction("notice: %s is in NoExtract -- skipping extraction", pathname);
+ alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), pathname);
tar_skip_regfile(tar);
continue;
}
@@ -438,7 +439,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
temp = strdup("/tmp/alpm_XXXXXX");
fd = mkstemp(temp);
if(tar_extract_file(tar, temp)) {
- alpm_logaction("could not extract %s (%s)", pathname, strerror(errno));
+ alpm_logaction(_("could not extract %s (%s)"), pathname, strerror(errno));
errors++;
unlink(temp);
FREE(temp);
@@ -469,11 +470,11 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
}
}
- _alpm_log(PM_LOG_DEBUG, "checking md5 hashes for %s", pathname);
- _alpm_log(PM_LOG_DEBUG, "current: %s", md5_local);
- _alpm_log(PM_LOG_DEBUG, "new: %s", md5_pkg);
+ _alpm_log(PM_LOG_DEBUG, _("checking md5 hashes for %s"), pathname);
+ _alpm_log(PM_LOG_DEBUG, _("current: %s"), md5_local);
+ _alpm_log(PM_LOG_DEBUG, _("new: %s"), md5_pkg);
if(md5_orig) {
- _alpm_log(PM_LOG_DEBUG, "original: %s", md5_orig);
+ _alpm_log(PM_LOG_DEBUG, _("original: %s"), md5_orig);
}
if(!pmo_upgrade) {
@@ -485,16 +486,16 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
char newpath[PATH_MAX];
snprintf(newpath, PATH_MAX, "%s.pacorig", expath);
if(rename(expath, newpath)) {
- _alpm_log(PM_LOG_ERROR, "could not rename %s (%s)", pathname, strerror(errno));
- alpm_logaction("error: could not rename %s (%s)", expath, strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not rename %s (%s)"), pathname, strerror(errno));
+ alpm_logaction(_("error: could not rename %s (%s)"), expath, strerror(errno));
}
if(_alpm_copyfile(temp, expath)) {
- _alpm_log(PM_LOG_ERROR, "could not copy %s to %s (%s)", temp, pathname, strerror(errno));
- alpm_logaction("error: could not copy %s to %s (%s)", temp, expath, strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not copy %s to %s (%s)"), temp, pathname, strerror(errno));
+ alpm_logaction(_("error: could not copy %s to %s (%s)"), temp, expath, strerror(errno));
errors++;
} else {
- _alpm_log(PM_LOG_WARNING, "%s saved as %s.pacorig", pathname, pathname);
- alpm_logaction("warning: %s saved as %s", expath, newpath);
+ _alpm_log(PM_LOG_WARNING, _("%s saved as %s.pacorig"), pathname, pathname);
+ alpm_logaction(_("warning: %s saved as %s"), expath, newpath);
}
}
} else if(md5_orig) {
@@ -504,29 +505,29 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
/* the fun part */
if(!strcmp(md5_orig, md5_local)) {
if(!strcmp(md5_local, md5_pkg)) {
- _alpm_log(PM_LOG_DEBUG, "action: installing new file");
+ _alpm_log(PM_LOG_DEBUG, _("action: installing new file"));
installnew = 1;
} else {
- _alpm_log(PM_LOG_DEBUG, "action: installing new file");
+ _alpm_log(PM_LOG_DEBUG, _("action: installing new file"));
installnew = 1;
}
} else if(!strcmp(md5_orig, md5_pkg)) {
- _alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place");
+ _alpm_log(PM_LOG_DEBUG, _("action: leaving existing file in place"));
} else if(!strcmp(md5_local, md5_pkg)) {
- _alpm_log(PM_LOG_DEBUG, "action: installing new file");
+ _alpm_log(PM_LOG_DEBUG, _("action: installing new file"));
installnew = 1;
} else {
- _alpm_log(PM_LOG_DEBUG, "action: leaving file in place, installing new one as .pacnew");
+ _alpm_log(PM_LOG_DEBUG, _("action: leaving file in place, installing new one as .pacnew"));
strncat(expath, ".pacnew", PATH_MAX);
installnew = 1;
- _alpm_log(PM_LOG_WARNING, "extracting %s as %s.pacnew", pathname, pathname);
- alpm_logaction("warning: extracting %s%s as %s", handle->root, pathname, expath);
+ _alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew"), pathname, pathname);
+ alpm_logaction(_("warning: extracting %s%s as %s"), handle->root, pathname, expath);
}
if(installnew) {
- _alpm_log(PM_LOG_FLOW2, "extracting %s", pathname);
+ _alpm_log(PM_LOG_FLOW2, _("extracting %s"), pathname);
if(_alpm_copyfile(temp, expath)) {
- _alpm_log(PM_LOG_ERROR, "could not copy %s to %s (%s)", temp, pathname, strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not copy %s to %s (%s)"), temp, pathname, strerror(errno));
errors++;
}
}
@@ -540,12 +541,12 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
close(fd);
} else {
if(!notouch) {
- _alpm_log(PM_LOG_FLOW2, "extracting %s", pathname);
+ _alpm_log(PM_LOG_FLOW2, _("extracting %s"), pathname);
} else {
- _alpm_log(PM_LOG_FLOW2, "%s is in NoUpgrade -- skipping", pathname);
+ _alpm_log(PM_LOG_FLOW2, _("%s is in NoUpgrade -- skipping"), pathname);
strncat(expath, ".pacnew", PATH_MAX);
- _alpm_log(PM_LOG_WARNING, "extracting %s as %s.pacnew", pathname, pathname);
- alpm_logaction("warning: extracting %s%s as %s", handle->root, pathname, expath);
+ _alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew"), pathname, pathname);
+ alpm_logaction(_("warning: extracting %s%s as %s"), handle->root, pathname, expath);
/*tar_skip_regfile(tar);*/
}
if(trans->flags & PM_TRANS_FLAG_FORCE) {
@@ -557,8 +558,8 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
unlink(expath);
}
if(tar_extract_file(tar, expath)) {
- _alpm_log(PM_LOG_ERROR, "could not extract %s (%s)", pathname, strerror(errno));
- alpm_logaction("error: could not extract %s (%s)", pathname, strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), pathname, strerror(errno));
+ alpm_logaction(_("error: could not extract %s (%s)"), pathname, strerror(errno));
errors++;
}
/* calculate an md5 hash if this is in info->backup */
@@ -569,7 +570,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if(!file) continue;
if(!strcmp(file, pathname)) {
- _alpm_log(PM_LOG_DEBUG, "appending backup entry");
+ _alpm_log(PM_LOG_DEBUG, _("appending backup entry"));
snprintf(path, PATH_MAX, "%s%s", handle->root, file);
md5 = MDFile(path);
/* 32 for the hash, 1 for the terminating NULL, and 1 for the tab delimiter */
@@ -589,10 +590,10 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if(errors) {
ret = 1;
- _alpm_log(PM_LOG_ERROR, "errors occurred while %s %s",
- (pmo_upgrade ? "upgrading" : "installing"), info->name);
- alpm_logaction("errors occurred while %s %s",
- (pmo_upgrade ? "upgrading" : "installing"), info->name);
+ _alpm_log(PM_LOG_ERROR, _("errors occurred while %s %s"),
+ (pmo_upgrade ? _("upgrading") : _("installing")), info->name);
+ alpm_logaction(_("errors occurred while %s %s"),
+ (pmo_upgrade ? _("upgrading") : _("installing")), info->name);
}
}
@@ -613,7 +614,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
continue;
}
if(tmppm->data && !strcmp(depend.name, info->name)) {
- _alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'", tmpp->name, info->name);
+ _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), tmpp->name, info->name);
info->requiredby = _alpm_list_add(info->requiredby, strdup(tmpp->name));
}
}
@@ -624,21 +625,21 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
/* remove the extra line feed appended by asctime() */
info->installdate[strlen(info->installdate)-1] = 0;
- _alpm_log(PM_LOG_FLOW1, "updating database");
- _alpm_log(PM_LOG_FLOW2, "adding database entry '%s'", info->name);
+ _alpm_log(PM_LOG_FLOW1, _("updating database"));
+ _alpm_log(PM_LOG_FLOW2, _("adding database entry '%s'"), info->name);
if(_alpm_db_write(db, info, INFRQ_ALL)) {
- _alpm_log(PM_LOG_ERROR, "could not update database entry %s-%s",
+ _alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s"),
info->name, info->version);
- alpm_logaction(NULL, "error updating database for %s-%s!", info->name, info->version);
+ alpm_logaction(NULL, _("error updating database for %s-%s!"), info->name, info->version);
RET_ERR(PM_ERR_DB_WRITE, -1);
}
if(_alpm_db_add_pkgincache(db, info) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not add entry '%s' in cache", info->name);
+ _alpm_log(PM_LOG_ERROR, _("could not add entry '%s' in cache"), info->name);
}
/* update dependency packages' REQUIREDBY fields */
if(info->depends) {
- _alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields");
+ _alpm_log(PM_LOG_FLOW2, _("updating dependency packages 'requiredby' fields"));
}
for(lp = info->depends; lp; lp = lp->next) {
pmpkg_t *depinfo;
@@ -659,15 +660,15 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
FREELISTPTR(provides);
}
if(depinfo == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not find dependency '%s'", depend.name);
+ _alpm_log(PM_LOG_ERROR, _("could not find dependency '%s'"), depend.name);
/* wtf */
continue;
}
}
- _alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'", info->name, depinfo->name);
+ _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), info->name, depinfo->name);
depinfo->requiredby = _alpm_list_add(depinfo->requiredby, strdup(info->name));
if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) {
- _alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
+ _alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"),
depinfo->name, depinfo->version);
}
}
@@ -688,7 +689,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
}
/* run ldconfig if it exists */
- _alpm_log(PM_LOG_FLOW1, "running \"ldconfig -r %s\"", handle->root);
+ _alpm_log(PM_LOG_FLOW1, _("running \"ldconfig -r %s\""), handle->root);
_alpm_ldconfig(handle->root);
return(0);
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 70b1bb78..cffbfc46 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -31,6 +31,7 @@
#include <syslog.h>
#include <limits.h> /* PATH_MAX */
#include <stdarg.h>
+#include <libintl.h>
/* pacman */
#include "log.h"
#include "error.h"
@@ -189,12 +190,12 @@ pmdb_t *alpm_db_register(char *treename)
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
}
- _alpm_log(PM_LOG_FLOW1, "registering database '%s'", treename);
+ _alpm_log(PM_LOG_FLOW1, _("registering database '%s'"), treename);
/* make sure the database directory exists */
snprintf(path, PATH_MAX, "%s%s/%s", handle->root, handle->dbpath, treename);
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
- _alpm_log(PM_LOG_FLOW1, "database directory '%s' does not exist -- try creating it", path);
+ _alpm_log(PM_LOG_FLOW1, _("database directory '%s' does not exist -- try creating it"), path);
if(_alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, NULL);
}
@@ -205,7 +206,7 @@ pmdb_t *alpm_db_register(char *treename)
return(NULL);
}
- _alpm_log(PM_LOG_DEBUG, "opening database '%s'", db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("opening database '%s'"), db->treename);
if(_alpm_db_open(db, DB_O_CREATE) == -1) {
_alpm_db_free(db);
RET_ERR(PM_ERR_DB_OPEN, NULL);
@@ -249,12 +250,12 @@ int alpm_db_unregister(pmdb_t *db)
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
- _alpm_log(PM_LOG_FLOW1, "unregistering database '%s'", db->treename);
+ _alpm_log(PM_LOG_FLOW1, _("unregistering database '%s'"), db->treename);
/* Cleanup */
_alpm_db_free_pkgcache(db);
- _alpm_log(PM_LOG_DEBUG, "closing database '%s'", db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("closing database '%s'"), db->treename);
_alpm_db_close(db);
_alpm_db_free(db);
@@ -304,11 +305,11 @@ int alpm_db_update(PM_DB *db, char *archive)
}
/* remove the old dir */
- _alpm_log(PM_LOG_FLOW2, "flushing database %s/%s", handle->dbpath, db->treename);
+ _alpm_log(PM_LOG_FLOW2, _("flushing database %s/%s"), handle->dbpath, db->treename);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
if(_alpm_db_remove(db, lp->data) == -1) {
if(lp->data) {
- _alpm_log(PM_LOG_ERROR, "could not remove database entry %s/%s", db->treename,
+ _alpm_log(PM_LOG_ERROR, _("could not remove database entry %s/%s"), db->treename,
((pmpkg_t *)lp->data)->name);
}
RET_ERR(PM_ERR_DB_REMOVE, -1);
@@ -322,7 +323,7 @@ int alpm_db_update(PM_DB *db, char *archive)
/* ORE
we should not simply unpack the archive, but better parse it and
db_write each entry (see sync_load_dbarchive to get archive content) */
- _alpm_log(PM_LOG_FLOW2, "unpacking %s", archive);
+ _alpm_log(PM_LOG_FLOW2, _("unpacking %s"), archive);
if(_alpm_unpack(archive, db->path, NULL)) {
RET_ERR(PM_ERR_SYSTEM, -1);
}
@@ -423,7 +424,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_REASON:
case PM_PKG_MD5SUM:
if(!(pkg->infolevel & INFRQ_DESC)) {
- _alpm_log(PM_LOG_DEBUG, "loading DESC info for '%s'", pkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading DESC info for '%s'"), pkg->name);
_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
}
break;
@@ -443,14 +444,14 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_FILES:
case PM_PKG_BACKUP:
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_FILES)) {
- _alpm_log(PM_LOG_DEBUG, "loading FILES info for '%s'", pkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), pkg->name);
_alpm_db_read(pkg->data, INFRQ_FILES, pkg);
}
break;
/* Scriptlet */
case PM_PKG_SCRIPLET:
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_SCRIPLET)) {
- _alpm_log(PM_LOG_DEBUG, "loading SCRIPLET info for '%s'", pkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading SCRIPLET info for '%s'"), pkg->name);
_alpm_db_read(pkg->data, INFRQ_SCRIPLET, pkg);
}
break;
@@ -545,21 +546,21 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg)
md5sum = MDFile(path);
if(md5sum == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not get md5 checksum for package %s-%s\n",
+ _alpm_log(PM_LOG_ERROR, _("could not get md5 checksum for package %s-%s\n"),
pkg->name, pkg->version);
pm_errno = PM_ERR_NOT_A_FILE;
retval = -1;
} else {
if(!(pkg->infolevel & INFRQ_DESC)) {
- _alpm_log(PM_LOG_DEBUG, "loading DESC info for '%s'", pkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading DESC info for '%s'"), pkg->name);
_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
}
if(strcmp(md5sum, pkg->md5sum) == 0) {
- _alpm_log(PM_LOG_FLOW1, "checksums for package %s-%s are matching",
+ _alpm_log(PM_LOG_FLOW1, _("checksums for package %s-%s are matching"),
pkg->name, pkg->version);
} else {
- _alpm_log(PM_LOG_ERROR, "md5sums do not match for package %s-%s\n",
+ _alpm_log(PM_LOG_ERROR, _("md5sums do not match for package %s-%s\n"),
pkg->name, pkg->version);
pm_errno = PM_ERR_PKG_INVALID;
retval = -1;
@@ -806,8 +807,8 @@ int alpm_trans_release()
handle->lckfd = -1;
}
if(_alpm_lckrm(PM_LOCK) == -1) {
- _alpm_log(PM_LOG_WARNING, "could not remove lock file %s", PM_LOCK);
- alpm_logaction("warning: could not remove lock file %s", PM_LOCK);
+ _alpm_log(PM_LOG_WARNING, _("could not remove lock file %s"), PM_LOCK);
+ alpm_logaction(_("warning: could not remove lock file %s"), PM_LOCK);
}
return(0);
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 0a648223..1f18d71a 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
@@ -138,7 +139,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq)
return(NULL);
}
if(_alpm_pkg_splitname(ent->d_name, pkg->name, pkg->version) == -1) {
- _alpm_log(PM_LOG_ERROR, "invalid name for dabatase entry '%s'", ent->d_name);
+ _alpm_log(PM_LOG_ERROR, _("invalid name for dabatase entry '%s'"), ent->d_name);
return(NULL);
}
if(_alpm_db_read(db, inforeq, pkg) == -1) {
@@ -375,7 +376,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, "db_write: could not open file %s/desc", db->treename);
+ _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/desc"), db->treename);
retval = 1;
goto cleanup;
}
@@ -446,7 +447,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
if(local && (inforeq & INFRQ_FILES)) {
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, "db_write: could not open file %s/files", db->treename);
+ _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/files"), db->treename);
retval = -1;
goto cleanup;
}
@@ -472,7 +473,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, "db_write: could not open file %s/depends", db->treename);
+ _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/depends"), db->treename);
retval = -1;
goto cleanup;
}
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 2a98d886..3c844b49 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
+#include <libintl.h>
/* pacman */
#include "log.h"
#include "alpm.h"
@@ -51,7 +52,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
_alpm_db_free_pkgcache(db);
- _alpm_log(PM_LOG_DEBUG, "loading package cache (infolevel=%#x) for repository '%s'",
+ _alpm_log(PM_LOG_DEBUG, _("loading package cache (infolevel=%#x) for repository '%s'"),
infolevel, db->treename);
_alpm_db_rewind(db);
@@ -71,7 +72,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
return;
}
- _alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'",
+ _alpm_log(PM_LOG_DEBUG, _("freeing package cache for repository '%s'"),
db->treename);
FREELISTPKGS(db->pkgcache);
@@ -106,7 +107,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
if(newpkg == NULL) {
return(-1);
}
- _alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache", newpkg->name, db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("adding entry '%s' in '%s' cache"), newpkg->name, db->treename);
db->pkgcache = _alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
_alpm_db_free_grpcache(db);
@@ -128,7 +129,7 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
return(-1);
}
- _alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache", pkg->name, db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("removing entry '%s' from '%s' cache"), pkg->name, db->treename);
FREEPKG(data);
_alpm_db_free_grpcache(db);
@@ -159,7 +160,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
_alpm_db_load_pkgcache(db);
}
- _alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'", db->treename);
+ _alpm_log(PM_LOG_DEBUG, _("loading group cache for repository '%s'"), db->treename);
for(lp = db->pkgcache; lp; lp = lp->next) {
PMList *i;
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index f29a0779..2e9cc050 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
+#include <libintl.h>
/* pacman */
#include "util.h"
#include "log.h"
@@ -59,7 +60,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
continue;
}
/* CHECK 1: check targets against database */
- _alpm_log(PM_LOG_DEBUG, "checkconflicts: targ '%s' vs db", tp->name);
+ _alpm_log(PM_LOG_DEBUG, _("checkconflicts: targ '%s' vs db"), tp->name);
for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
pmpkg_t *dp = (pmpkg_t *)k->data;
if(!strcmp(dp->name, tp->name)) {
@@ -68,7 +69,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
}
if(!strcmp(j->data, dp->name)) {
/* conflict */
- _alpm_log(PM_LOG_DEBUG, "targs vs db: found %s as a conflict for %s",
+ _alpm_log(PM_LOG_DEBUG, _("targs vs db: found %s as a conflict for %s"),
dp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -82,7 +83,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
for(m = dp->provides; m; m = m->next) {
if(!strcmp(m->data, j->data)) {
/* confict */
- _alpm_log(PM_LOG_DEBUG, "targs vs db: found %s as a conflict for %s",
+ _alpm_log(PM_LOG_DEBUG, _("targs vs db: found %s as a conflict for %s"),
dp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -95,7 +96,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
}
}
/* CHECK 2: check targets against targets */
- _alpm_log(PM_LOG_DEBUG, "checkconflicts: targ '%s' vs targs", tp->name);
+ _alpm_log(PM_LOG_DEBUG, _("checkconflicts: targ '%s' vs targs"), tp->name);
for(k = packages; k; k = k->next) {
pmpkg_t *otp = (pmpkg_t *)k->data;
if(!strcmp(otp->name, tp->name)) {
@@ -104,7 +105,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
}
if(!strcmp(otp->name, (char *)j->data)) {
/* otp is listed in tp's conflict list */
- _alpm_log(PM_LOG_DEBUG, "targs vs targs: found %s as a conflict for %s",
+ _alpm_log(PM_LOG_DEBUG, _("targs vs targs: found %s as a conflict for %s"),
otp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -117,7 +118,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
PMList *m;
for(m = otp->provides; m; m = m->next) {
if(!strcmp(m->data, j->data)) {
- _alpm_log(PM_LOG_DEBUG, "targs vs targs: found %s as a conflict for %s",
+ _alpm_log(PM_LOG_DEBUG, _("targs vs targs: found %s as a conflict for %s"),
otp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -131,7 +132,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
}
}
/* CHECK 3: check database against targets */
- _alpm_log(PM_LOG_DEBUG, "checkconflicts: db vs targ '%s'", tp->name);
+ _alpm_log(PM_LOG_DEBUG, _("checkconflicts: db vs targ '%s'"), tp->name);
for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
PMList *conflicts = NULL;
int usenewconflicts = 0;
@@ -158,7 +159,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
}
for(j = conflicts; j; j = j->next) {
if(!strcmp((char *)j->data, tp->name)) {
- _alpm_log(PM_LOG_DEBUG, "db vs targs: found %s as a conflict for %s",
+ _alpm_log(PM_LOG_DEBUG, _("db vs targs: found %s as a conflict for %s"),
info->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -173,7 +174,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
PMList *n;
for(n = tp->provides; n; n = n->next) {
if(!strcmp(m->data, n->data)) {
- _alpm_log(PM_LOG_DEBUG, "db vs targs: found %s as a conflict for %s",
+ _alpm_log(PM_LOG_DEBUG, _("db vs targs: found %s as a conflict for %s"),
info->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -222,7 +223,7 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList
if(_alpm_list_is_strin(filestr, p2->files)) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes",
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
sizeof(pmconflict_t));
continue;
}
@@ -269,7 +270,7 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList
dbpkg = _alpm_db_get_pkgfromcache(db, p->name);
}
if(dbpkg && !(dbpkg->infolevel & INFRQ_FILES)) {
- _alpm_log(PM_LOG_DEBUG, "loading FILES info for '%s'", dbpkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg->name);
_alpm_db_read(db, INFRQ_FILES, dbpkg);
}
if(dbpkg && _alpm_list_is_strin(j->data, dbpkg->files)) {
@@ -299,7 +300,7 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList
pmpkg_t *dbpkg2 = NULL;
dbpkg2 = _alpm_db_get_pkgfromcache(db, p1->name);
if(dbpkg2 && !(dbpkg2->infolevel & INFRQ_FILES)) {
- _alpm_log(PM_LOG_DEBUG, "loading FILES info for '%s'", dbpkg2->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg2->name);
_alpm_db_read(db, INFRQ_FILES, dbpkg2);
}
/* If it used to exist in there, but doesn't anymore */
@@ -331,7 +332,7 @@ donecheck:
if(!ok) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes",
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
sizeof(pmconflict_t));
continue;
}
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index ad50977c..0bdbbf73 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
@@ -43,14 +44,14 @@ pmdb_t *_alpm_db_new(char *root, char* dbpath, char *treename)
db = (pmdb_t *)malloc(sizeof(pmdb_t));
if(db == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failed: could not allocate %d bytes",
+ _alpm_log(PM_LOG_ERROR, _("malloc failed: could not allocate %d bytes"),
sizeof(pmdb_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
db->path = (char *)malloc(strlen(root)+strlen(dbpath)+strlen(treename)+2);
if(db->path == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failed: could not allocate %d bytes",
+ _alpm_log(PM_LOG_ERROR, _("malloc failed: could not allocate %d bytes"),
strlen(root)+strlen(dbpath)+strlen(treename)+2);
FREE(db);
RET_ERR(PM_ERR_MEMORY, NULL);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 2cd9e40f..3b4ea1d9 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
/* pacman */
#include "util.h"
#include "log.h"
@@ -44,7 +45,7 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsign
miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t));
if(miss == 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));
RET_ERR(PM_ERR_MEMORY, NULL);
}
@@ -112,7 +113,7 @@ PMList *_alpm_sortbydeps(PMList *targets, int mode)
PMList *tmptargs = NULL;
change = 0;
if(numscans > numtargs) {
- _alpm_log(PM_LOG_WARNING, "possible dependency cycle detected");
+ _alpm_log(PM_LOG_WARNING, _("possible dependency cycle detected"));
continue;
}
numscans++;
@@ -239,7 +240,7 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
FREE(ver);
}
if(!found) {
- _alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as required by %s", depend.name, p->name);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), depend.name, p->name);
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = _alpm_list_add(baddeps, miss);
@@ -349,7 +350,7 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
}
/* else if still not found... */
if(!found) {
- _alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as a dependency for %s",
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"),
depend.name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -370,7 +371,7 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(j = tp->requiredby; j; j = j->next) {
if(!_alpm_list_is_strin((char *)j->data, packages)) {
- _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"), (char *)j->data, 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);
@@ -457,12 +458,12 @@ PMList *_alpm_removedeps(pmdb_t *db, PMList *targs)
/* package not found... look for a provisio instead */
k = _alpm_db_whatprovides(db, depend.name);
if(k == NULL) {
- _alpm_log(PM_LOG_WARNING, "cannot find package \"%s\" or anything that provides it!", depend.name);
+ _alpm_log(PM_LOG_WARNING, _("cannot find package \"%s\" or anything that provides it!"), depend.name);
continue;
}
dep = _alpm_db_get_pkgfromcache(db, ((pmpkg_t *)k->data)->name);
if(dep == NULL) {
- _alpm_log(PM_LOG_ERROR, "dep is NULL!");
+ _alpm_log(PM_LOG_ERROR, _("dep is NULL!"));
/* wtf */
continue;
}
@@ -474,7 +475,7 @@ PMList *_alpm_removedeps(pmdb_t *db, PMList *targs)
/* see if it was explicitly installed */
if(dep->reason == PM_PKG_REASON_EXPLICIT) {
- _alpm_log(PM_LOG_FLOW2, "excluding %s -- explicitly installed", dep->name);
+ _alpm_log(PM_LOG_FLOW2, _("excluding %s -- explicitly installed"), dep->name);
needed = 1;
}
@@ -491,10 +492,10 @@ PMList *_alpm_removedeps(pmdb_t *db, PMList *targs)
continue;
}
/* add it to the target list */
- _alpm_log(PM_LOG_DEBUG, "loading ALL info for '%s'", pkg->name);
+ _alpm_log(PM_LOG_DEBUG, _("loading ALL info for '%s'"), pkg->name);
_alpm_db_read(db, INFRQ_ALL, pkg);
newtargs = _alpm_list_add(newtargs, pkg);
- _alpm_log(PM_LOG_FLOW2, "adding '%s' to the targets", pkg->name);
+ _alpm_log(PM_LOG_FLOW2, _("adding '%s' to the targets"), pkg->name);
newtargs = _alpm_removedeps(db, newtargs);
}
}
@@ -536,7 +537,7 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
for(j = list; j && !found; j = j->next) {
pmpkg_t *sp = (pmpkg_t *)j->data;
if(_alpm_list_is_strin(miss->depend.name, sp->provides)) {
- _alpm_log(PM_LOG_DEBUG, "%s provides dependency %s -- skipping",
+ _alpm_log(PM_LOG_DEBUG, _("%s provides dependency %s -- skipping"),
sp->name, miss->depend.name);
found = 1;
}
@@ -560,11 +561,11 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
FREELISTPTR(provides);
}
if(sync == NULL) {
- _alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)",
+ _alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)"),
miss->target, miss->depend.name);
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;
goto error;
@@ -577,7 +578,7 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
}
if(_alpm_pkg_isin(sync->name, list)) {
/* this dep is already in the target list */
- _alpm_log(PM_LOG_DEBUG, "dependency %s is already in the target list -- skipping",
+ _alpm_log(PM_LOG_DEBUG, _("dependency %s is already in the target list -- skipping"),
sync->name);
continue;
}
@@ -597,14 +598,14 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
if(_alpm_resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
goto error;
}
- _alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
+ _alpm_log(PM_LOG_DEBUG, _("pulling dependency %s (needed by %s)"),
sync->name, syncpkg->name);
list = _alpm_list_add(list, sync);
} else {
- _alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target);
+ _alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\""), miss->target);
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;
goto error;
@@ -617,7 +618,7 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
}
} else {
/* cycle detected -- skip it */
- _alpm_log(PM_LOG_DEBUG, "dependency cycle detected: %s", sync->name);
+ _alpm_log(PM_LOG_DEBUG, _("dependency cycle detected: %s"), sync->name);
}
}
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 336b7152..24ca7476 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include <libintl.h>
+#include "util.h"
#include "alpm.h"
char *alpm_strerror(int err)
@@ -26,91 +28,91 @@ char *alpm_strerror(int err)
switch(err) {
/* System */
case PM_ERR_MEMORY:
- return "out of memory!";
+ return _("out of memory!");
case PM_ERR_SYSTEM:
- return "unexpected error";
+ return _("unexpected error");
case PM_ERR_BADPERMS:
- return "insufficient privileges";
+ return _("insufficient privileges");
case PM_ERR_WRONG_ARGS:
- return "wrong or NULL argument passed";
+ return _("wrong or NULL argument passed");
case PM_ERR_NOT_A_FILE:
- return "could not find or read file";
+ return _("could not find or read file");
/* Interface */
case PM_ERR_HANDLE_NULL:
- return "library not initialized";
+ return _("library not initialized");
case PM_ERR_HANDLE_NOT_NULL:
- return "library already initialized";
+ return _("library already initialized");
case PM_ERR_HANDLE_LOCK:
- return "unable to lock database";
+ return _("unable to lock database");
/* Databases */
case PM_ERR_DB_OPEN:
- return "could not open database";
+ return _("could not open database");
case PM_ERR_DB_CREATE:
- return "could not create database";
+ return _("could not create database");
case PM_ERR_DB_NULL:
- return "database not initialized";
+ return _("database not initialized");
case PM_ERR_DB_NOT_NULL:
- return "database already registered";
+ return _("database already registered");
case PM_ERR_DB_NOT_FOUND:
- return "could not find database";
+ return _("could not find database");
case PM_ERR_DB_WRITE:
- return "could not update database";
+ return _("could not update database");
case PM_ERR_DB_REMOVE:
- return "could not remove database entry";
+ return _("could not remove database entry");
/* Configuration */
case PM_ERR_OPT_LOGFILE:
case PM_ERR_OPT_DBPATH:
case PM_ERR_OPT_LOCALDB:
case PM_ERR_OPT_SYNCDB:
case PM_ERR_OPT_USESYSLOG:
- return "could not set parameter";
+ return _("could not set parameter");
/* Transactions */
case PM_ERR_TRANS_NULL:
- return "transaction not initialized";
+ return _("transaction not initialized");
case PM_ERR_TRANS_NOT_NULL:
- return "transaction already initialized";
+ return _("transaction already initialized");
case PM_ERR_TRANS_DUP_TARGET:
- return "duplicate target";
+ return _("duplicate target");
case PM_ERR_TRANS_NOT_INITIALIZED:
- return "transaction not initialized";
+ return _("transaction not initialized");
case PM_ERR_TRANS_NOT_PREPARED:
- return "transaction not prepared";
+ return _("transaction not prepared");
case PM_ERR_TRANS_ABORT:
- return "transaction aborted";
+ return _("transaction aborted");
case PM_ERR_TRANS_TYPE:
- return "operation not compatible with the transaction type";
+ return _("operation not compatible with the transaction type");
/* Packages */
case PM_ERR_PKG_NOT_FOUND:
- return "could not find or read package";
+ return _("could not find or read package");
case PM_ERR_PKG_INVALID:
- return "invalid or corrupted package";
+ return _("invalid or corrupted package");
case PM_ERR_PKG_OPEN:
- return "cannot open package file";
+ return _("cannot open package file");
case PM_ERR_PKG_LOAD:
- return "cannot load package data";
+ return _("cannot load package data");
case PM_ERR_PKG_INSTALLED:
- return "package already installed";
+ return _("package already installed");
case PM_ERR_PKG_CANT_FRESH:
- return "package not installed or lesser version";
+ return _("package not installed or lesser version");
case PM_ERR_PKG_INVALID_NAME:
- return "package name is not valid";
+ return _("package name is not valid");
/* Groups */
case PM_ERR_GRP_NOT_FOUND:
- return "group not found";
+ return _("group not found");
/* Dependencies */
case PM_ERR_UNSATISFIED_DEPS:
- return "could not satisfy dependencies";
+ return _("could not satisfy dependencies");
case PM_ERR_CONFLICTING_DEPS:
- return "conflicting dependencies";
+ return _("conflicting dependencies");
case PM_ERR_FILE_CONFLICTS:
- return "conflicting files";
+ return _("conflicting files");
/* Miscellaenous */
case PM_ERR_USER_ABORT:
- return "user aborted";
+ return _("user aborted");
case PM_ERR_INTERNAL_ERROR:
- return "internal error";
+ return _("internal error");
default:
- return "unexpected error";
+ return _("unexpected error");
}
}
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index af769575..4df56484 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
/* pacman */
#include "util.h"
#include "error.h"
@@ -36,7 +37,7 @@ pmgrp_t *_alpm_grp_new()
grp = (pmgrp_t *)malloc(sizeof(pmgrp_t));
if(grp == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes",
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
sizeof(pmgrp_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 5300fa13..9c5d971b 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <stdarg.h>
#include <syslog.h>
+#include <libintl.h>
/* pacman */
#include "util.h"
#include "log.h"
@@ -46,7 +47,7 @@ pmhandle_t *handle_new()
handle = (pmhandle_t *)malloc(sizeof(pmhandle_t));
if(handle == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmhandle_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmhandle_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
@@ -123,14 +124,14 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
FREE(handle->dbpath);
}
handle->dbpath = strdup((data && strlen((char *)data) != 0) ? (char *)data : PM_DBPATH);
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_DBPATH set to '%s'", handle->dbpath);
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_DBPATH set to '%s'"), handle->dbpath);
break;
case PM_OPT_CACHEDIR:
if(handle->cachedir) {
FREE(handle->cachedir);
}
handle->cachedir = strdup((data && strlen((char *)data) != 0) ? (char *)data : PM_CACHEDIR);
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_CACHEDIR set to '%s'", handle->cachedir);
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_CACHEDIR set to '%s'"), handle->cachedir);
break;
case PM_OPT_LOGFILE:
if((char *)data == NULL || handle->uid != 0) {
@@ -147,37 +148,37 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
handle->logfd = NULL;
}
if((handle->logfd = fopen((char *)data, "a")) == NULL) {
- _alpm_log(PM_LOG_ERROR, "can't open log file %s", (char *)data);
+ _alpm_log(PM_LOG_ERROR, _("can't open log file %s"), (char *)data);
RET_ERR(PM_ERR_OPT_LOGFILE, -1);
}
handle->logfile = strdup((char *)data);
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_LOGFILE set to '%s'", (char *)data);
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_LOGFILE set to '%s'"), (char *)data);
break;
case PM_OPT_NOUPGRADE:
if((char *)data && strlen((char *)data) != 0) {
handle->noupgrade = _alpm_list_add(handle->noupgrade, strdup((char *)data));
- _alpm_log(PM_LOG_FLOW2, "'%s' added to PM_OPT_NOUPGRADE", (char *)data);
+ _alpm_log(PM_LOG_FLOW2, _("'%s' added to PM_OPT_NOUPGRADE"), (char *)data);
} else {
FREELIST(handle->noupgrade);
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_NOUPGRADE flushed");
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_NOUPGRADE flushed"));
}
break;
case PM_OPT_NOEXTRACT:
if((char *)data && strlen((char *)data) != 0) {
handle->noextract = _alpm_list_add(handle->noextract, strdup((char *)data));
- _alpm_log(PM_LOG_FLOW2, "'%s' added to PM_OPT_NOEXTRACT", (char *)data);
+ _alpm_log(PM_LOG_FLOW2, _("'%s' added to PM_OPT_NOEXTRACT"), (char *)data);
} else {
FREELIST(handle->noextract);
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_NOEXTRACT flushed");
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_NOEXTRACT flushed"));
}
break;
case PM_OPT_IGNOREPKG:
if((char *)data && strlen((char *)data) != 0) {
handle->ignorepkg = _alpm_list_add(handle->ignorepkg, strdup((char *)data));
- _alpm_log(PM_LOG_FLOW2, "'%s' added to PM_OPT_IGNOREPKG", (char *)data);
+ _alpm_log(PM_LOG_FLOW2, _("'%s' added to PM_OPT_IGNOREPKG"), (char *)data);
} else {
FREELIST(handle->ignorepkg);
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_IGNOREPKG flushed");
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_IGNOREPKG flushed"));
}
break;
case PM_OPT_USESYSLOG:
@@ -193,14 +194,14 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
openlog("alpm", 0, LOG_USER);
}
handle->usesyslog = (unsigned short)data;
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_USESYSLOG set to '%d'", handle->usesyslog);
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_USESYSLOG set to '%d'"), handle->usesyslog);
break;
case PM_OPT_LOGCB:
pm_logcb = (alpm_cb_log)data;
break;
case PM_OPT_LOGMASK:
pm_logmask = (unsigned char)data;
- _alpm_log(PM_LOG_FLOW2, "PM_OPT_LOGMASK set to '%02x'", (unsigned char)data);
+ _alpm_log(PM_LOG_FLOW2, _("PM_OPT_LOGMASK set to '%02x'"), (unsigned char)data);
break;
default:
RET_ERR(PM_ERR_WRONG_ARGS, -1);
diff --git a/lib/libalpm/md5driver.c b/lib/libalpm/md5driver.c
index 30b37051..b6ebfa83 100644
--- a/lib/libalpm/md5driver.c
+++ b/lib/libalpm/md5driver.c
@@ -23,6 +23,8 @@ documentation and/or software.
#include <stdio.h>
#include <time.h>
#include <string.h>
+#include <libintl.h>
+#include "util.h"
#include "md5.h"
/* Length of test block, number of test blocks.
@@ -43,7 +45,7 @@ char* MDFile(char *filename)
unsigned char buffer[1024], digest[16];
if((file = fopen(filename, "rb")) == NULL) {
- printf ("%s can't be opened\n", filename);
+ printf (_("%s can't be opened\n"), filename);
} else {
char *ret;
int i;
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index ab654aee..277b3946 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -25,6 +25,7 @@
#include <limits.h>
#include <fcntl.h>
#include <string.h>
+#include <libintl.h>
#include <libtar.h>
#include <zlib.h>
/* pacman */
@@ -89,7 +90,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg = (pmpkg_t *)malloc(sizeof(pmpkg_t));
if(newpkg == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmpkg_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmpkg_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
@@ -169,7 +170,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
int linenum = 0;
if((fp = fopen(descfile, "r")) == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not open file %s", descfile);
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s"), descfile);
return(-1);
}
@@ -186,7 +187,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
ptr = line;
key = strsep(&ptr, "=");
if(key == NULL || ptr == NULL) {
- _alpm_log(PM_LOG_ERROR, "%s: syntax error in description file line %d",
+ _alpm_log(PM_LOG_ERROR, _("%s: syntax error in description file line %d"),
info->name[0] != '\0' ? info->name : "error", linenum);
} else {
_alpm_strtrim(key);
@@ -227,7 +228,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
} else if(!strcmp(key, "BACKUP")) {
info->backup = _alpm_list_add(info->backup, strdup(ptr));
} else {
- _alpm_log(PM_LOG_ERROR, "%s: syntax error in description file line %d",
+ _alpm_log(PM_LOG_ERROR, _("%s: syntax error in description file line %d"),
info->name[0] != '\0' ? info->name : "error", linenum);
}
}
@@ -287,7 +288,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
tar_extract_file(tar, descfile);
/* parse the info file */
if(parse_descfile(descfile, info, 0) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not parse the package description file");
+ _alpm_log(PM_LOG_ERROR, _("could not parse the package description file"));
pm_errno = PM_ERR_PKG_INVALID;
unlink(descfile);
FREE(descfile);
@@ -327,7 +328,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
FREE(str);
fclose(fp);
if(unlink(fn)) {
- _alpm_log(PM_LOG_WARNING, "could not remove tempfile %s", fn);
+ _alpm_log(PM_LOG_WARNING, _("could not remove tempfile %s"), fn);
}
FREE(fn);
close(fd);
@@ -344,7 +345,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
}
if(TH_ISREG(tar) && tar_skip_regfile(tar)) {
- _alpm_log(PM_LOG_ERROR, "bad package file in %s", pkgfile);
+ _alpm_log(PM_LOG_ERROR, _("bad package file in %s"), pkgfile);
goto error;
}
expath = NULL;
@@ -353,7 +354,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
tar = NULL;
if(!config) {
- _alpm_log(PM_LOG_ERROR, "missing package info file in %s", pkgfile);
+ _alpm_log(PM_LOG_ERROR, _("missing package info file in %s"), pkgfile);
goto error;
}
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index f8afa3a1..f675eda1 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <limits.h>
#include <zlib.h>
+#include <libintl.h>
#include <libtar.h>
/* pacman */
#include "util.h"
@@ -59,11 +60,11 @@ 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);
+ _alpm_log(PM_LOG_ERROR, _("could not find %s in database"), name);
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
- _alpm_log(PM_LOG_FLOW2, "adding %s in the targets list", info->name);
+ _alpm_log(PM_LOG_FLOW2, _("adding %s in the targets list"), info->name);
trans->packages = _alpm_list_add(trans->packages, info);
return(0);
@@ -79,7 +80,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
if(!(trans->flags & (PM_TRANS_FLAG_NODEPS)) && (trans->type != PM_TRANS_TYPE_UPGRADE)) {
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
- _alpm_log(PM_LOG_FLOW1, "looking for unsatisfied dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("looking for unsatisfied dependencies"));
lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) {
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
@@ -89,10 +90,10 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
pmpkg_t *info = _alpm_db_scan(db, miss->depend.name, INFRQ_ALL);
if(info) {
- _alpm_log(PM_LOG_FLOW2, "pulling %s in the targets list", info->name);
+ _alpm_log(PM_LOG_FLOW2, _("pulling %s in the targets list"), info->name);
trans->packages = _alpm_list_add(trans->packages, info);
} else {
- _alpm_log(PM_LOG_ERROR, "could not find %s in database -- skipping",
+ _alpm_log(PM_LOG_ERROR, _("could not find %s in database -- skipping"),
miss->depend.name);
}
}
@@ -110,12 +111,12 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
}
if(trans->flags & PM_TRANS_FLAG_RECURSE) {
- _alpm_log(PM_LOG_FLOW1, "finding removable dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("finding removable dependencies"));
trans->packages = _alpm_removedeps(db, trans->packages);
}
/* re-order w.r.t. dependencies */
- _alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
+ _alpm_log(PM_LOG_FLOW1, _("sorting by dependencies"));
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
/* free the old alltargs */
FREELISTPTR(trans->packages);
@@ -150,7 +151,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
- _alpm_log(PM_LOG_FLOW1, "removing package %s-%s", info->name, info->version);
+ _alpm_log(PM_LOG_FLOW1, _("removing package %s-%s"), info->name, info->version);
/* run the pre-remove scriptlet if it exists */
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
@@ -160,7 +161,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
}
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
- _alpm_log(PM_LOG_FLOW1, "removing files");
+ _alpm_log(PM_LOG_FLOW1, _("removing files"));
/* iterate through the list backwards, unlinking files */
for(lp = _alpm_list_last(info->files); lp; lp = lp->prev) {
@@ -179,15 +180,15 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
}
snprintf(line, PATH_MAX, "%s%s", handle->root, file);
if(lstat(line, &buf)) {
- _alpm_log(PM_LOG_DEBUG, "file %s does not exist", file);
+ _alpm_log(PM_LOG_DEBUG, _("file %s does not exist"), file);
continue;
}
if(S_ISDIR(buf.st_mode)) {
if(rmdir(line)) {
/* this is okay, other packages are probably using it. */
- _alpm_log(PM_LOG_DEBUG, "keeping directory %s", file);
+ _alpm_log(PM_LOG_DEBUG, _("keeping directory %s"), file);
} else {
- _alpm_log(PM_LOG_FLOW2, "removing directory %s", file);
+ _alpm_log(PM_LOG_FLOW2, _("removing directory %s"), file);
}
} else {
/* check the "skip list" before removing the file.
@@ -201,7 +202,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
}
}
if(skipit) {
- _alpm_log(PM_LOG_FLOW2, "skipping removal of %s as it has moved to another package",
+ _alpm_log(PM_LOG_FLOW2, _("skipping removal of %s as it has moved to another package"),
file);
} else {
/* if the file is flagged, back it up to .pacsave */
@@ -213,19 +214,19 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
char newpath[PATH_MAX];
snprintf(newpath, PATH_MAX, "%s.pacsave", line);
rename(line, newpath);
- _alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath);
- alpm_logaction("%s saved as %s", line, newpath);
+ _alpm_log(PM_LOG_WARNING, _("%s saved as %s"), file, newpath);
+ alpm_logaction(_("%s saved as %s"), line, newpath);
} else {
- _alpm_log(PM_LOG_FLOW2, "unlinking %s", file);
+ _alpm_log(PM_LOG_FLOW2, _("unlinking %s"), file);
if(unlink(line)) {
- _alpm_log(PM_LOG_ERROR, "cannot remove file %s", file);
+ _alpm_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
}
}
}
} else {
- _alpm_log(PM_LOG_FLOW2, "unlinking %s", file);
+ _alpm_log(PM_LOG_FLOW2, _("unlinking %s"), file);
if(unlink(line)) {
- _alpm_log(PM_LOG_ERROR, "cannot remove file %s", file);
+ _alpm_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
}
}
}
@@ -243,17 +244,17 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
}
/* remove the package from the database */
- _alpm_log(PM_LOG_FLOW1, "updating database");
- _alpm_log(PM_LOG_FLOW2, "removing database entry '%s'", info->name);
+ _alpm_log(PM_LOG_FLOW1, _("updating database"));
+ _alpm_log(PM_LOG_FLOW2, _("removing database entry '%s'"), info->name);
if(_alpm_db_remove(db, info) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not remove database entry %s-%s", info->name, info->version);
+ _alpm_log(PM_LOG_ERROR, _("could not remove database entry %s-%s"), info->name, info->version);
}
if(_alpm_db_remove_pkgfromcache(db, info) == -1) {
- _alpm_log(PM_LOG_ERROR, "could not remove entry '%s' from cache", info->name);
+ _alpm_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache"), info->name);
}
/* update dependency packages' REQUIREDBY fields */
- _alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields");
+ _alpm_log(PM_LOG_FLOW2, _("updating dependency packages 'requiredby' fields"));
for(lp = info->depends; lp; lp = lp->next) {
pmpkg_t *depinfo = NULL;
pmdepend_t depend;
@@ -281,7 +282,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
FREELISTPTR(provides);
}
if(depinfo == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not find dependency '%s'", depend.name);
+ _alpm_log(PM_LOG_ERROR, _("could not find dependency '%s'"), depend.name);
/* wtf */
continue;
}
@@ -289,9 +290,9 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* splice out this entry from requiredby */
depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, (void **)&data);
FREE(data);
- _alpm_log(PM_LOG_DEBUG, "updating 'requiredby' field for package '%s'", depinfo->name);
+ _alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), depinfo->name);
if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) {
- _alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
+ _alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"),
depinfo->name, depinfo->version);
}
}
@@ -303,7 +304,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* run ldconfig if it exists */
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
- _alpm_log(PM_LOG_FLOW1, "running \"ldconfig -r %s\"", handle->root);
+ _alpm_log(PM_LOG_FLOW1, _("running \"ldconfig -r %s\""), handle->root);
_alpm_ldconfig(handle->root);
}
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);
}
}
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index ba1f2337..b0995fe4 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
/* pacman */
#include "error.h"
#include "package.h"
@@ -42,7 +43,7 @@ pmtrans_t *_alpm_trans_new()
pmtrans_t *trans;
if((trans = (pmtrans_t *)malloc(sizeof(pmtrans_t))) == NULL) {
- _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmtrans_t));
+ _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmtrans_t));
return(NULL);
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 49580c36..f85f5ce3 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -32,6 +32,7 @@
#include <time.h>
#include <syslog.h>
#include <sys/wait.h>
+#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
@@ -223,7 +224,7 @@ int _alpm_unpack(char *archive, const char *prefix, const char *fn)
while(!th_read(tar)) {
if(fn && strcmp(fn, th_get_pathname(tar))) {
if(TH_ISREG(tar) && tar_skip_regfile(tar)) {
- _alpm_log(PM_LOG_ERROR, "bad tar archive: %s", archive);
+ _alpm_log(PM_LOG_ERROR, _("bad tar archive: %s"), archive);
tar_close(tar);
return(1);
}
@@ -231,7 +232,7 @@ int _alpm_unpack(char *archive, const char *prefix, const char *fn)
}
snprintf(expath, PATH_MAX, "%s/%s", prefix, th_get_pathname(tar));
if(tar_extract_file(tar, expath)) {
- _alpm_log(PM_LOG_ERROR, "could not extract %s (%s)", th_get_pathname(tar), strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), th_get_pathname(tar), strerror(errno));
}
if(fn) break;
}
@@ -379,7 +380,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
}
snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root);
if(mkdtemp(tmpdir) == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not create temp directory");
+ _alpm_log(PM_LOG_ERROR, _("could not create temp directory"));
return(1);
}
_alpm_unpack(installfn, tmpdir, ".INSTALL");
@@ -399,17 +400,17 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
/* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) {
- _alpm_log(PM_LOG_ERROR, "could not get current working directory");
+ _alpm_log(PM_LOG_ERROR, _("could not get current working directory"));
/* in case of error, cwd content is undefined: so we set it to something */
cwd[0] = 0;
}
/* just in case our cwd was removed in the upgrade operation */
if(chdir(root) != 0) {
- _alpm_log(PM_LOG_ERROR, "could not change directory to %s (%s)", root, strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)"), root, strerror(errno));
}
- _alpm_log(PM_LOG_FLOW2, "executing %s script...", script);
+ _alpm_log(PM_LOG_FLOW2, _("executing %s script..."), script);
if(oldver) {
snprintf(cmdline, PATH_MAX, "source %s %s %s %s",
@@ -422,28 +423,28 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
pid = fork();
if(pid == -1) {
- _alpm_log(PM_LOG_ERROR, "could not fork a new process (%s)", strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not fork a new process (%s)"), strerror(errno));
retval = 1;
goto cleanup;
}
if(pid == 0) {
- _alpm_log(PM_LOG_DEBUG, "chrooting in %s", root);
+ _alpm_log(PM_LOG_DEBUG, _("chrooting in %s"), root);
if(chroot(root) != 0) {
- _alpm_log(PM_LOG_ERROR, "could not change the root directory (%s)", strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not change the root directory (%s)"), strerror(errno));
return(1);
}
if(chdir("/") != 0) {
- _alpm_log(PM_LOG_ERROR, "could not change directory to / (%s)", strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("could not change directory to / (%s)"), strerror(errno));
return(1);
}
umask(0022);
- _alpm_log(PM_LOG_DEBUG, "executing \"%s\"", cmdline);
+ _alpm_log(PM_LOG_DEBUG, _("executing \"%s\""), cmdline);
execl("/bin/sh", "sh", "-c", cmdline, (char *)0);
exit(0);
} else {
if(waitpid(pid, 0, 0) == -1) {
- _alpm_log(PM_LOG_ERROR, "call to waitpid failed (%s)", strerror(errno));
+ _alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"), strerror(errno));
retval = 1;
goto cleanup;
}
@@ -451,7 +452,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
cleanup:
if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) {
- _alpm_log(PM_LOG_WARNING, "could not remove tmpdir %s", tmpdir);
+ _alpm_log(PM_LOG_WARNING, _("could not remove tmpdir %s"), tmpdir);
}
if(strlen(cwd)) {
chdir(cwd);
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 7b24961c..af8162b2 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -32,6 +32,8 @@
s1[(len)-1] = 0; \
} while(0)
+#define _(str) dgettext("libalpm", str)
+
long _alpm_gzopen_frontend(char *pathname, int oflags, int mode);
int _alpm_makepath(char *path);
int _alpm_copyfile(char *src, char *dest);