Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c119
1 files changed, 60 insertions, 59 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);