1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

first stage of i18n stuff from VMiklos

This commit is contained in:
Judd Vinet 2006-05-15 02:19:57 +00:00
parent 3d3a29a808
commit bb787e26ee
31 changed files with 629 additions and 592 deletions

View File

@ -27,6 +27,7 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <zlib.h> #include <zlib.h>
#include <libintl.h>
#include <libtar.h> #include <libtar.h>
/* pacman */ /* pacman */
#include "util.h" #include "util.h"
@ -81,7 +82,7 @@ static int add_faketarget(pmtrans_t *trans, char *name)
} else if(strncmp("depend", p, q-p) == 0) { } else if(strncmp("depend", p, q-p) == 0) {
dummy->depends = _alpm_list_add(dummy->depends, strdup(q+1)); dummy->depends = _alpm_list_add(dummy->depends, strdup(q+1));
} else { } 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); FREE(str);
@ -113,7 +114,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
return(add_faketarget(trans, 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)) { if(stat(name, &buf)) {
pm_errno = PM_ERR_NOT_A_FILE; 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(strcmp(pkg->name, pkgname) == 0) {
if(_alpm_versioncmp(pkg->version, pkgver) < 0) { if(_alpm_versioncmp(pkg->version, pkgver) < 0) {
pmpkg_t *newpkg; 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); pkg->name, pkg->version, pkgver);
if((newpkg = _alpm_pkg_load(name)) == NULL) { if((newpkg = _alpm_pkg_load(name)) == NULL) {
/* pm_errno is already set by pkg_load() */ /* 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); FREEPKG(i->data);
i->data = newpkg; i->data = newpkg;
} else { } 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); pkg->name, pkg->version, pkgver);
} }
return(0); 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); info = _alpm_pkg_load(name);
if(info == NULL) { if(info == NULL) {
/* pm_errno is already set by pkg_load() */ /* 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); EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
/* look for unsatisfied dependencies */ /* 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); lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) { if(lp != NULL) {
if(data) { 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 */ /* 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); lp = _alpm_checkconflicts(db, trans->packages);
if(lp != NULL) { if(lp != NULL) {
if(data) { if(data) {
@ -234,7 +235,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
} }
/* re-order w.r.t. dependencies */ /* 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); lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
/* free the old alltargs */ /* free the old alltargs */
FREELISTPTR(trans->packages); 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); 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); lp = _alpm_db_find_conflicts(db, trans->packages, handle->root, &skiplist);
if(lp != NULL) { if(lp != NULL) {
if(data) { 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); pmpkg_t *local = _alpm_db_get_pkgfromcache(db, info->name);
if(local) { if(local) {
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, info, NULL); 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 */ /* we'll need to save some record for backup checks later */
oldpkg = _alpm_pkg_new(local->name, local->version); oldpkg = _alpm_pkg_new(local->name, local->version);
if(oldpkg) { if(oldpkg) {
if(!(local->infolevel & INFRQ_FILES)) { 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); _alpm_db_read(db, INFRQ_FILES, local);
} }
oldpkg->backup = _alpm_list_strdup(local->backup); 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 */ /* copy over the install reason */
if(!(local->infolevel & INFRQ_DESC)) { 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); _alpm_db_read(db, INFRQ_DESC, local);
} }
info->reason = local->reason; info->reason = local->reason;
@ -332,7 +333,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if(oldpkg) { if(oldpkg) {
pmtrans_t *tr; 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(); tr = _alpm_trans_new();
if(tr == NULL) { if(tr == NULL) {
RET_ERR(PM_ERR_TRANS_ABORT, -1); RET_ERR(PM_ERR_TRANS_ABORT, -1);
@ -361,18 +362,18 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
} }
if(!pmo_upgrade) { if(!pmo_upgrade) {
EVENT(trans, PM_TRANS_EVT_ADD_START, info, NULL); 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 */ /* pre_install scriptlet */
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
_alpm_runscriptlet(handle->root, info->data, "pre_install", info->version, NULL); _alpm_runscriptlet(handle->root, info->data, "pre_install", info->version, NULL);
} }
} else { } 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)) { 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 */ /* Extract the .tar.gz package */
if(tar_open(&tar, info->data, &gztype, O_RDONLY, 0, TAR_GNU) == -1) { 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. * could be used.
*/ */
if(_alpm_list_is_strin(pathname, handle->noextract)) { 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); tar_skip_regfile(tar);
continue; continue;
} }
@ -438,7 +439,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
temp = strdup("/tmp/alpm_XXXXXX"); temp = strdup("/tmp/alpm_XXXXXX");
fd = mkstemp(temp); fd = mkstemp(temp);
if(tar_extract_file(tar, 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++; errors++;
unlink(temp); unlink(temp);
FREE(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, _("checking md5 hashes for %s"), pathname);
_alpm_log(PM_LOG_DEBUG, "current: %s", md5_local); _alpm_log(PM_LOG_DEBUG, _("current: %s"), md5_local);
_alpm_log(PM_LOG_DEBUG, "new: %s", md5_pkg); _alpm_log(PM_LOG_DEBUG, _("new: %s"), md5_pkg);
if(md5_orig) { if(md5_orig) {
_alpm_log(PM_LOG_DEBUG, "original: %s", md5_orig); _alpm_log(PM_LOG_DEBUG, _("original: %s"), md5_orig);
} }
if(!pmo_upgrade) { if(!pmo_upgrade) {
@ -485,16 +486,16 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
char newpath[PATH_MAX]; char newpath[PATH_MAX];
snprintf(newpath, PATH_MAX, "%s.pacorig", expath); snprintf(newpath, PATH_MAX, "%s.pacorig", expath);
if(rename(expath, newpath)) { if(rename(expath, newpath)) {
_alpm_log(PM_LOG_ERROR, "could not rename %s (%s)", pathname, 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)); alpm_logaction(_("error: could not rename %s (%s)"), expath, strerror(errno));
} }
if(_alpm_copyfile(temp, expath)) { 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));
alpm_logaction("error: could not copy %s to %s (%s)", temp, expath, strerror(errno)); alpm_logaction(_("error: could not copy %s to %s (%s)"), temp, expath, strerror(errno));
errors++; errors++;
} else { } else {
_alpm_log(PM_LOG_WARNING, "%s saved as %s.pacorig", pathname, pathname); _alpm_log(PM_LOG_WARNING, _("%s saved as %s.pacorig"), pathname, pathname);
alpm_logaction("warning: %s saved as %s", expath, newpath); alpm_logaction(_("warning: %s saved as %s"), expath, newpath);
} }
} }
} else if(md5_orig) { } else if(md5_orig) {
@ -504,29 +505,29 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
/* the fun part */ /* the fun part */
if(!strcmp(md5_orig, md5_local)) { if(!strcmp(md5_orig, md5_local)) {
if(!strcmp(md5_local, md5_pkg)) { 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; installnew = 1;
} else { } else {
_alpm_log(PM_LOG_DEBUG, "action: installing new file"); _alpm_log(PM_LOG_DEBUG, _("action: installing new file"));
installnew = 1; installnew = 1;
} }
} else if(!strcmp(md5_orig, md5_pkg)) { } 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)) { } 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; installnew = 1;
} else { } 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); strncat(expath, ".pacnew", PATH_MAX);
installnew = 1; installnew = 1;
_alpm_log(PM_LOG_WARNING, "extracting %s as %s.pacnew", pathname, pathname); _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_logaction(_("warning: extracting %s%s as %s"), handle->root, pathname, expath);
} }
if(installnew) { if(installnew) {
_alpm_log(PM_LOG_FLOW2, "extracting %s", pathname); _alpm_log(PM_LOG_FLOW2, _("extracting %s"), pathname);
if(_alpm_copyfile(temp, expath)) { 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++; errors++;
} }
} }
@ -540,12 +541,12 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
close(fd); close(fd);
} else { } else {
if(!notouch) { if(!notouch) {
_alpm_log(PM_LOG_FLOW2, "extracting %s", pathname); _alpm_log(PM_LOG_FLOW2, _("extracting %s"), pathname);
} else { } 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); strncat(expath, ".pacnew", PATH_MAX);
_alpm_log(PM_LOG_WARNING, "extracting %s as %s.pacnew", pathname, pathname); _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_logaction(_("warning: extracting %s%s as %s"), handle->root, pathname, expath);
/*tar_skip_regfile(tar);*/ /*tar_skip_regfile(tar);*/
} }
if(trans->flags & PM_TRANS_FLAG_FORCE) { if(trans->flags & PM_TRANS_FLAG_FORCE) {
@ -557,8 +558,8 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
unlink(expath); unlink(expath);
} }
if(tar_extract_file(tar, expath)) { if(tar_extract_file(tar, expath)) {
_alpm_log(PM_LOG_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)); alpm_logaction(_("error: could not extract %s (%s)"), pathname, strerror(errno));
errors++; errors++;
} }
/* calculate an md5 hash if this is in info->backup */ /* 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(!file) continue;
if(!strcmp(file, pathname)) { 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); snprintf(path, PATH_MAX, "%s%s", handle->root, file);
md5 = MDFile(path); md5 = MDFile(path);
/* 32 for the hash, 1 for the terminating NULL, and 1 for the tab delimiter */ /* 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) { if(errors) {
ret = 1; ret = 1;
_alpm_log(PM_LOG_ERROR, "errors occurred while %s %s", _alpm_log(PM_LOG_ERROR, _("errors occurred while %s %s"),
(pmo_upgrade ? "upgrading" : "installing"), info->name); (pmo_upgrade ? _("upgrading") : _("installing")), info->name);
alpm_logaction("errors occurred while %s %s", alpm_logaction(_("errors occurred while %s %s"),
(pmo_upgrade ? "upgrading" : "installing"), info->name); (pmo_upgrade ? _("upgrading") : _("installing")), info->name);
} }
} }
@ -613,7 +614,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
continue; continue;
} }
if(tmppm->data && !strcmp(depend.name, info->name)) { 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)); 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() */ /* remove the extra line feed appended by asctime() */
info->installdate[strlen(info->installdate)-1] = 0; info->installdate[strlen(info->installdate)-1] = 0;
_alpm_log(PM_LOG_FLOW1, "updating database"); _alpm_log(PM_LOG_FLOW1, _("updating database"));
_alpm_log(PM_LOG_FLOW2, "adding database entry '%s'", info->name); _alpm_log(PM_LOG_FLOW2, _("adding database entry '%s'"), info->name);
if(_alpm_db_write(db, info, INFRQ_ALL)) { 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); 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); RET_ERR(PM_ERR_DB_WRITE, -1);
} }
if(_alpm_db_add_pkgincache(db, info) == -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 */ /* update dependency packages' REQUIREDBY fields */
if(info->depends) { 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) { for(lp = info->depends; lp; lp = lp->next) {
pmpkg_t *depinfo; pmpkg_t *depinfo;
@ -659,15 +660,15 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
FREELISTPTR(provides); FREELISTPTR(provides);
} }
if(depinfo == NULL) { 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 */ /* wtf */
continue; 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)); depinfo->requiredby = _alpm_list_add(depinfo->requiredby, strdup(info->name));
if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) { 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); depinfo->name, depinfo->version);
} }
} }
@ -688,7 +689,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
} }
/* run ldconfig if it exists */ /* 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); _alpm_ldconfig(handle->root);
return(0); return(0);

View File

@ -31,6 +31,7 @@
#include <syslog.h> #include <syslog.h>
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#include <stdarg.h> #include <stdarg.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "log.h" #include "log.h"
#include "error.h" #include "error.h"
@ -189,12 +190,12 @@ pmdb_t *alpm_db_register(char *treename)
RET_ERR(PM_ERR_DB_NOT_NULL, NULL); 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 */ /* make sure the database directory exists */
snprintf(path, PATH_MAX, "%s%s/%s", handle->root, handle->dbpath, treename); snprintf(path, PATH_MAX, "%s%s/%s", handle->root, handle->dbpath, treename);
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) { 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) { if(_alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, NULL); RET_ERR(PM_ERR_SYSTEM, NULL);
} }
@ -205,7 +206,7 @@ pmdb_t *alpm_db_register(char *treename)
return(NULL); 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) { if(_alpm_db_open(db, DB_O_CREATE) == -1) {
_alpm_db_free(db); _alpm_db_free(db);
RET_ERR(PM_ERR_DB_OPEN, NULL); 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); 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 */ /* Cleanup */
_alpm_db_free_pkgcache(db); _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_close(db);
_alpm_db_free(db); _alpm_db_free(db);
@ -304,11 +305,11 @@ int alpm_db_update(PM_DB *db, char *archive)
} }
/* remove the old dir */ /* 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) { for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
if(_alpm_db_remove(db, lp->data) == -1) { if(_alpm_db_remove(db, lp->data) == -1) {
if(lp->data) { 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); ((pmpkg_t *)lp->data)->name);
} }
RET_ERR(PM_ERR_DB_REMOVE, -1); RET_ERR(PM_ERR_DB_REMOVE, -1);
@ -322,7 +323,7 @@ int alpm_db_update(PM_DB *db, char *archive)
/* ORE /* ORE
we should not simply unpack the archive, but better parse it and we should not simply unpack the archive, but better parse it and
db_write each entry (see sync_load_dbarchive to get archive content) */ 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)) { if(_alpm_unpack(archive, db->path, NULL)) {
RET_ERR(PM_ERR_SYSTEM, -1); 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_REASON:
case PM_PKG_MD5SUM: case PM_PKG_MD5SUM:
if(!(pkg->infolevel & INFRQ_DESC)) { 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); _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
} }
break; break;
@ -443,14 +444,14 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_FILES: case PM_PKG_FILES:
case PM_PKG_BACKUP: case PM_PKG_BACKUP:
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_FILES)) { 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); _alpm_db_read(pkg->data, INFRQ_FILES, pkg);
} }
break; break;
/* Scriptlet */ /* Scriptlet */
case PM_PKG_SCRIPLET: case PM_PKG_SCRIPLET:
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_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); _alpm_db_read(pkg->data, INFRQ_SCRIPLET, pkg);
} }
break; break;
@ -545,21 +546,21 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg)
md5sum = MDFile(path); md5sum = MDFile(path);
if(md5sum == NULL) { 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); pkg->name, pkg->version);
pm_errno = PM_ERR_NOT_A_FILE; pm_errno = PM_ERR_NOT_A_FILE;
retval = -1; retval = -1;
} else { } else {
if(!(pkg->infolevel & INFRQ_DESC)) { 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); _alpm_db_read(pkg->data, INFRQ_DESC, pkg);
} }
if(strcmp(md5sum, pkg->md5sum) == 0) { 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); pkg->name, pkg->version);
} else { } 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); pkg->name, pkg->version);
pm_errno = PM_ERR_PKG_INVALID; pm_errno = PM_ERR_PKG_INVALID;
retval = -1; retval = -1;
@ -806,8 +807,8 @@ int alpm_trans_release()
handle->lckfd = -1; handle->lckfd = -1;
} }
if(_alpm_lckrm(PM_LOCK) == -1) { if(_alpm_lckrm(PM_LOCK) == -1) {
_alpm_log(PM_LOG_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); alpm_logaction(_("warning: could not remove lock file %s"), PM_LOCK);
} }
return(0); return(0);

View File

@ -27,6 +27,7 @@
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <libintl.h>
#ifdef CYGWIN #ifdef CYGWIN
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#endif #endif
@ -138,7 +139,7 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq)
return(NULL); return(NULL);
} }
if(_alpm_pkg_splitname(ent->d_name, pkg->name, pkg->version) == -1) { 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); return(NULL);
} }
if(_alpm_db_read(db, inforeq, pkg) == -1) { 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) { if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version); snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) { 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; retval = 1;
goto cleanup; goto cleanup;
} }
@ -446,7 +447,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
if(local && (inforeq & INFRQ_FILES)) { if(local && (inforeq & INFRQ_FILES)) {
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version); snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) { 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; retval = -1;
goto cleanup; goto cleanup;
} }
@ -472,7 +473,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
if(inforeq & INFRQ_DEPENDS) { if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version); snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) { 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; retval = -1;
goto cleanup; goto cleanup;
} }

View File

@ -26,6 +26,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "log.h" #include "log.h"
#include "alpm.h" #include "alpm.h"
@ -51,7 +52,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
_alpm_db_free_pkgcache(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); infolevel, db->treename);
_alpm_db_rewind(db); _alpm_db_rewind(db);
@ -71,7 +72,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
return; 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); db->treename);
FREELISTPKGS(db->pkgcache); FREELISTPKGS(db->pkgcache);
@ -106,7 +107,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
if(newpkg == NULL) { if(newpkg == NULL) {
return(-1); 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); db->pkgcache = _alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
_alpm_db_free_grpcache(db); _alpm_db_free_grpcache(db);
@ -128,7 +129,7 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
return(-1); 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); FREEPKG(data);
_alpm_db_free_grpcache(db); _alpm_db_free_grpcache(db);
@ -159,7 +160,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
_alpm_db_load_pkgcache(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) { for(lp = db->pkgcache; lp; lp = lp->next) {
PMList *i; PMList *i;

View File

@ -25,6 +25,7 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
@ -59,7 +60,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
continue; continue;
} }
/* CHECK 1: check targets against database */ /* 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) { for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
pmpkg_t *dp = (pmpkg_t *)k->data; pmpkg_t *dp = (pmpkg_t *)k->data;
if(!strcmp(dp->name, tp->name)) { if(!strcmp(dp->name, tp->name)) {
@ -68,7 +69,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
} }
if(!strcmp(j->data, dp->name)) { if(!strcmp(j->data, dp->name)) {
/* conflict */ /* 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); dp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { 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) { for(m = dp->provides; m; m = m->next) {
if(!strcmp(m->data, j->data)) { if(!strcmp(m->data, j->data)) {
/* confict */ /* 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); dp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { if(!_alpm_depmiss_isin(miss, baddeps)) {
@ -95,7 +96,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
} }
} }
/* CHECK 2: check targets against targets */ /* 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) { for(k = packages; k; k = k->next) {
pmpkg_t *otp = (pmpkg_t *)k->data; pmpkg_t *otp = (pmpkg_t *)k->data;
if(!strcmp(otp->name, tp->name)) { 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)) { if(!strcmp(otp->name, (char *)j->data)) {
/* otp is listed in tp's conflict list */ /* 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); otp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { if(!_alpm_depmiss_isin(miss, baddeps)) {
@ -117,7 +118,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
PMList *m; PMList *m;
for(m = otp->provides; m; m = m->next) { for(m = otp->provides; m; m = m->next) {
if(!strcmp(m->data, j->data)) { 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); otp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { if(!_alpm_depmiss_isin(miss, baddeps)) {
@ -131,7 +132,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
} }
} }
/* CHECK 3: check database against targets */ /* 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) { for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
PMList *conflicts = NULL; PMList *conflicts = NULL;
int usenewconflicts = 0; int usenewconflicts = 0;
@ -158,7 +159,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
} }
for(j = conflicts; j; j = j->next) { for(j = conflicts; j; j = j->next) {
if(!strcmp((char *)j->data, tp->name)) { 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); info->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { if(!_alpm_depmiss_isin(miss, baddeps)) {
@ -173,7 +174,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
PMList *n; PMList *n;
for(n = tp->provides; n; n = n->next) { for(n = tp->provides; n; n = n->next) {
if(!strcmp(m->data, n->data)) { 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); info->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { 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)) { if(_alpm_list_is_strin(filestr, p2->files)) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t)); pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) { 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)); sizeof(pmconflict_t));
continue; 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); dbpkg = _alpm_db_get_pkgfromcache(db, p->name);
} }
if(dbpkg && !(dbpkg->infolevel & INFRQ_FILES)) { 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); _alpm_db_read(db, INFRQ_FILES, dbpkg);
} }
if(dbpkg && _alpm_list_is_strin(j->data, dbpkg->files)) { 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; pmpkg_t *dbpkg2 = NULL;
dbpkg2 = _alpm_db_get_pkgfromcache(db, p1->name); dbpkg2 = _alpm_db_get_pkgfromcache(db, p1->name);
if(dbpkg2 && !(dbpkg2->infolevel & INFRQ_FILES)) { 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); _alpm_db_read(db, INFRQ_FILES, dbpkg2);
} }
/* If it used to exist in there, but doesn't anymore */ /* If it used to exist in there, but doesn't anymore */
@ -331,7 +332,7 @@ donecheck:
if(!ok) { if(!ok) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t)); pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) { 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)); sizeof(pmconflict_t));
continue; continue;
} }

View File

@ -27,6 +27,7 @@
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <libintl.h>
#ifdef CYGWIN #ifdef CYGWIN
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#endif #endif
@ -43,14 +44,14 @@ pmdb_t *_alpm_db_new(char *root, char* dbpath, char *treename)
db = (pmdb_t *)malloc(sizeof(pmdb_t)); db = (pmdb_t *)malloc(sizeof(pmdb_t));
if(db == NULL) { 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)); sizeof(pmdb_t));
RET_ERR(PM_ERR_MEMORY, NULL); RET_ERR(PM_ERR_MEMORY, NULL);
} }
db->path = (char *)malloc(strlen(root)+strlen(dbpath)+strlen(treename)+2); db->path = (char *)malloc(strlen(root)+strlen(dbpath)+strlen(treename)+2);
if(db->path == NULL) { 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); strlen(root)+strlen(dbpath)+strlen(treename)+2);
FREE(db); FREE(db);
RET_ERR(PM_ERR_MEMORY, NULL); RET_ERR(PM_ERR_MEMORY, NULL);

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "util.h" #include "util.h"
#include "log.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)); miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t));
if(miss == NULL) { 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); RET_ERR(PM_ERR_MEMORY, NULL);
} }
@ -112,7 +113,7 @@ PMList *_alpm_sortbydeps(PMList *targets, int mode)
PMList *tmptargs = NULL; PMList *tmptargs = NULL;
change = 0; change = 0;
if(numscans > numtargs) { if(numscans > numtargs) {
_alpm_log(PM_LOG_WARNING, "possible dependency cycle detected"); _alpm_log(PM_LOG_WARNING, _("possible dependency cycle detected"));
continue; continue;
} }
numscans++; numscans++;
@ -239,7 +240,7 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
FREE(ver); FREE(ver);
} }
if(!found) { 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); miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) { if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = _alpm_list_add(baddeps, miss); 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... */ /* else if still not found... */
if(!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); depend.name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) { 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) { for(j = tp->requiredby; j; j = j->next) {
if(!_alpm_list_is_strin((char *)j->data, packages)) { 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); miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) { if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = _alpm_list_add(baddeps, miss); 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 */ /* package not found... look for a provisio instead */
k = _alpm_db_whatprovides(db, depend.name); k = _alpm_db_whatprovides(db, depend.name);
if(k == NULL) { 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; continue;
} }
dep = _alpm_db_get_pkgfromcache(db, ((pmpkg_t *)k->data)->name); dep = _alpm_db_get_pkgfromcache(db, ((pmpkg_t *)k->data)->name);
if(dep == NULL) { if(dep == NULL) {
_alpm_log(PM_LOG_ERROR, "dep is NULL!"); _alpm_log(PM_LOG_ERROR, _("dep is NULL!"));
/* wtf */ /* wtf */
continue; continue;
} }
@ -474,7 +475,7 @@ PMList *_alpm_removedeps(pmdb_t *db, PMList *targs)
/* see if it was explicitly installed */ /* see if it was explicitly installed */
if(dep->reason == PM_PKG_REASON_EXPLICIT) { 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; needed = 1;
} }
@ -491,10 +492,10 @@ PMList *_alpm_removedeps(pmdb_t *db, PMList *targs)
continue; continue;
} }
/* add it to the target list */ /* 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); _alpm_db_read(db, INFRQ_ALL, pkg);
newtargs = _alpm_list_add(newtargs, 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); 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) { for(j = list; j && !found; j = j->next) {
pmpkg_t *sp = (pmpkg_t *)j->data; pmpkg_t *sp = (pmpkg_t *)j->data;
if(_alpm_list_is_strin(miss->depend.name, sp->provides)) { 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); sp->name, miss->depend.name);
found = 1; found = 1;
} }
@ -560,11 +561,11 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
FREELISTPTR(provides); FREELISTPTR(provides);
} }
if(sync == NULL) { 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); miss->target, miss->depend.name);
if(data) { if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { 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); FREELIST(*data);
pm_errno = PM_ERR_MEMORY; pm_errno = PM_ERR_MEMORY;
goto error; 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)) { if(_alpm_pkg_isin(sync->name, list)) {
/* this dep is already in the target 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); sync->name);
continue; 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)) { if(_alpm_resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
goto error; 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); sync->name, syncpkg->name);
list = _alpm_list_add(list, sync); list = _alpm_list_add(list, sync);
} else { } 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(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { 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); FREELIST(*data);
pm_errno = PM_ERR_MEMORY; pm_errno = PM_ERR_MEMORY;
goto error; goto error;
@ -617,7 +618,7 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList
} }
} else { } else {
/* cycle detected -- skip it */ /* 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);
} }
} }

View File

@ -19,6 +19,8 @@
* USA. * USA.
*/ */
#include <libintl.h>
#include "util.h"
#include "alpm.h" #include "alpm.h"
char *alpm_strerror(int err) char *alpm_strerror(int err)
@ -26,91 +28,91 @@ char *alpm_strerror(int err)
switch(err) { switch(err) {
/* System */ /* System */
case PM_ERR_MEMORY: case PM_ERR_MEMORY:
return "out of memory!"; return _("out of memory!");
case PM_ERR_SYSTEM: case PM_ERR_SYSTEM:
return "unexpected error"; return _("unexpected error");
case PM_ERR_BADPERMS: case PM_ERR_BADPERMS:
return "insufficient privileges"; return _("insufficient privileges");
case PM_ERR_WRONG_ARGS: case PM_ERR_WRONG_ARGS:
return "wrong or NULL argument passed"; return _("wrong or NULL argument passed");
case PM_ERR_NOT_A_FILE: case PM_ERR_NOT_A_FILE:
return "could not find or read file"; return _("could not find or read file");
/* Interface */ /* Interface */
case PM_ERR_HANDLE_NULL: case PM_ERR_HANDLE_NULL:
return "library not initialized"; return _("library not initialized");
case PM_ERR_HANDLE_NOT_NULL: case PM_ERR_HANDLE_NOT_NULL:
return "library already initialized"; return _("library already initialized");
case PM_ERR_HANDLE_LOCK: case PM_ERR_HANDLE_LOCK:
return "unable to lock database"; return _("unable to lock database");
/* Databases */ /* Databases */
case PM_ERR_DB_OPEN: case PM_ERR_DB_OPEN:
return "could not open database"; return _("could not open database");
case PM_ERR_DB_CREATE: case PM_ERR_DB_CREATE:
return "could not create database"; return _("could not create database");
case PM_ERR_DB_NULL: case PM_ERR_DB_NULL:
return "database not initialized"; return _("database not initialized");
case PM_ERR_DB_NOT_NULL: case PM_ERR_DB_NOT_NULL:
return "database already registered"; return _("database already registered");
case PM_ERR_DB_NOT_FOUND: case PM_ERR_DB_NOT_FOUND:
return "could not find database"; return _("could not find database");
case PM_ERR_DB_WRITE: case PM_ERR_DB_WRITE:
return "could not update database"; return _("could not update database");
case PM_ERR_DB_REMOVE: case PM_ERR_DB_REMOVE:
return "could not remove database entry"; return _("could not remove database entry");
/* Configuration */ /* Configuration */
case PM_ERR_OPT_LOGFILE: case PM_ERR_OPT_LOGFILE:
case PM_ERR_OPT_DBPATH: case PM_ERR_OPT_DBPATH:
case PM_ERR_OPT_LOCALDB: case PM_ERR_OPT_LOCALDB:
case PM_ERR_OPT_SYNCDB: case PM_ERR_OPT_SYNCDB:
case PM_ERR_OPT_USESYSLOG: case PM_ERR_OPT_USESYSLOG:
return "could not set parameter"; return _("could not set parameter");
/* Transactions */ /* Transactions */
case PM_ERR_TRANS_NULL: case PM_ERR_TRANS_NULL:
return "transaction not initialized"; return _("transaction not initialized");
case PM_ERR_TRANS_NOT_NULL: case PM_ERR_TRANS_NOT_NULL:
return "transaction already initialized"; return _("transaction already initialized");
case PM_ERR_TRANS_DUP_TARGET: case PM_ERR_TRANS_DUP_TARGET:
return "duplicate target"; return _("duplicate target");
case PM_ERR_TRANS_NOT_INITIALIZED: case PM_ERR_TRANS_NOT_INITIALIZED:
return "transaction not initialized"; return _("transaction not initialized");
case PM_ERR_TRANS_NOT_PREPARED: case PM_ERR_TRANS_NOT_PREPARED:
return "transaction not prepared"; return _("transaction not prepared");
case PM_ERR_TRANS_ABORT: case PM_ERR_TRANS_ABORT:
return "transaction aborted"; return _("transaction aborted");
case PM_ERR_TRANS_TYPE: case PM_ERR_TRANS_TYPE:
return "operation not compatible with the transaction type"; return _("operation not compatible with the transaction type");
/* Packages */ /* Packages */
case PM_ERR_PKG_NOT_FOUND: 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: case PM_ERR_PKG_INVALID:
return "invalid or corrupted package"; return _("invalid or corrupted package");
case PM_ERR_PKG_OPEN: case PM_ERR_PKG_OPEN:
return "cannot open package file"; return _("cannot open package file");
case PM_ERR_PKG_LOAD: case PM_ERR_PKG_LOAD:
return "cannot load package data"; return _("cannot load package data");
case PM_ERR_PKG_INSTALLED: case PM_ERR_PKG_INSTALLED:
return "package already installed"; return _("package already installed");
case PM_ERR_PKG_CANT_FRESH: 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: case PM_ERR_PKG_INVALID_NAME:
return "package name is not valid"; return _("package name is not valid");
/* Groups */ /* Groups */
case PM_ERR_GRP_NOT_FOUND: case PM_ERR_GRP_NOT_FOUND:
return "group not found"; return _("group not found");
/* Dependencies */ /* Dependencies */
case PM_ERR_UNSATISFIED_DEPS: case PM_ERR_UNSATISFIED_DEPS:
return "could not satisfy dependencies"; return _("could not satisfy dependencies");
case PM_ERR_CONFLICTING_DEPS: case PM_ERR_CONFLICTING_DEPS:
return "conflicting dependencies"; return _("conflicting dependencies");
case PM_ERR_FILE_CONFLICTS: case PM_ERR_FILE_CONFLICTS:
return "conflicting files"; return _("conflicting files");
/* Miscellaenous */ /* Miscellaenous */
case PM_ERR_USER_ABORT: case PM_ERR_USER_ABORT:
return "user aborted"; return _("user aborted");
case PM_ERR_INTERNAL_ERROR: case PM_ERR_INTERNAL_ERROR:
return "internal error"; return _("internal error");
default: default:
return "unexpected error"; return _("unexpected error");
} }
} }

View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "util.h" #include "util.h"
#include "error.h" #include "error.h"
@ -36,7 +37,7 @@ pmgrp_t *_alpm_grp_new()
grp = (pmgrp_t *)malloc(sizeof(pmgrp_t)); grp = (pmgrp_t *)malloc(sizeof(pmgrp_t));
if(grp == NULL) { 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)); sizeof(pmgrp_t));
RET_ERR(PM_ERR_MEMORY, NULL); RET_ERR(PM_ERR_MEMORY, NULL);
} }

View File

@ -27,6 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdarg.h> #include <stdarg.h>
#include <syslog.h> #include <syslog.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
@ -46,7 +47,7 @@ pmhandle_t *handle_new()
handle = (pmhandle_t *)malloc(sizeof(pmhandle_t)); handle = (pmhandle_t *)malloc(sizeof(pmhandle_t));
if(handle == NULL) { 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); 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); FREE(handle->dbpath);
} }
handle->dbpath = strdup((data && strlen((char *)data) != 0) ? (char *)data : PM_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; break;
case PM_OPT_CACHEDIR: case PM_OPT_CACHEDIR:
if(handle->cachedir) { if(handle->cachedir) {
FREE(handle->cachedir); FREE(handle->cachedir);
} }
handle->cachedir = strdup((data && strlen((char *)data) != 0) ? (char *)data : PM_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; break;
case PM_OPT_LOGFILE: case PM_OPT_LOGFILE:
if((char *)data == NULL || handle->uid != 0) { 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; handle->logfd = NULL;
} }
if((handle->logfd = fopen((char *)data, "a")) == 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); RET_ERR(PM_ERR_OPT_LOGFILE, -1);
} }
handle->logfile = strdup((char *)data); 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; break;
case PM_OPT_NOUPGRADE: case PM_OPT_NOUPGRADE:
if((char *)data && strlen((char *)data) != 0) { if((char *)data && strlen((char *)data) != 0) {
handle->noupgrade = _alpm_list_add(handle->noupgrade, strdup((char *)data)); 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 { } else {
FREELIST(handle->noupgrade); FREELIST(handle->noupgrade);
_alpm_log(PM_LOG_FLOW2, "PM_OPT_NOUPGRADE flushed"); _alpm_log(PM_LOG_FLOW2, _("PM_OPT_NOUPGRADE flushed"));
} }
break; break;
case PM_OPT_NOEXTRACT: case PM_OPT_NOEXTRACT:
if((char *)data && strlen((char *)data) != 0) { if((char *)data && strlen((char *)data) != 0) {
handle->noextract = _alpm_list_add(handle->noextract, strdup((char *)data)); 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 { } else {
FREELIST(handle->noextract); FREELIST(handle->noextract);
_alpm_log(PM_LOG_FLOW2, "PM_OPT_NOEXTRACT flushed"); _alpm_log(PM_LOG_FLOW2, _("PM_OPT_NOEXTRACT flushed"));
} }
break; break;
case PM_OPT_IGNOREPKG: case PM_OPT_IGNOREPKG:
if((char *)data && strlen((char *)data) != 0) { if((char *)data && strlen((char *)data) != 0) {
handle->ignorepkg = _alpm_list_add(handle->ignorepkg, strdup((char *)data)); 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 { } else {
FREELIST(handle->ignorepkg); FREELIST(handle->ignorepkg);
_alpm_log(PM_LOG_FLOW2, "PM_OPT_IGNOREPKG flushed"); _alpm_log(PM_LOG_FLOW2, _("PM_OPT_IGNOREPKG flushed"));
} }
break; break;
case PM_OPT_USESYSLOG: 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); openlog("alpm", 0, LOG_USER);
} }
handle->usesyslog = (unsigned short)data; 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; break;
case PM_OPT_LOGCB: case PM_OPT_LOGCB:
pm_logcb = (alpm_cb_log)data; pm_logcb = (alpm_cb_log)data;
break; break;
case PM_OPT_LOGMASK: case PM_OPT_LOGMASK:
pm_logmask = (unsigned char)data; 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; break;
default: default:
RET_ERR(PM_ERR_WRONG_ARGS, -1); RET_ERR(PM_ERR_WRONG_ARGS, -1);

View File

@ -23,6 +23,8 @@ documentation and/or software.
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <libintl.h>
#include "util.h"
#include "md5.h" #include "md5.h"
/* Length of test block, number of test blocks. /* Length of test block, number of test blocks.
@ -43,7 +45,7 @@ char* MDFile(char *filename)
unsigned char buffer[1024], digest[16]; unsigned char buffer[1024], digest[16];
if((file = fopen(filename, "rb")) == NULL) { if((file = fopen(filename, "rb")) == NULL) {
printf ("%s can't be opened\n", filename); printf (_("%s can't be opened\n"), filename);
} else { } else {
char *ret; char *ret;
int i; int i;

View File

@ -25,6 +25,7 @@
#include <limits.h> #include <limits.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <libintl.h>
#include <libtar.h> #include <libtar.h>
#include <zlib.h> #include <zlib.h>
/* pacman */ /* pacman */
@ -89,7 +90,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg = (pmpkg_t *)malloc(sizeof(pmpkg_t)); newpkg = (pmpkg_t *)malloc(sizeof(pmpkg_t));
if(newpkg == NULL) { 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); RET_ERR(PM_ERR_MEMORY, NULL);
} }
@ -169,7 +170,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
int linenum = 0; int linenum = 0;
if((fp = fopen(descfile, "r")) == NULL) { 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); return(-1);
} }
@ -186,7 +187,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
ptr = line; ptr = line;
key = strsep(&ptr, "="); key = strsep(&ptr, "=");
if(key == NULL || ptr == NULL) { 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); info->name[0] != '\0' ? info->name : "error", linenum);
} else { } else {
_alpm_strtrim(key); _alpm_strtrim(key);
@ -227,7 +228,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
} else if(!strcmp(key, "BACKUP")) { } else if(!strcmp(key, "BACKUP")) {
info->backup = _alpm_list_add(info->backup, strdup(ptr)); info->backup = _alpm_list_add(info->backup, strdup(ptr));
} else { } 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); info->name[0] != '\0' ? info->name : "error", linenum);
} }
} }
@ -287,7 +288,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
tar_extract_file(tar, descfile); tar_extract_file(tar, descfile);
/* parse the info file */ /* parse the info file */
if(parse_descfile(descfile, info, 0) == -1) { 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; pm_errno = PM_ERR_PKG_INVALID;
unlink(descfile); unlink(descfile);
FREE(descfile); FREE(descfile);
@ -327,7 +328,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
FREE(str); FREE(str);
fclose(fp); fclose(fp);
if(unlink(fn)) { 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); FREE(fn);
close(fd); close(fd);
@ -344,7 +345,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
} }
if(TH_ISREG(tar) && tar_skip_regfile(tar)) { 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; goto error;
} }
expath = NULL; expath = NULL;
@ -353,7 +354,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
tar = NULL; tar = NULL;
if(!config) { 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; goto error;
} }

View File

@ -27,6 +27,7 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <zlib.h> #include <zlib.h>
#include <libintl.h>
#include <libtar.h> #include <libtar.h>
/* pacman */ /* pacman */
#include "util.h" #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) { 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); 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); trans->packages = _alpm_list_add(trans->packages, info);
return(0); 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)) { if(!(trans->flags & (PM_TRANS_FLAG_NODEPS)) && (trans->type != PM_TRANS_TYPE_UPGRADE)) {
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL); 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); lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) { if(lp != NULL) {
if(trans->flags & PM_TRANS_FLAG_CASCADE) { 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; pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
pmpkg_t *info = _alpm_db_scan(db, miss->depend.name, INFRQ_ALL); pmpkg_t *info = _alpm_db_scan(db, miss->depend.name, INFRQ_ALL);
if(info) { 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); trans->packages = _alpm_list_add(trans->packages, info);
} else { } 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); 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) { 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); trans->packages = _alpm_removedeps(db, trans->packages);
} }
/* re-order w.r.t. dependencies */ /* 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); lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
/* free the old alltargs */ /* free the old alltargs */
FREELISTPTR(trans->packages); FREELISTPTR(trans->packages);
@ -150,7 +151,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
if(trans->type != PM_TRANS_TYPE_UPGRADE) { if(trans->type != PM_TRANS_TYPE_UPGRADE) {
EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL); 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 */ /* run the pre-remove scriptlet if it exists */
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { 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)) { 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 */ /* iterate through the list backwards, unlinking files */
for(lp = _alpm_list_last(info->files); lp; lp = lp->prev) { 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); snprintf(line, PATH_MAX, "%s%s", handle->root, file);
if(lstat(line, &buf)) { 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; continue;
} }
if(S_ISDIR(buf.st_mode)) { if(S_ISDIR(buf.st_mode)) {
if(rmdir(line)) { if(rmdir(line)) {
/* this is okay, other packages are probably using it. */ /* 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 { } else {
_alpm_log(PM_LOG_FLOW2, "removing directory %s", file); _alpm_log(PM_LOG_FLOW2, _("removing directory %s"), file);
} }
} else { } else {
/* check the "skip list" before removing the file. /* check the "skip list" before removing the file.
@ -201,7 +202,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
} }
} }
if(skipit) { 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); file);
} else { } else {
/* if the file is flagged, back it up to .pacsave */ /* 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]; char newpath[PATH_MAX];
snprintf(newpath, PATH_MAX, "%s.pacsave", line); snprintf(newpath, PATH_MAX, "%s.pacsave", line);
rename(line, newpath); rename(line, newpath);
_alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath); _alpm_log(PM_LOG_WARNING, _("%s saved as %s"), file, newpath);
alpm_logaction("%s saved as %s", line, newpath); alpm_logaction(_("%s saved as %s"), line, newpath);
} else { } else {
_alpm_log(PM_LOG_FLOW2, "unlinking %s", file); _alpm_log(PM_LOG_FLOW2, _("unlinking %s"), file);
if(unlink(line)) { if(unlink(line)) {
_alpm_log(PM_LOG_ERROR, "cannot remove file %s", file); _alpm_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
} }
} }
} }
} else { } else {
_alpm_log(PM_LOG_FLOW2, "unlinking %s", file); _alpm_log(PM_LOG_FLOW2, _("unlinking %s"), file);
if(unlink(line)) { 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 */ /* remove the package from the database */
_alpm_log(PM_LOG_FLOW1, "updating database"); _alpm_log(PM_LOG_FLOW1, _("updating database"));
_alpm_log(PM_LOG_FLOW2, "removing database entry '%s'", info->name); _alpm_log(PM_LOG_FLOW2, _("removing database entry '%s'"), info->name);
if(_alpm_db_remove(db, info) == -1) { 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) { 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 */ /* 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) { for(lp = info->depends; lp; lp = lp->next) {
pmpkg_t *depinfo = NULL; pmpkg_t *depinfo = NULL;
pmdepend_t depend; pmdepend_t depend;
@ -281,7 +282,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
FREELISTPTR(provides); FREELISTPTR(provides);
} }
if(depinfo == NULL) { 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 */ /* wtf */
continue; continue;
} }
@ -289,9 +290,9 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* splice out this entry from requiredby */ /* splice out this entry from requiredby */
depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, (void **)&data); depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, (void **)&data);
FREE(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)) { 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); depinfo->name, depinfo->version);
} }
} }
@ -303,7 +304,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* run ldconfig if it exists */ /* run ldconfig if it exists */
if(trans->type != PM_TRANS_TYPE_UPGRADE) { 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); _alpm_ldconfig(handle->root);
} }

View File

@ -28,6 +28,7 @@
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#endif #endif
#include <dirent.h> #include <dirent.h>
#include <libintl.h>
#include <libtar.h> #include <libtar.h>
#include <zlib.h> #include <zlib.h>
/* pacman */ /* pacman */
@ -54,7 +55,7 @@ pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data)
pmsyncpkg_t *sync; pmsyncpkg_t *sync;
if((sync = (pmsyncpkg_t *)malloc(sizeof(pmsyncpkg_t))) == NULL) { 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); return(NULL);
} }
@ -138,7 +139,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
PMList *i, *j, *k; PMList *i, *j, *k;
/* check for "recommended" package replacements */ /* 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(i = dbs_sync; i; i = i->next) {
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) { for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
pmpkg_t *spkg = j->data; 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) { for(m = _alpm_db_get_pkgcache(db_local); m; m = m->next) {
pmpkg_t *lpkg = m->data; pmpkg_t *lpkg = m->data;
if(!strcmp(k->data, lpkg->name)) { 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)) { 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); lpkg->name, lpkg->version, spkg->name, spkg->version);
} else { } else {
/* get confirmation for the replacement */ /* 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); sync->data = _alpm_list_add(NULL, dummy);
trans->packages = _alpm_list_add(trans->packages, sync); 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); 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 */ /* 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) { for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
int cmp; int cmp;
int replace = 0; 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); spkg = _alpm_db_get_pkgfromcache(j->data, local->name);
} }
if(spkg == NULL) { 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; continue;
} }
@ -221,7 +222,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
} }
} }
if(replace) { 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); spkg->name);
continue; 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); cmp = _alpm_versioncmp(local->version, spkg->version);
if(cmp > 0 && !spkg->force) { if(cmp > 0 && !spkg->force) {
/* local version is newer */ /* 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); local->name, local->version);
} else if(cmp == 0) { } else if(cmp == 0) {
/* versions are identical */ /* versions are identical */
} else if(_alpm_list_is_strin(i->data, handle->ignorepkg)) { } else if(_alpm_list_is_strin(i->data, handle->ignorepkg)) {
/* package should be ignored (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); local->name, local->version, spkg->version);
} else { } 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); local->name, local->version, local->version, spkg->version);
if(!find_pkginsync(spkg->name, trans->packages)) { if(!find_pkginsync(spkg->name, trans->packages)) {
pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version); 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) { if(spkg == NULL) {
/* Search provides */ /* Search provides */
PMList *p; 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); p = _alpm_db_whatprovides(dbs, targ);
if(p == NULL) { if(p == NULL) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1); 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); spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
FREELISTPTR(p); FREELISTPTR(p);
} }
@ -309,12 +310,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
} }
if(spkg == NULL) { if(spkg == NULL) {
/* Search provides */ /* 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) { for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *dbs = j->data; pmdb_t *dbs = j->data;
PMList *p = _alpm_db_whatprovides(dbs, targ); PMList *p = _alpm_db_whatprovides(dbs, targ);
if(p) { 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); spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
FREELISTPTR(p); FREELISTPTR(p);
} }
@ -333,7 +334,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
int resp = 0; int resp = 0;
QUESTION(trans, PM_TRANS_CONV_LOCAL_NEWER, local, NULL, NULL, &resp); QUESTION(trans, PM_TRANS_CONV_LOCAL_NEWER, local, NULL, NULL, &resp);
if(!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); return(0);
} }
} else if(cmp == 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; int resp = 0;
QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp); QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
if(!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); return(0);
} }
} }
@ -361,7 +362,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, c
FREEPKG(dummy); FREEPKG(dummy);
RET_ERR(PM_ERR_MEMORY, -1); 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); 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 */ /* Resolve targets dependencies */
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL); 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) { for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg; pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg;
if(_alpm_resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) { 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; goto cleanup;
} }
trans->packages = _alpm_list_add(trans->packages, sync); 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); spkg->name, spkg->version);
} }
} }
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL); 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); deps = _alpm_checkdeps(db_local, PM_TRANS_TYPE_UPGRADE, list);
if(deps) { if(deps) {
if(data) { 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 */ /* check for inter-conflicts and whatnot */
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL); 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); deps = _alpm_checkconflicts(db_local, list);
if(deps) { if(deps) {
int errorout = 0; 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; pmsyncpkg_t *sync;
pmpkg_t *local; 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); miss->target, miss->depend.name);
/* check if the conflicting package is one that's about to be removed/replaced. /* 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 /* so just treat it like a "replaces" item so the REQUIREDBY
* fields are inherited properly. * 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) { if(local) {
/* nothing to do for now: it will be handled later /* nothing to do for now: it will be handled later
* (not the same behavior as in pacman 2.x) */ * (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); target = _alpm_list_is_strin(miss->target, trans->targets);
depend = _alpm_list_is_strin(miss->depend.name, trans->targets); depend = _alpm_list_is_strin(miss->depend.name, trans->targets);
if(depend && !target) { 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); miss->depend.name);
/* remove miss->target */ /* remove miss->target */
rmpkg = miss->target; rmpkg = miss->target;
} else if(target && !depend) { } 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); miss->target);
/* remove miss->depend.name */ /* remove miss->depend.name */
rmpkg = 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) { if(rmpkg) {
pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages); pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
pmsyncpkg_t *spkg = NULL; 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); trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, (void **)&spkg);
FREESYNC(spkg); FREESYNC(spkg);
continue; 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 /* 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) { if(local) {
int doremove = 0; int doremove = 0;
if(!_alpm_list_is_strin(miss->depend.name, asked)) { 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); FREEPKG(sync->data);
} }
/* append to the replaces list */ /* 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); sync->data = _alpm_list_add(sync->data, q);
if(rsync) { if(rsync) {
/* remove it from the target list */ /* remove it from the target list */
pmsyncpkg_t *spkg = NULL; 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); trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, (void **)&spkg);
FREESYNC(spkg); FREESYNC(spkg);
} }
} else { } else {
/* abort */ /* abort */
_alpm_log(PM_LOG_ERROR, "unresolvable package conflicts detected"); _alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected"));
errorout = 1; errorout = 1;
if(data) { if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { 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); FREELIST(*data);
pm_errno = PM_ERR_MEMORY; pm_errno = PM_ERR_MEMORY;
ret = -1; ret = -1;
@ -588,11 +589,11 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
} }
} }
} else { } else {
_alpm_log(PM_LOG_ERROR, "unresolvable package conflicts detected"); _alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected"));
errorout = 1; errorout = 1;
if(data) { if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { 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); FREELIST(*data);
pm_errno = PM_ERR_MEMORY; pm_errno = PM_ERR_MEMORY;
ret = -1; 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 *leavingp = _alpm_db_get_pkgfromcache(db_local, miss->target);
pmpkg_t *conflictp = _alpm_db_get_pkgfromcache(db_local, miss->depend.name); pmpkg_t *conflictp = _alpm_db_get_pkgfromcache(db_local, miss->depend.name);
if(!leavingp || !conflictp) { 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; ret = -1;
goto cleanup; 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) { for(o = sp->pkg->provides; o && !pfound; o = o->next) {
if(!strcmp(m->data, o->data)) { if(!strcmp(m->data, o->data)) {
/* found matching provisio -- we're good to go */ /* 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); sp->pkg->name, (char *)o->data);
pfound = 1; pfound = 1;
} }
@ -688,7 +689,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PML
} }
if(data) { if(data) {
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { 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); FREELIST(*data);
pm_errno = PM_ERR_MEMORY; pm_errno = PM_ERR_MEMORY;
ret = -1; 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 */ /* remove conflicting and to-be-replaced packages */
tr = _alpm_trans_new(); tr = _alpm_trans_new();
if(tr == NULL) { 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; pm_errno = PM_ERR_MEMORY;
goto error; goto error;
} }
if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVE, PM_TRANS_FLAG_NODEPS, if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVE, PM_TRANS_FLAG_NODEPS,
trans->cb_event, trans->cb_conv) == -1) { 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; goto error;
} }
@ -759,31 +760,31 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
} }
} }
if(replaces) { 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) { 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; goto error;
} }
/* we want the frontend to be aware of commit details */ /* we want the frontend to be aware of commit details */
tr->cb_event = trans->cb_event; tr->cb_event = trans->cb_event;
if(_alpm_trans_commit(tr, NULL) == -1) { 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; goto error;
} }
} }
FREETRANS(tr); FREETRANS(tr);
/* install targets */ /* install targets */
_alpm_log(PM_LOG_FLOW1, "installing packages"); _alpm_log(PM_LOG_FLOW1, _("installing packages"));
tr = _alpm_trans_new(); tr = _alpm_trans_new();
if(tr == NULL) { 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; pm_errno = PM_ERR_MEMORY;
goto error; goto error;
} }
if(_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags | PM_TRANS_FLAG_NODEPS, if(_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags | PM_TRANS_FLAG_NODEPS,
trans->cb_event, trans->cb_conv) == -1) { 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; goto error;
} }
for(i = trans->packages; i; i = i->next) { 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) { 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; goto error;
} }
if(_alpm_trans_commit(tr, NULL) == -1) { 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; goto error;
} }
FREETRANS(tr); FREETRANS(tr);
/* propagate replaced packages' requiredby fields to their new owners */ /* propagate replaced packages' requiredby fields to their new owners */
if(replaces) { 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) { for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data; pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) { 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) { 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); new->name, new->version);
} }
/* add the new requiredby */ /* 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) { 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); new->name, new->version);
} }
} }

View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "error.h" #include "error.h"
#include "package.h" #include "package.h"
@ -42,7 +43,7 @@ pmtrans_t *_alpm_trans_new()
pmtrans_t *trans; pmtrans_t *trans;
if((trans = (pmtrans_t *)malloc(sizeof(pmtrans_t))) == NULL) { 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); return(NULL);
} }

View File

@ -32,6 +32,7 @@
#include <time.h> #include <time.h>
#include <syslog.h> #include <syslog.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <libintl.h>
#ifdef CYGWIN #ifdef CYGWIN
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#endif #endif
@ -223,7 +224,7 @@ int _alpm_unpack(char *archive, const char *prefix, const char *fn)
while(!th_read(tar)) { while(!th_read(tar)) {
if(fn && strcmp(fn, th_get_pathname(tar))) { if(fn && strcmp(fn, th_get_pathname(tar))) {
if(TH_ISREG(tar) && tar_skip_regfile(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); tar_close(tar);
return(1); 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)); snprintf(expath, PATH_MAX, "%s/%s", prefix, th_get_pathname(tar));
if(tar_extract_file(tar, expath)) { 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; 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); snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root);
if(mkdtemp(tmpdir) == NULL) { 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); return(1);
} }
_alpm_unpack(installfn, tmpdir, ".INSTALL"); _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 */ /* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) { 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 */ /* in case of error, cwd content is undefined: so we set it to something */
cwd[0] = 0; cwd[0] = 0;
} }
/* just in case our cwd was removed in the upgrade operation */ /* just in case our cwd was removed in the upgrade operation */
if(chdir(root) != 0) { 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) { if(oldver) {
snprintf(cmdline, PATH_MAX, "source %s %s %s %s", 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(); pid = fork();
if(pid == -1) { 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; retval = 1;
goto cleanup; goto cleanup;
} }
if(pid == 0) { 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) { 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); return(1);
} }
if(chdir("/") != 0) { 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); return(1);
} }
umask(0022); 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); execl("/bin/sh", "sh", "-c", cmdline, (char *)0);
exit(0); exit(0);
} else { } else {
if(waitpid(pid, 0, 0) == -1) { 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; retval = 1;
goto cleanup; goto cleanup;
} }
@ -451,7 +452,7 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
cleanup: cleanup:
if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) { 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)) { if(strlen(cwd)) {
chdir(cwd); chdir(cwd);

View File

@ -32,6 +32,8 @@
s1[(len)-1] = 0; \ s1[(len)-1] = 0; \
} while(0) } while(0)
#define _(str) dgettext("libalpm", str)
long _alpm_gzopen_frontend(char *pathname, int oflags, int mode); long _alpm_gzopen_frontend(char *pathname, int oflags, int mode);
int _alpm_makepath(char *path); int _alpm_makepath(char *path);
int _alpm_copyfile(char *src, char *dest); int _alpm_copyfile(char *src, char *dest);

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -31,6 +32,7 @@
#include "trans.h" #include "trans.h"
#include "add.h" #include "add.h"
#include "conf.h" #include "conf.h"
#include "util.h"
extern config_t *config; extern config_t *config;
@ -64,34 +66,34 @@ int pacman_add(list_t *targets)
config->flags, cb_trans_evt, cb_trans_conv) == -1) { config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno)); ERR(NL, "%s\n", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) { if(pm_errno == PM_ERR_HANDLE_LOCK) {
MSG(NL, " if you're sure a package manager is not already running,\n" MSG(NL, _(" if you're sure a package manager is not already running,\n"
" you can remove %s\n", PM_LOCK); " you can remove %s\n"), PM_LOCK);
} }
return(1); return(1);
} }
/* and add targets to it */ /* and add targets to it */
MSG(NL, "loading package data... "); MSG(NL, _("loading package data... "));
for(i = targets; i; i = i->next) { for(i = targets; i; i = i->next) {
if(alpm_trans_addtarget(i->data) == -1) { if(alpm_trans_addtarget(i->data) == -1) {
ERR(NL, "failed to add target '%s' (%s)\n", (char *)i->data, alpm_strerror(pm_errno)); ERR(NL, _("failed to add target '%s' (%s)\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
} }
MSG(CL, "done."); MSG(CL, _("done."));
/* Step 2: "compute" the transaction based on targets and flags /* Step 2: "compute" the transaction based on targets and flags
*/ */
if(alpm_trans_prepare(&data) == -1) { if(alpm_trans_prepare(&data) == -1) {
PM_LIST *i; PM_LIST *i;
ERR(NL, "failed to prepare transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) { switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS: case PM_ERR_UNSATISFIED_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) { for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
PM_DEPMISS *miss = alpm_list_getdata(i); PM_DEPMISS *miss = alpm_list_getdata(i);
MSG(NL, ":: %s: requires %s", alpm_dep_getinfo(miss, PM_DEP_TARGET), MSG(NL, _(":: %s: requires %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
alpm_dep_getinfo(miss, PM_DEP_NAME)); alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) { switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break; case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@ -105,7 +107,7 @@ int pacman_add(list_t *targets)
case PM_ERR_CONFLICTING_DEPS: case PM_ERR_CONFLICTING_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) { for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
PM_DEPMISS *miss = alpm_list_getdata(i); PM_DEPMISS *miss = alpm_list_getdata(i);
MSG(NL, ":: %s: conflicts with %s", MSG(NL, _(":: %s: conflicts with %s"),
alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME)); alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
} }
alpm_list_free(data); alpm_list_free(data);
@ -115,20 +117,20 @@ int pacman_add(list_t *targets)
PM_CONFLICT *conflict = alpm_list_getdata(i); PM_CONFLICT *conflict = alpm_list_getdata(i);
switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) { switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET: case PM_CONFLICT_TYPE_TARGET:
MSG(NL, "%s exists in \"%s\" (target) and \"%s\" (target)", MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE), (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET), (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET)); (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break; break;
case PM_CONFLICT_TYPE_FILE: case PM_CONFLICT_TYPE_FILE:
MSG(NL, "%s: %s exists in filesystem", MSG(NL, _("%s: %s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET), (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE)); (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break; break;
} }
} }
alpm_list_free(data); alpm_list_free(data);
MSG(NL, "\nerrors occurred, no packages were upgraded.\n"); MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break; break;
default: default:
break; break;
@ -140,7 +142,7 @@ int pacman_add(list_t *targets)
/* Step 3: actually perform the installation /* Step 3: actually perform the installation
*/ */
if(alpm_trans_commit(NULL) == -1) { if(alpm_trans_commit(NULL) == -1) {
ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -149,7 +151,7 @@ int pacman_add(list_t *targets)
*/ */
cleanup: cleanup:
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
} }

View File

@ -23,6 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -98,13 +99,13 @@ int parseconfig(char *file, config_t *config)
ptr++; ptr++;
strncpy(section, ptr, min(255, strlen(ptr)-1)); strncpy(section, ptr, min(255, strlen(ptr)-1));
section[min(255, strlen(ptr)-1)] = '\0'; section[min(255, strlen(ptr)-1)] = '\0';
vprint("config: new section '%s'\n", section); vprint(_("config: new section '%s'\n"), section);
if(!strlen(section)) { if(!strlen(section)) {
ERR(NL, "config: line %d: bad section name\n", linenum); ERR(NL, _("config: line %d: bad section name\n"), linenum);
return(1); return(1);
} }
if(!strcmp(section, "local")) { if(!strcmp(section, "local")) {
ERR(NL, "config: line %d: '%s' is reserved and cannot be used as a package tree\n", ERR(NL, _("config: line %d: '%s' is reserved and cannot be used as a package tree\n"),
linenum, section); linenum, section);
return(1); return(1);
} }
@ -130,29 +131,29 @@ int parseconfig(char *file, config_t *config)
ptr = line; ptr = line;
key = strsep(&ptr, "="); key = strsep(&ptr, "=");
if(key == NULL) { if(key == NULL) {
ERR(NL, "config: line %d: syntax error\n", linenum); ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1); return(1);
} }
strtrim(key); strtrim(key);
key = strtoupper(key); key = strtoupper(key);
if(!strlen(section) && strcmp(key, "INCLUDE")) { if(!strlen(section) && strcmp(key, "INCLUDE")) {
ERR(NL, "config: line %d: all directives must belong to a section\n", linenum); ERR(NL, _("config: line %d: all directives must belong to a section\n"), linenum);
return(1); return(1);
} }
if(ptr == NULL) { if(ptr == NULL) {
if(!strcmp(key, "NOPASSIVEFTP")) { if(!strcmp(key, "NOPASSIVEFTP")) {
config->nopassiveftp = 1; config->nopassiveftp = 1;
vprint("config: nopassiveftp\n"); vprint(_("config: nopassiveftp\n"));
} else if(!strcmp(key, "USESYSLOG")) { } else if(!strcmp(key, "USESYSLOG")) {
if(alpm_set_option(PM_OPT_USESYSLOG, (long)1) == -1) { if(alpm_set_option(PM_OPT_USESYSLOG, (long)1) == -1) {
ERR(NL, "failed to set option USESYSLOG (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option USESYSLOG (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: usesyslog\n"); vprint(_("config: usesyslog\n"));
} else if(!strcmp(key, "ILOVECANDY")) { } else if(!strcmp(key, "ILOVECANDY")) {
config->chomp = 1; config->chomp = 1;
} else { } else {
ERR(NL, "config: line %d: syntax error\n", linenum); ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1); return(1);
} }
} else { } else {
@ -160,7 +161,7 @@ int parseconfig(char *file, config_t *config)
if(!strcmp(key, "INCLUDE")) { if(!strcmp(key, "INCLUDE")) {
char conf[PATH_MAX]; char conf[PATH_MAX];
strncpy(conf, ptr, PATH_MAX); strncpy(conf, ptr, PATH_MAX);
vprint("config: including %s\n", conf); vprint(_("config: including %s\n"), conf);
parseconfig(conf, config); parseconfig(conf, config);
} else if(!strcmp(section, "options")) { } else if(!strcmp(section, "options")) {
if(!strcmp(key, "NOUPGRADE")) { if(!strcmp(key, "NOUPGRADE")) {
@ -169,66 +170,66 @@ int parseconfig(char *file, config_t *config)
while((q = strchr(p, ' '))) { while((q = strchr(p, ' '))) {
*q = '\0'; *q = '\0';
if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) { if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) {
ERR(NL, "failed to set option NOUPGRADE (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option NOUPGRADE (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: noupgrade: %s\n", p); vprint(_("config: noupgrade: %s\n"), p);
p = q; p = q;
p++; p++;
} }
if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) { if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) {
ERR(NL, "failed to set option NOUPGRADE (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option NOUPGRADE (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: noupgrade: %s\n", p); vprint(_("config: noupgrade: %s\n"), p);
} else if(!strcmp(key, "NOEXTRACT")) { } else if(!strcmp(key, "NOEXTRACT")) {
char *p = ptr; char *p = ptr;
char *q; char *q;
while((q = strchr(p, ' '))) { while((q = strchr(p, ' '))) {
*q = '\0'; *q = '\0';
if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) { if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) {
ERR(NL, "failed to set option NOEXTRACT (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option NOEXTRACT (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: noextract: %s\n", p); vprint(_("config: noextract: %s\n"), p);
p = q; p = q;
p++; p++;
} }
if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) { if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) {
ERR(NL, "failed to set option NOEXTRACT (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option NOEXTRACT (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: noextract: %s\n", p); vprint(_("config: noextract: %s\n"), p);
} else if(!strcmp(key, "IGNOREPKG")) { } else if(!strcmp(key, "IGNOREPKG")) {
char *p = ptr; char *p = ptr;
char *q; char *q;
while((q = strchr(p, ' '))) { while((q = strchr(p, ' '))) {
*q = '\0'; *q = '\0';
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) { if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) {
ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: ignorepkg: %s\n", p); vprint(_("config: ignorepkg: %s\n"), p);
p = q; p = q;
p++; p++;
} }
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) { if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) {
ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: ignorepkg: %s\n", p); vprint(_("config: ignorepkg: %s\n"), p);
} else if(!strcmp(key, "HOLDPKG")) { } else if(!strcmp(key, "HOLDPKG")) {
char *p = ptr; char *p = ptr;
char *q; char *q;
while((q = strchr(p, ' '))) { while((q = strchr(p, ' '))) {
*q = '\0'; *q = '\0';
config->holdpkg = list_add(config->holdpkg, strdup(p)); config->holdpkg = list_add(config->holdpkg, strdup(p));
vprint("config: holdpkg: %s\n", p); vprint(_("config: holdpkg: %s\n"), p);
p = q; p = q;
p++; p++;
} }
config->holdpkg = list_add(config->holdpkg, strdup(p)); config->holdpkg = list_add(config->holdpkg, strdup(p));
vprint("config: holdpkg: %s\n", p); vprint(_("config: holdpkg: %s\n"), p);
} else if(!strcmp(key, "DBPATH")) { } else if(!strcmp(key, "DBPATH")) {
/* shave off the leading slash, if there is one */ /* shave off the leading slash, if there is one */
if(*ptr == '/') { if(*ptr == '/') {
@ -236,7 +237,7 @@ int parseconfig(char *file, config_t *config)
} }
FREE(config->dbpath); FREE(config->dbpath);
config->dbpath = strdup(ptr); config->dbpath = strdup(ptr);
vprint("config: dbpath: %s\n", ptr); vprint(_("config: dbpath: %s\n"), ptr);
} else if(!strcmp(key, "CACHEDIR")) { } else if(!strcmp(key, "CACHEDIR")) {
/* shave off the leading slash, if there is one */ /* shave off the leading slash, if there is one */
if(*ptr == '/') { if(*ptr == '/') {
@ -244,17 +245,17 @@ int parseconfig(char *file, config_t *config)
} }
FREE(config->cachedir); FREE(config->cachedir);
config->cachedir = strdup(ptr); config->cachedir = strdup(ptr);
vprint("config: cachedir: %s\n", ptr); vprint(_("config: cachedir: %s\n"), ptr);
} else if (!strcmp(key, "LOGFILE")) { } else if (!strcmp(key, "LOGFILE")) {
if(alpm_set_option(PM_OPT_LOGFILE, (long)ptr) == -1) { if(alpm_set_option(PM_OPT_LOGFILE, (long)ptr) == -1) {
ERR(NL, "failed to set option LOGFILE (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option LOGFILE (%s)\n"), alpm_strerror(pm_errno));
return(1); return(1);
} }
vprint("config: log file: %s\n", ptr); vprint(_("config: log file: %s\n"), ptr);
} else if (!strcmp(key, "XFERCOMMAND")) { } else if (!strcmp(key, "XFERCOMMAND")) {
FREE(config->xfercommand); FREE(config->xfercommand);
config->xfercommand = strndup(ptr, PATH_MAX); config->xfercommand = strndup(ptr, PATH_MAX);
vprint("config: xfercommand: %s\n", config->xfercommand); vprint(_("config: xfercommand: %s\n"), config->xfercommand);
} else if (!strcmp(key, "PROXYSERVER")) { } else if (!strcmp(key, "PROXYSERVER")) {
char *p; char *p;
if(config->proxyhost) { if(config->proxyhost) {
@ -264,18 +265,18 @@ int parseconfig(char *file, config_t *config)
if(p) { if(p) {
p += 3; p += 3;
if(p == NULL || *p == '\0') { if(p == NULL || *p == '\0') {
ERR(NL, "config: line %d: bad server location\n", linenum); ERR(NL, _("config: line %d: bad server location\n"), linenum);
return(1); return(1);
} }
ptr = p; ptr = p;
} }
config->proxyhost = strndup(ptr, PATH_MAX); config->proxyhost = strndup(ptr, PATH_MAX);
vprint("config: proxyserver: %s\n", config->proxyhost); vprint(_("config: proxyserver: %s\n"), config->proxyhost);
} else if (!strcmp(key, "PROXYPORT")) { } else if (!strcmp(key, "PROXYPORT")) {
config->proxyport = (unsigned short)atoi(ptr); config->proxyport = (unsigned short)atoi(ptr);
vprint("config: proxyport: %u\n", config->proxyport); vprint(_("config: proxyport: %u\n"), config->proxyport);
} else { } else {
ERR(NL, "config: line %d: syntax error\n", linenum); ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1); return(1);
} }
} else { } else {
@ -290,13 +291,13 @@ int parseconfig(char *file, config_t *config)
p = strstr(ptr, "://"); p = strstr(ptr, "://");
if(p == NULL) { if(p == NULL) {
ERR(NL, "config: line %d: bad server location\n", linenum); ERR(NL, _("config: line %d: bad server location\n"), linenum);
return(1); return(1);
} }
*p = '\0'; *p = '\0';
p++; p++; p++; p++; p++; p++;
if(p == NULL || *p == '\0') { if(p == NULL || *p == '\0') {
ERR(NL, "config: line %d: bad server location\n", linenum); ERR(NL, _("config: line %d: bad server location\n"), linenum);
return(1); return(1);
} }
server->protocol = strdup(ptr); server->protocol = strdup(ptr);
@ -313,7 +314,7 @@ int parseconfig(char *file, config_t *config)
server->path = strdup(slash); server->path = strdup(slash);
} else { } else {
if((server->path = (char *)malloc(strlen(slash)+2)) == NULL) { if((server->path = (char *)malloc(strlen(slash)+2)) == NULL) {
ERR(NL, "could not allocate %d bytes\n", sizeof(strlen(slash+2))); ERR(NL, _("could not allocate %d bytes\n"), sizeof(strlen(slash+2)));
return(1); return(1);
} }
sprintf(server->path, "%s/", slash); sprintf(server->path, "%s/", slash);
@ -328,20 +329,20 @@ int parseconfig(char *file, config_t *config)
} else { } else {
server->path = (char *)malloc(strlen(p)+2); server->path = (char *)malloc(strlen(p)+2);
if(server->path == NULL) { if(server->path == NULL) {
ERR(NL, "could not allocate %d bytes\n", sizeof(strlen(p+2))); ERR(NL, _("could not allocate %d bytes\n"), sizeof(strlen(p+2)));
return(1); return(1);
} }
sprintf(server->path, "%s/", p); sprintf(server->path, "%s/", p);
} }
} else { } else {
ERR(NL, "config: line %d: protocol %s is not supported\n", linenum, ptr); ERR(NL, _("config: line %d: protocol %s is not supported\n"), linenum, ptr);
return(1); return(1);
} }
/* add to the list */ /* add to the list */
vprint("config: %s: server: %s %s %s\n", section, server->protocol, server->server, server->path); vprint(_("config: %s: server: %s %s %s\n"), section, server->protocol, server->server, server->path);
sync->servers = list_add(sync->servers, server); sync->servers = list_add(sync->servers, server);
} else { } else {
ERR(NL, "config: line %d: syntax error\n", linenum); ERR(NL, _("config: line %d: syntax error\n"), linenum);
return(1); return(1);
} }
} }

View File

@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
#include "util.h" #include "util.h"
@ -60,8 +61,8 @@ int pacman_deptest(list_t *targets)
if(alpm_trans_init(PM_TRANS_TYPE_ADD, 0, NULL, NULL) == -1) { if(alpm_trans_init(PM_TRANS_TYPE_ADD, 0, NULL, NULL) == -1) {
ERR(NL, "%s", alpm_strerror(pm_errno)); ERR(NL, "%s", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) { if(pm_errno == PM_ERR_HANDLE_LOCK) {
MSG(NL, " if you're sure a package manager is not already running,\n" \ MSG(NL, _(" if you're sure a package manager is not already running,\n"
" you can remove %s\n", PM_LOCK); " you can remove %s\n"), PM_LOCK);
} }
return(1); return(1);
} }
@ -73,7 +74,7 @@ int pacman_deptest(list_t *targets)
*/ */
str = (char *)malloc(strlen("name=dummy|version=1.0-1")+1); str = (char *)malloc(strlen("name=dummy|version=1.0-1")+1);
if(str == NULL) { if(str == NULL) {
ERR(NL, "memory allocation failure\n"); ERR(NL, _("memory allocation failure\n"));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -83,10 +84,10 @@ int pacman_deptest(list_t *targets)
strcat(str, "|depend="); strcat(str, "|depend=");
strcat(str, i->data); strcat(str, i->data);
} }
vprint("add target %s\n", str); vprint(_("add target %s\n"), str);
if(alpm_trans_addtarget(str) == -1) { if(alpm_trans_addtarget(str) == -1) {
FREE(str); FREE(str);
ERR(NL, "could not add target (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("could not add target (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -106,7 +107,7 @@ int pacman_deptest(list_t *targets)
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp); PM_DEPMISS *miss = alpm_list_getdata(lp);
if(!config->op_d_resolve) { if(!config->op_d_resolve) {
MSG(NL, "requires: %s", alpm_dep_getinfo(miss, PM_DEP_NAME)); MSG(NL, _("requires: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) { switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break; case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break; case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@ -122,7 +123,7 @@ int pacman_deptest(list_t *targets)
/* we can't auto-resolve conflicts */ /* we can't auto-resolve conflicts */
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp); PM_DEPMISS *miss = alpm_list_getdata(lp);
MSG(NL, "conflict: %s", alpm_dep_getinfo(miss, PM_DEP_NAME)); MSG(NL, _("conflict: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
} }
retval = 127; retval = 127;
alpm_list_free(data); alpm_list_free(data);
@ -136,7 +137,7 @@ int pacman_deptest(list_t *targets)
/* TODO: handle version comparators (eg, glibc>=2.2.5) */ /* TODO: handle version comparators (eg, glibc>=2.2.5) */
if(retval == 126 && synctargs != NULL) { if(retval == 126 && synctargs != NULL) {
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, "could not release transaction (%s)", alpm_strerror(pm_errno)); ERR(NL, _("could not release transaction (%s)"), alpm_strerror(pm_errno));
FREELIST(synctargs); FREELIST(synctargs);
return(1); return(1);
} }
@ -153,7 +154,7 @@ int pacman_deptest(list_t *targets)
cleanup: cleanup:
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, "could not release transaction (%s)", alpm_strerror(pm_errno)); ERR(NL, _("could not release transaction (%s)"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
} }

View File

@ -29,6 +29,7 @@
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <ftplib.h> #include <ftplib.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -204,27 +205,27 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!config->xfercommand && strcmp(server->protocol, "file")) { if(!config->xfercommand && strcmp(server->protocol, "file")) {
if(!strcmp(server->protocol, "ftp") && !config->proxyhost) { if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
FtpInit(); FtpInit();
vprint("connecting to %s:21\n", server->server); vprint(_("connecting to %s:21\n"), server->server);
if(!FtpConnect(server->server, &control)) { if(!FtpConnect(server->server, &control)) {
ERR(NL, "cannot connect to %s\n", server->server); ERR(NL, _("cannot connect to %s\n"), server->server);
continue; continue;
} }
if(!FtpLogin("anonymous", "arch@guest", control)) { if(!FtpLogin("anonymous", "arch@guest", control)) {
ERR(NL, "anonymous login failed\n"); ERR(NL, _("anonymous login failed\n"));
FtpQuit(control); FtpQuit(control);
continue; continue;
} }
if(!FtpChdir(server->path, control)) { if(!FtpChdir(server->path, control)) {
ERR(NL, "could not cwd to %s: %s\n", server->path, FtpLastResponse(control)); ERR(NL, _("could not cwd to %s: %s\n"), server->path, FtpLastResponse(control));
FtpQuit(control); FtpQuit(control);
continue; continue;
} }
if(!config->nopassiveftp) { if(!config->nopassiveftp) {
if(!FtpOptions(FTPLIB_CONNMODE, FTPLIB_PASSIVE, control)) { if(!FtpOptions(FTPLIB_CONNMODE, FTPLIB_PASSIVE, control)) {
WARN(NL, "failed to set passive mode\n"); WARN(NL, _("failed to set passive mode\n"));
} }
} else { } else {
vprint("FTP passive mode not set\n"); vprint(_("FTP passive mode not set\n"));
} }
} else if(config->proxyhost) { } else if(config->proxyhost) {
char *host; char *host;
@ -232,12 +233,12 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
host = (config->proxyhost) ? config->proxyhost : server->server; host = (config->proxyhost) ? config->proxyhost : server->server;
port = (config->proxyport) ? config->proxyport : 80; port = (config->proxyport) ? config->proxyport : 80;
if(strchr(host, ':')) { if(strchr(host, ':')) {
vprint("connecting to %s\n", host); vprint(_("connecting to %s\n"), host);
} else { } else {
vprint("connecting to %s:%u\n", host, port); vprint(_("connecting to %s:%u\n"), host, port);
} }
if(!HttpConnect(host, port, &control)) { if(!HttpConnect(host, port, &control)) {
ERR(NL, "cannot connect to %s\n", host); ERR(NL, _("cannot connect to %s\n"), host);
continue; continue;
} }
} }
@ -296,18 +297,18 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
/* cwd to the download directory */ /* cwd to the download directory */
getcwd(cwd, PATH_MAX); getcwd(cwd, PATH_MAX);
if(chdir(localpath)) { if(chdir(localpath)) {
ERR(NL, "could not chdir to %s\n", localpath); ERR(NL, _("could not chdir to %s\n"), localpath);
return(1); return(1);
} }
/* execute the parsed command via /bin/sh -c */ /* execute the parsed command via /bin/sh -c */
vprint("running command: %s\n", parsedCmd); vprint(_("running command: %s\n"), parsedCmd);
ret = system(parsedCmd); ret = system(parsedCmd);
if(ret == -1) { if(ret == -1) {
ERR(NL, "running XferCommand: fork failed!\n"); ERR(NL, _("running XferCommand: fork failed!\n"));
return(1); return(1);
} else if(ret != 0) { } else if(ret != 0) {
/* download failed */ /* download failed */
vprint("XferCommand command returned non-zero status code (%d)\n", ret); vprint(_("XferCommand command returned non-zero status code (%d)\n"), ret);
} else { } else {
/* download was successful */ /* download was successful */
complete = list_add(complete, fn); complete = list_add(complete, fn);
@ -352,18 +353,18 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!strcmp(server->protocol, "ftp") && !config->proxyhost) { if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) { if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) {
WARN(NL, "failed to get filesize for %s\n", fn); WARN(NL, _("failed to get filesize for %s\n"), fn);
} }
/* check mtimes */ /* check mtimes */
if(mtime1) { if(mtime1) {
char fmtime[64]; char fmtime[64];
if(!FtpModDate(fn, fmtime, sizeof(fmtime)-1, control)) { if(!FtpModDate(fn, fmtime, sizeof(fmtime)-1, control)) {
WARN(NL, "failed to get mtime for %s\n", fn); WARN(NL, _("failed to get mtime for %s\n"), fn);
} else { } else {
strtrim(fmtime); strtrim(fmtime);
if(mtime1 && !strcmp(mtime1, fmtime)) { if(mtime1 && !strcmp(mtime1, fmtime)) {
/* mtimes are identical, skip this file */ /* mtimes are identical, skip this file */
vprint("mtimes are identical, skipping %s\n", fn); vprint(_("mtimes are identical, skipping %s\n"), fn);
filedone = -1; filedone = -1;
complete = list_add(complete, fn); complete = list_add(complete, fn);
} else { } else {
@ -378,14 +379,14 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!stat(output, &st)) { if(!stat(output, &st)) {
offset = (int)st.st_size; offset = (int)st.st_size;
if(!FtpRestart(offset, control)) { if(!FtpRestart(offset, control)) {
WARN(NL, "failed to resume download -- restarting\n"); WARN(NL, _("failed to resume download -- restarting\n"));
/* can't resume: */ /* can't resume: */
/* unlink the file in order to restart download from scratch */ /* unlink the file in order to restart download from scratch */
unlink(output); unlink(output);
} }
} }
if(!FtpGet(output, fn, FTPLIB_IMAGE, control)) { if(!FtpGet(output, fn, FTPLIB_IMAGE, control)) {
ERR(NL, "\nfailed downloading %s from %s: %s\n", fn, server->server, FtpLastResponse(control)); ERR(NL, _("\nfailed downloading %s from %s: %s\n"), fn, server->server, FtpLastResponse(control));
/* we leave the partially downloaded file in place so it can be resumed later */ /* we leave the partially downloaded file in place so it can be resumed later */
} else { } else {
filedone = 1; filedone = 1;
@ -406,12 +407,12 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
host = (config->proxyhost) ? config->proxyhost : server->server; host = (config->proxyhost) ? config->proxyhost : server->server;
port = (config->proxyhost) ? config->proxyport : 80; port = (config->proxyhost) ? config->proxyport : 80;
if(strchr(host, ':')) { if(strchr(host, ':')) {
vprint("connecting to %s\n", host); vprint(_("connecting to %s\n"), host);
} else { } else {
vprint("connecting to %s:%u\n", host, port); vprint(_("connecting to %s:%u\n"), host, port);
} }
if(!HttpConnect(host, port, &control)) { if(!HttpConnect(host, port, &control)) {
ERR(NL, "cannot connect to %s\n", host); ERR(NL, _("cannot connect to %s\n"), host);
continue; continue;
} }
/* set up our progress bar's callback (and idle timeout) */ /* set up our progress bar's callback (and idle timeout) */
@ -456,11 +457,11 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
if(!HttpGet(server->server, output, src, &fsz, control, offset, if(!HttpGet(server->server, output, src, &fsz, control, offset,
(mtime1) ? &fmtime1 : NULL, (mtime2) ? &fmtime2 : NULL)) { (mtime1) ? &fmtime1 : NULL, (mtime2) ? &fmtime2 : NULL)) {
if(strstr(FtpLastResponse(control), "304")) { if(strstr(FtpLastResponse(control), "304")) {
vprint("mtimes are identical, skipping %s\n", fn); vprint(_("mtimes are identical, skipping %s\n"), fn);
filedone = -1; filedone = -1;
complete = list_add(complete, fn); complete = list_add(complete, fn);
} else { } else {
ERR(NL, "\nfailed downloading %s from %s: %s\n", src, server->server, FtpLastResponse(control)); ERR(NL, _("\nfailed downloading %s from %s: %s\n"), src, server->server, FtpLastResponse(control));
/* we leave the partially downloaded file in place so it can be resumed later */ /* we leave the partially downloaded file in place so it can be resumed later */
} }
} else { } else {
@ -471,7 +472,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
fmtime2.tm_year+1900, fmtime2.tm_mon+1, fmtime2.tm_mday, fmtime2.tm_year+1900, fmtime2.tm_mon+1, fmtime2.tm_mday,
fmtime2.tm_hour, fmtime2.tm_min, fmtime2.tm_sec); fmtime2.tm_hour, fmtime2.tm_min, fmtime2.tm_sec);
} else { } else {
WARN(NL, "failed to get mtime for %s\n", fn); WARN(NL, _("failed to get mtime for %s\n"), fn);
} }
} }
filedone = 1; filedone = 1;
@ -479,10 +480,10 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
} else if(!strcmp(server->protocol, "file")) { } else if(!strcmp(server->protocol, "file")) {
char src[PATH_MAX]; char src[PATH_MAX];
snprintf(src, PATH_MAX, "%s%s", server->path, fn); snprintf(src, PATH_MAX, "%s%s", server->path, fn);
vprint("copying %s to %s/%s\n", src, localpath, fn); vprint(_("copying %s to %s/%s\n"), src, localpath, fn);
/* local repository, just copy the file */ /* local repository, just copy the file */
if(copyfile(src, output)) { if(copyfile(src, output)) {
ERR(NL, "failed copying %s\n", src); ERR(NL, _("failed copying %s\n"), src);
} else { } else {
filedone = 1; filedone = 1;
} }
@ -498,7 +499,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
for(j = strlen(out); j < maxcols-64; j++) { for(j = strlen(out); j < maxcols-64; j++) {
printf(" "); printf(" ");
} }
fputs("] 100% LOCAL ", stdout); fputs(_("] 100% LOCAL "), stdout);
} else { } else {
log_progress(control, fsz-offset, &fsz); log_progress(control, fsz-offset, &fsz);
} }
@ -560,7 +561,7 @@ char *fetch_pkgurl(char *target)
/* do not download the file if it exists in the current dir /* do not download the file if it exists in the current dir
*/ */
if(stat(fn, &buf) == 0) { if(stat(fn, &buf) == 0) {
vprint(" %s is already in the current directory\n", fn); vprint(_(" %s is already in the current directory\n"), fn);
} else { } else {
server_t *server; server_t *server;
list_t *servers = NULL; list_t *servers = NULL;
@ -574,7 +575,7 @@ char *fetch_pkgurl(char *target)
files = list_add(NULL, fn); files = list_add(NULL, fn);
if(downloadfiles(servers, ".", files)) { if(downloadfiles(servers, ".", files)) {
ERR(NL, "failed to download %s\n", target); ERR(NL, _("failed to download %s\n"), target);
return(NULL); return(NULL);
} }
FREELISTPTR(files); FREELISTPTR(files);

View File

@ -23,7 +23,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <libintl.h>
/* pacman */ /* pacman */
#include "util.h"
#include "list.h" #include "list.h"
extern int maxcols; extern int maxcols;
@ -138,7 +140,7 @@ void list_display(const char *title, list_t *list)
} }
printf("\n"); printf("\n");
} else { } else {
printf("None\n"); printf(_("None\n"));
} }
} }
@ -166,7 +168,7 @@ void PM_LIST_display(const char *title, PM_LIST *list)
} }
printf("\n"); printf("\n");
} else { } else {
printf("None\n"); printf(_("None\n"));
} }
} }

View File

@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -46,25 +47,25 @@ void cb_log(unsigned short level, char *msg)
switch(level) { switch(level) {
case PM_LOG_DEBUG: case PM_LOG_DEBUG:
sprintf(str, "debug"); sprintf(str, _("debug"));
break; break;
case PM_LOG_ERROR: case PM_LOG_ERROR:
sprintf(str, "error"); sprintf(str, _("error"));
break; break;
case PM_LOG_WARNING: case PM_LOG_WARNING:
sprintf(str, "warning"); sprintf(str, _("warning"));
break; break;
case PM_LOG_FLOW1: case PM_LOG_FLOW1:
sprintf(str, "flow1"); sprintf(str, _("flow1"));
break; break;
case PM_LOG_FLOW2: case PM_LOG_FLOW2:
sprintf(str, "flow2"); sprintf(str, _("flow2"));
break; break;
case PM_LOG_FUNCTION: case PM_LOG_FUNCTION:
sprintf(str, "function"); sprintf(str, _("function"));
break; break;
default: default:
sprintf(str, "???"); sprintf(str, _("???"));
break; break;
} }
@ -147,7 +148,7 @@ int yesno(char *fmt, ...)
*++pch = 0; *++pch = 0;
strtrim(response); strtrim(response);
if(!strcasecmp(response, "Y") || !strcasecmp(response, "YES") || !strlen(response)) { if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || !strlen(response)) {
return(1); return(1);
} }
} }

View File

@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -42,43 +43,43 @@ void dump_pkg_full(PM_PKG *pkg, int level)
return; return;
} }
printf("Name : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME)); printf(_("Name : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME));
printf("Version : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION)); printf(_("Version : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
PM_LIST_display("Groups :", alpm_pkg_getinfo(pkg, PM_PKG_GROUPS)); PM_LIST_display(_("Groups :"), alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
printf("Packager : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_PACKAGER)); printf(_("Packager : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_PACKAGER));
printf("URL : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_URL)); printf(_("URL : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_URL));
PM_LIST_display("License :", alpm_pkg_getinfo(pkg, PM_PKG_LICENSE)); PM_LIST_display(_("License :"), alpm_pkg_getinfo(pkg, PM_PKG_LICENSE));
printf("Architecture : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_ARCH)); printf(_("Architecture : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_ARCH));
printf("Size : %ld\n", (long int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE)); printf(_("Size : %ld\n"), (long int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE));
date = alpm_pkg_getinfo(pkg, PM_PKG_BUILDDATE); date = alpm_pkg_getinfo(pkg, PM_PKG_BUILDDATE);
printf("Build Date : %s %s\n", date, strlen(date) ? "UTC" : ""); printf(_("Build Date : %s %s\n"), date, strlen(date) ? "UTC" : "");
date = alpm_pkg_getinfo(pkg, PM_PKG_INSTALLDATE); date = alpm_pkg_getinfo(pkg, PM_PKG_INSTALLDATE);
printf("Install Date : %s %s\n", date, strlen(date) ? "UTC" : ""); printf(_("Install Date : %s %s\n"), date, strlen(date) ? "UTC" : "");
printf("Install Script : %s\n", alpm_pkg_getinfo(pkg, PM_PKG_SCRIPLET) ? "Yes" : "No"); printf(_("Install Script : %s\n"), alpm_pkg_getinfo(pkg, PM_PKG_SCRIPLET) ? "Yes" : "No");
printf("Reason: : "); printf(_("Reason: : "));
switch((int)alpm_pkg_getinfo(pkg, PM_PKG_REASON)) { switch((int)alpm_pkg_getinfo(pkg, PM_PKG_REASON)) {
case PM_PKG_REASON_EXPLICIT: case PM_PKG_REASON_EXPLICIT:
printf("Explicitly installed\n"); printf(_("Explicitly installed\n"));
break; break;
case PM_PKG_REASON_DEPEND: case PM_PKG_REASON_DEPEND:
printf("Installed as a dependency for another package\n"); printf(_("Installed as a dependency for another package\n"));
break; break;
default: default:
printf("Unknown\n"); printf(_("Unknown\n"));
break; break;
} }
PM_LIST_display("Provides :", alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES)); PM_LIST_display(_("Provides :"), alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES));
PM_LIST_display("Depends On :", alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS)); PM_LIST_display(_("Depends On :"), alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
PM_LIST_display("Required By :", alpm_pkg_getinfo(pkg, PM_PKG_REQUIREDBY)); PM_LIST_display(_("Required By :"), alpm_pkg_getinfo(pkg, PM_PKG_REQUIREDBY));
PM_LIST_display("Conflicts With :", alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS)); PM_LIST_display(_("Conflicts With :"), alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
printf("Description : "); printf(_("Description : "));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 17); indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 17);
printf("\n"); printf("\n");
@ -102,14 +103,14 @@ void dump_pkg_full(PM_PKG *pkg, int level)
if(!stat(path, &buf)) { if(!stat(path, &buf)) {
char *md5sum = alpm_get_md5sum(path); char *md5sum = alpm_get_md5sum(path);
if(md5sum == NULL) { if(md5sum == NULL) {
ERR(NL, "error calculating md5sum for %s\n", path); ERR(NL, _("error calculating md5sum for %s\n"), path);
FREE(str); FREE(str);
continue; continue;
} }
printf("%sMODIFIED\t%s\n", strcmp(md5sum, ptr) ? "" : "NOT ", path); printf(_("%sMODIFIED\t%s\n"), strcmp(md5sum, ptr) ? "" : "NOT ", path);
FREE(md5sum); FREE(md5sum);
} else { } else {
printf("MISSING\t\t%s\n", path); printf(_("MISSING\t\t%s\n"), path);
} }
FREE(str); FREE(str);
} }
@ -127,20 +128,20 @@ void dump_pkg_sync(PM_PKG *pkg, char *treename)
return; return;
} }
printf("Repository : %s\n", treename); printf(_("Repository : %s\n"), treename);
printf("Name : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME)); printf(_("Name : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME));
printf("Version : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION)); printf(_("Version : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
PM_LIST_display("Groups :", alpm_pkg_getinfo(pkg, PM_PKG_GROUPS)); PM_LIST_display(_("Groups :"), alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
PM_LIST_display("Provides :", alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES)); PM_LIST_display(_("Provides :"), alpm_pkg_getinfo(pkg, PM_PKG_PROVIDES));
PM_LIST_display("Depends On :", alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS)); PM_LIST_display(_("Depends On :"), alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
PM_LIST_display("Conflicts With :", alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS)); PM_LIST_display(_("Conflicts With :"), alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
PM_LIST_display("Replaces :", alpm_pkg_getinfo(pkg, PM_PKG_REPLACES)); PM_LIST_display(_("Replaces :"), alpm_pkg_getinfo(pkg, PM_PKG_REPLACES));
printf("Size (compressed) : %ld\n", (long)alpm_pkg_getinfo(pkg, PM_PKG_SIZE)); printf(_("Size (compressed) : %ld\n"), (long)alpm_pkg_getinfo(pkg, PM_PKG_SIZE));
printf("Description : "); printf(_("Description : "));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 20); indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 20);
printf("\nMD5 Sum : %s\n", (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM)); printf(_("\nMD5 Sum : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM));
} }
void dump_pkg_files(PM_PKG *pkg) void dump_pkg_files(PM_PKG *pkg)
@ -152,7 +153,7 @@ void dump_pkg_files(PM_PKG *pkg)
pkgfiles = alpm_pkg_getinfo(pkg, PM_PKG_FILES); pkgfiles = alpm_pkg_getinfo(pkg, PM_PKG_FILES);
for(i = pkgfiles; i; i = alpm_list_next(i)) { for(i = pkgfiles; i; i = alpm_list_next(i)) {
fprintf(stdout, "%s %s\n", (char *)pkgname, (char *)alpm_list_getdata(i)); fprintf(stdout, _("%s %s\n"), (char *)pkgname, (char *)alpm_list_getdata(i));
} }
fflush(stdout); fflush(stdout);

View File

@ -27,6 +27,7 @@
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <libintl.h>
#ifndef CYGWIN #ifndef CYGWIN
#include <mcheck.h> /* debug */ #include <mcheck.h> /* debug */
#else #else
@ -77,12 +78,12 @@ extern int neednl;
*/ */
static void version() static void version()
{ {
printf("\n"); printf(_("\n"));
printf(" .--. Pacman v%s - libalpm v%s\n", PACKAGE_VERSION, PM_VERSION); printf(_(" .--. Pacman v%s - libalpm v%s\n"), PACKAGE_VERSION, PM_VERSION);
printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>\n"); printf(_("/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>\n"));
printf("\\ '-. '-' '-' '-' \n"); printf(_("\\ '-. '-' '-' '-' \n"));
printf(" '--' This program may be freely redistributed under\n"); printf(_(" '--' This program may be freely redistributed under\n"));
printf(" the terms of the GNU General Public License\n"); printf(_(" the terms of the GNU General Public License\n"));
printf("\n"); printf("\n");
} }
@ -93,72 +94,72 @@ static void version()
static void usage(int op, char *myname) static void usage(int op, char *myname)
{ {
if(op == PM_OP_MAIN) { if(op == PM_OP_MAIN) {
printf("usage: %s {-h --help}\n", myname); printf(_("usage: %s {-h --help}\n"), myname);
printf(" %s {-V --version}\n", myname); printf(_(" %s {-V --version}\n"), myname);
printf(" %s {-A --add} [options] <file>\n", myname); printf(_(" %s {-A --add} [options] <file>\n"), myname);
printf(" %s {-R --remove} [options] <package>\n", myname); printf(_(" %s {-R --remove} [options] <package>\n"), myname);
printf(" %s {-U --upgrade} [options] <file>\n", myname); printf(_(" %s {-U --upgrade} [options] <file>\n"), myname);
printf(" %s {-F --freshen} [options] <file>\n", myname); printf(_(" %s {-F --freshen} [options] <file>\n"), myname);
printf(" %s {-Q --query} [options] [package]\n", myname); printf(_(" %s {-Q --query} [options] [package]\n"), myname);
printf(" %s {-S --sync} [options] [package]\n", myname); printf(_(" %s {-S --sync} [options] [package]\n"), myname);
printf("\nuse '%s --help' with other options for more syntax\n", myname); printf(_("\nuse '%s --help' with other options for more syntax\n"), myname);
} else { } else {
if(op == PM_OP_ADD) { if(op == PM_OP_ADD) {
printf("usage: %s {-A --add} [options] <file>\n", myname); printf(_("usage: %s {-A --add} [options] <file>\n"), myname);
printf("options:\n"); printf(_("options:\n"));
printf(" -d, --nodeps skip dependency checks\n"); printf(_(" -d, --nodeps skip dependency checks\n"));
printf(" -f, --force force install, overwrite conflicting files\n"); printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_REMOVE) { } else if(op == PM_OP_REMOVE) {
printf("usage: %s {-R --remove} [options] <package>\n", myname); printf(_("usage: %s {-R --remove} [options] <package>\n"), myname);
printf("options:\n"); printf(_("options:\n"));
printf(" -c, --cascade remove packages and all packages that depend on them\n"); printf(_(" -c, --cascade remove packages and all packages that depend on them\n"));
printf(" -d, --nodeps skip dependency checks\n"); printf(_(" -d, --nodeps skip dependency checks\n"));
printf(" -k, --dbonly only remove database entry, do not remove files\n"); printf(_(" -k, --dbonly only remove database entry, do not remove files\n"));
printf(" -n, --nosave remove configuration files as well\n"); printf(_(" -n, --nosave remove configuration files as well\n"));
printf(" -s, --recursive remove dependencies also (that won't break packages)\n"); printf(_(" -s, --recursive remove dependencies also (that won't break packages)\n"));
} else if(op == PM_OP_UPGRADE) { } else if(op == PM_OP_UPGRADE) {
if(config->flags & PM_TRANS_FLAG_FRESHEN) { if(config->flags & PM_TRANS_FLAG_FRESHEN) {
printf("usage: %s {-F --freshen} [options] <file>\n", myname); printf(_("usage: %s {-F --freshen} [options] <file>\n"), myname);
} else { } else {
printf("usage: %s {-U --upgrade} [options] <file>\n", myname); printf(_("usage: %s {-U --upgrade} [options] <file>\n"), myname);
} }
printf("options:\n"); printf(_("options:\n"));
printf(" -d, --nodeps skip dependency checks\n"); printf(_(" -d, --nodeps skip dependency checks\n"));
printf(" -f, --force force install, overwrite conflicting files\n"); printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_QUERY) { } else if(op == PM_OP_QUERY) {
printf("usage: %s {-Q --query} [options] [package]\n", myname); printf(_("usage: %s {-Q --query} [options] [package]\n"), myname);
printf("options:\n"); printf(_("options:\n"));
printf(" -e, --orphans list all packages that were explicitly installed\n"); printf(_(" -e, --orphans list all packages that were explicitly installed\n"));
printf(" and are not required by any other packages\n"); printf(_(" and are not required by any other packages\n"));
printf(" -g, --groups view all members of a package group\n"); printf(_(" -g, --groups view all members of a package group\n"));
printf(" -i, --info view package information\n"); printf(_(" -i, --info view package information\n"));
printf(" -l, --list list the contents of the queried package\n"); printf(_(" -l, --list list the contents of the queried package\n"));
printf(" -m, --foreign list all packages that were not found in the sync repos\n"); printf(_(" -m, --foreign list all packages that were not found in the sync repos\n"));
printf(" -o, --owns <file> query the package that owns <file>\n"); printf(_(" -o, --owns <file> query the package that owns <file>\n"));
printf(" -p, --file pacman will query the package file [package] instead of\n"); printf(_(" -p, --file pacman will query the package file [package] instead of\n"));
printf(" looking in the database\n"); printf(_(" looking in the database\n"));
printf(" -s, --search search locally-installed packages for matching strings\n"); printf(_(" -s, --search search locally-installed packages for matching strings\n"));
} else if(op == PM_OP_SYNC) { } else if(op == PM_OP_SYNC) {
printf("usage: %s {-S --sync} [options] [package]\n", myname); printf(_("usage: %s {-S --sync} [options] [package]\n"), myname);
printf("options:\n"); printf(_("options:\n"));
printf(" -c, --clean remove old packages from cache directory (use -cc for all)\n"); printf(_(" -c, --clean remove old packages from cache directory (use -cc for all)\n"));
printf(" -d, --nodeps skip dependency checks\n"); printf(_(" -d, --nodeps skip dependency checks\n"));
printf(" -f, --force force install, overwrite conflicting files\n"); printf(_(" -f, --force force install, overwrite conflicting files\n"));
printf(" -g, --groups view all members of a package group\n"); printf(_(" -g, --groups view all members of a package group\n"));
printf(" -p, --print-uris print out URIs for given packages and their dependencies\n"); printf(_(" -p, --print-uris print out URIs for given packages and their dependencies\n"));
printf(" -s, --search search remote repositories for matching strings\n"); printf(_(" -s, --search search remote repositories for matching strings\n"));
printf(" -u, --sysupgrade upgrade all packages that are out of date\n"); printf(_(" -u, --sysupgrade upgrade all packages that are out of date\n"));
printf(" -w, --downloadonly download packages but do not install/upgrade anything\n"); printf(_(" -w, --downloadonly download packages but do not install/upgrade anything\n"));
printf(" -y, --refresh download fresh package databases from the server\n"); printf(_(" -y, --refresh download fresh package databases from the server\n"));
printf(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n"); printf(_(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n"));
} }
printf(" --config <path> set an alternate configuration file\n"); printf(_(" --config <path> set an alternate configuration file\n"));
printf(" --noconfirm do not ask for anything confirmation\n"); printf(_(" --noconfirm do not ask for anything confirmation\n"));
printf(" --noprogressbar do not show a progress bar when downloading files\n"); printf(_(" --noprogressbar do not show a progress bar when downloading files\n"));
printf(" --noscriptlet do not execute the install scriptlet if there is any\n"); printf(_(" --noscriptlet do not execute the install scriptlet if there is any\n"));
printf(" -v, --verbose be verbose\n"); printf(_(" -v, --verbose be verbose\n"));
printf(" -r, --root <path> set an alternate installation root\n"); printf(_(" -r, --root <path> set an alternate installation root\n"));
printf(" -b, --dbpath <path> set an alternate database location\n"); printf(_(" -b, --dbpath <path> set an alternate database location\n"));
} }
} }
@ -284,7 +285,7 @@ static int parseargs(int argc, char *argv[])
break; break;
case 'r': case 'r':
if(realpath(optarg, root) == NULL) { if(realpath(optarg, root) == NULL) {
perror("bad root path"); perror(_("bad root path"));
return(1); return(1);
} }
if(config->root) { if(config->root) {
@ -310,7 +311,7 @@ static int parseargs(int argc, char *argv[])
} }
if(config->op == 0) { if(config->op == 0) {
ERR(NL, "only one operation may be used at a time\n"); ERR(NL, _("only one operation may be used at a time\n"));
return(1); return(1);
} }
@ -342,7 +343,7 @@ static void cleanup(int signum)
/* free alpm library resources */ /* free alpm library resources */
if(alpm_release() == -1) { if(alpm_release() == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno)); ERR(NL, _("%s\n"), alpm_strerror(pm_errno));
} }
/* free memory */ /* free memory */
@ -432,7 +433,7 @@ int main(int argc, char *argv[])
config->op_q_info)) || (config->op == PM_OP_DEPTEST && !config->op_d_resolve)) { config->op_q_info)) || (config->op == PM_OP_DEPTEST && !config->op_d_resolve)) {
/* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */ /* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */
} else { } else {
ERR(NL, "you cannot perform this operation unless you are root.\n"); ERR(NL, _("you cannot perform this operation unless you are root.\n"));
config_free(config); config_free(config);
exit(1); exit(1);
} }
@ -456,7 +457,7 @@ int main(int argc, char *argv[])
/* initialize pm library */ /* initialize pm library */
if(alpm_initialize(config->root) == -1) { if(alpm_initialize(config->root) == -1) {
ERR(NL, "failed to initilize alpm library (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to initilize alpm library (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
@ -469,11 +470,11 @@ int main(int argc, char *argv[])
/* set library parameters */ /* set library parameters */
if(alpm_set_option(PM_OPT_LOGMASK, (long)config->debug) == -1) { if(alpm_set_option(PM_OPT_LOGMASK, (long)config->debug) == -1) {
ERR(NL, "failed to set option LOGMASK (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option LOGMASK (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
if(alpm_set_option(PM_OPT_LOGCB, (long)cb_log) == -1) { if(alpm_set_option(PM_OPT_LOGCB, (long)cb_log) == -1) {
ERR(NL, "failed to set option LOGCB (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option LOGCB (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
if(config->dbpath == NULL) { if(config->dbpath == NULL) {
@ -481,39 +482,39 @@ int main(int argc, char *argv[])
} else { } else {
/* dbpath has been set by parseargs or parseconfig */ /* dbpath has been set by parseargs or parseconfig */
if(alpm_set_option(PM_OPT_DBPATH, (long)config->dbpath) == -1) { if(alpm_set_option(PM_OPT_DBPATH, (long)config->dbpath) == -1) {
ERR(NL, "failed to set option DBPATH (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option DBPATH (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
} }
if(alpm_set_option(PM_OPT_CACHEDIR, (long)config->cachedir) == -1) { if(alpm_set_option(PM_OPT_CACHEDIR, (long)config->cachedir) == -1) {
ERR(NL, "failed to set option CACHEDIR (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option CACHEDIR (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
for(lp = config->op_s_ignore; lp; lp = lp->next) { for(lp = config->op_s_ignore; lp; lp = lp->next) {
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) { if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) {
ERR(NL, "failed to set option IGNOREPKG (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
} }
if(config->verbose > 0) { if(config->verbose > 0) {
printf("Root : %s\n", config->root); printf(_("Root : %s\n"), config->root);
printf("DBPath: %s\n", config->dbpath); printf(_("DBPath: %s\n"), config->dbpath);
list_display("Targets:", pm_targets); list_display(_("Targets:"), pm_targets);
} }
/* Opening local database */ /* Opening local database */
db_local = alpm_db_register("local"); db_local = alpm_db_register("local");
if(db_local == NULL) { if(db_local == NULL) {
ERR(NL, "could not register 'local' database (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("could not register 'local' database (%s)\n"), alpm_strerror(pm_errno));
cleanup(1); cleanup(1);
} }
if(list_count(pm_targets) == 0 && !(config->op == PM_OP_QUERY || (config->op == PM_OP_SYNC if(list_count(pm_targets) == 0 && !(config->op == PM_OP_QUERY || (config->op == PM_OP_SYNC
&& (config->op_s_sync || config->op_s_upgrade || config->op_s_clean || config->group && (config->op_s_sync || config->op_s_upgrade || config->op_s_clean || config->group
|| config->op_q_list)))) { || config->op_q_list)))) {
ERR(NL, "no targets specified (use -h for help)\n"); ERR(NL, _("no targets specified (use -h for help)\n"));
cleanup(1); cleanup(1);
} }
@ -526,7 +527,7 @@ int main(int argc, char *argv[])
case PM_OP_SYNC: ret = pacman_sync(pm_targets); break; case PM_OP_SYNC: ret = pacman_sync(pm_targets); break;
case PM_OP_DEPTEST: ret = pacman_deptest(pm_targets); break; case PM_OP_DEPTEST: ret = pacman_deptest(pm_targets); break;
default: default:
ERR(NL, "no operation specified (use -h for help)\n"); ERR(NL, _("no operation specified (use -h for help)\n"));
ret = 1; ret = 1;
} }

View File

@ -24,6 +24,7 @@
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -52,12 +53,12 @@ static int query_fileowner(PM_DB *db, char *filename)
return(0); return(0);
} }
if(filename == NULL || strlen(filename) == 0) { if(filename == NULL || strlen(filename) == 0) {
ERR(NL, "no file was specified for --owns\n"); ERR(NL, _("no file was specified for --owns\n"));
return(1); return(1);
} }
if(stat(filename, &buf) == -1 || S_ISDIR(buf.st_mode) || realpath(filename, rpath) == NULL) { if(stat(filename, &buf) == -1 || S_ISDIR(buf.st_mode) || realpath(filename, rpath) == NULL) {
ERR(NL, "%s is not a file.\n", filename); ERR(NL, _("%s is not a file.\n"), filename);
return(1); return(1);
} }
@ -74,7 +75,7 @@ static int query_fileowner(PM_DB *db, char *filename)
snprintf(path, PATH_MAX, "%s%s", root, (char *)alpm_list_getdata(i)); snprintf(path, PATH_MAX, "%s%s", root, (char *)alpm_list_getdata(i));
if(!strcmp(path, rpath)) { if(!strcmp(path, rpath)) {
printf("%s is owned by %s %s\n", filename, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME), printf(_("%s is owned by %s %s\n"), filename, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(info, PM_PKG_VERSION)); (char *)alpm_pkg_getinfo(info, PM_PKG_VERSION));
gotcha = 1; gotcha = 1;
break; break;
@ -82,7 +83,7 @@ static int query_fileowner(PM_DB *db, char *filename)
} }
} }
if(!gotcha) { if(!gotcha) {
ERR(NL, "No package owns %s\n", filename); ERR(NL, _("No package owns %s\n"), filename);
return(1); return(1);
} }
@ -107,7 +108,7 @@ int pacman_query(list_t *targets)
if(config->op_q_foreign) { if(config->op_q_foreign) {
if(pmc_syncs == NULL || !list_count(pmc_syncs)) { if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
ERR(NL, "no usable package repositories configured.\n"); ERR(NL, _("no usable package repositories configured.\n"));
return(1); return(1);
} }
@ -156,7 +157,7 @@ int pacman_query(list_t *targets)
MSG(NL, "%s %s\n", package, (char *)alpm_list_getdata(i)); MSG(NL, "%s %s\n", package, (char *)alpm_list_getdata(i));
} }
} else { } else {
ERR(NL, "group \"%s\" was not found\n", package); ERR(NL, _("group \"%s\" was not found\n"), package);
return(2); return(2);
} }
} }
@ -166,11 +167,11 @@ int pacman_query(list_t *targets)
/* output info for a .tar.gz package */ /* output info for a .tar.gz package */
if(config->op_q_isfile) { if(config->op_q_isfile) {
if(package == NULL) { if(package == NULL) {
ERR(NL, "no package file was specified for --file\n"); ERR(NL, _("no package file was specified for --file\n"));
return(1); return(1);
} }
if(alpm_pkg_load(package, &info) == -1) { if(alpm_pkg_load(package, &info) == -1) {
ERR(NL, "failed to load package '%s' (%s)\n", package, alpm_strerror(pm_errno)); ERR(NL, _("failed to load package '%s' (%s)\n"), package, alpm_strerror(pm_errno));
return(1); return(1);
} }
if(config->op_q_info) { if(config->op_q_info) {
@ -208,7 +209,7 @@ int pacman_query(list_t *targets)
info = alpm_db_readpkg(db_local, pkgname); info = alpm_db_readpkg(db_local, pkgname);
if(info == NULL) { if(info == NULL) {
/* something weird happened */ /* something weird happened */
ERR(NL, "package \"%s\" not found\n", pkgname); ERR(NL, _("package \"%s\" not found\n"), pkgname);
return(1); return(1);
} }
if(config->op_q_foreign) { if(config->op_q_foreign) {
@ -252,7 +253,7 @@ int pacman_query(list_t *targets)
info = alpm_db_readpkg(db_local, package); info = alpm_db_readpkg(db_local, package);
if(info == NULL) { if(info == NULL) {
ERR(NL, "package \"%s\" not found\n", package); ERR(NL, _("package \"%s\" not found\n"), package);
return(2); return(2);
} }

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -60,11 +61,11 @@ int pacman_remove(list_t *targets)
pkgnames = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES); pkgnames = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES);
MSG(NL, ":: group %s:\n", alpm_grp_getinfo(grp, PM_GRP_NAME)); MSG(NL, _(":: group %s:\n"), alpm_grp_getinfo(grp, PM_GRP_NAME));
PM_LIST_display(" ", pkgnames); PM_LIST_display(" ", pkgnames);
all = yesno(" Remove whole content? [Y/n] "); all = yesno(_(" Remove whole content? [Y/n] "));
for(lp = alpm_list_first(pkgnames); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(pkgnames); lp; lp = alpm_list_next(lp)) {
if(all || yesno(":: Remove %s from group %s? [Y/n] ", (char *)alpm_list_getdata(lp), i->data)) { if(all || yesno(_(":: Remove %s from group %s? [Y/n] "), (char *)alpm_list_getdata(lp), i->data)) {
finaltargs = list_add(finaltargs, strdup(alpm_list_getdata(lp))); finaltargs = list_add(finaltargs, strdup(alpm_list_getdata(lp)));
} }
} }
@ -77,10 +78,10 @@ int pacman_remove(list_t *targets)
/* Step 1: create a new transaction /* Step 1: create a new transaction
*/ */
if(alpm_trans_init(PM_TRANS_TYPE_REMOVE, config->flags, cb_trans_evt, cb_trans_conv) == -1) { if(alpm_trans_init(PM_TRANS_TYPE_REMOVE, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) { if(pm_errno == PM_ERR_HANDLE_LOCK) {
MSG(NL, " if you're sure a package manager is not already running,\n" MSG(NL, _(" if you're sure a package manager is not already running,\n"
" you can remove %s\n", PM_LOCK); " you can remove %s\n"), PM_LOCK);
} }
FREELIST(finaltargs); FREELIST(finaltargs);
return(1); return(1);
@ -90,12 +91,12 @@ int pacman_remove(list_t *targets)
/* check if the package is in the HoldPkg list. If so, ask /* check if the package is in the HoldPkg list. If so, ask
* confirmation first */ * confirmation first */
if(list_is_strin(i->data, config->holdpkg)) { if(list_is_strin(i->data, config->holdpkg)) {
if(!yesno(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] ", i->data)) { if(!yesno(_(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "), i->data)) {
return(1); return(1);
} }
} }
if(alpm_trans_addtarget(i->data) == -1) { if(alpm_trans_addtarget(i->data) == -1) {
ERR(NL, "failed to add target '%s' (%s)\n", (char *)i->data, alpm_strerror(pm_errno)); ERR(NL, _("failed to add target '%s' (%s)\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -105,12 +106,12 @@ int pacman_remove(list_t *targets)
*/ */
if(alpm_trans_prepare(&data) == -1) { if(alpm_trans_prepare(&data) == -1) {
PM_LIST *lp; PM_LIST *lp;
ERR(NL, "failed to prepare transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) { switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS: case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp); PM_DEPMISS *miss = alpm_list_getdata(lp);
MSG(NL, " %s: is required by %s\n", alpm_dep_getinfo(miss, PM_DEP_TARGET), MSG(NL, _(" %s: is required by %s\n"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
alpm_dep_getinfo(miss, PM_DEP_NAME)); alpm_dep_getinfo(miss, PM_DEP_NAME));
} }
alpm_list_free(data); alpm_list_free(data);
@ -132,10 +133,10 @@ int pacman_remove(list_t *targets)
PM_PKG *pkg = alpm_list_getdata(lp); PM_PKG *pkg = alpm_list_getdata(lp);
i = list_add(i, strdup(alpm_pkg_getinfo(pkg, PM_PKG_NAME))); i = list_add(i, strdup(alpm_pkg_getinfo(pkg, PM_PKG_NAME)));
} }
list_display("\nTargets:", i); list_display(_("\nTargets:"), i);
FREELIST(i); FREELIST(i);
/* get confirmation */ /* get confirmation */
if(yesno("\nDo you want to remove these packages? [Y/n] ") == 0) { if(yesno(_("\nDo you want to remove these packages? [Y/n] ")) == 0) {
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -145,7 +146,7 @@ int pacman_remove(list_t *targets)
/* Step 3: actually perform the removal /* Step 3: actually perform the removal
*/ */
if(alpm_trans_commit(NULL) == -1) { if(alpm_trans_commit(NULL) == -1) {
ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -156,7 +157,7 @@ cleanup:
FREELIST(finaltargs); FREELIST(finaltargs);
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
} }

View File

@ -26,6 +26,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <libintl.h>
#ifdef CYGWIN #ifdef CYGWIN
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#endif #endif
@ -64,10 +65,10 @@ static int sync_cleancache(int level)
list_t *clean = NULL; list_t *clean = NULL;
list_t *i, *j; list_t *i, *j;
MSG(NL, "removing old packages from cache... "); MSG(NL, _("removing old packages from cache... "));
dir = opendir(dirpath); dir = opendir(dirpath);
if(dir == NULL) { if(dir == NULL) {
ERR(NL, "could not access cache directory\n"); ERR(NL, _("could not access cache directory\n"));
return(1); return(1);
} }
rewinddir(dir); rewinddir(dir);
@ -127,20 +128,20 @@ static int sync_cleancache(int level)
FREELIST(clean); FREELIST(clean);
} else { } else {
/* full cleanup */ /* full cleanup */
MSG(NL, "removing all packages from cache... "); MSG(NL, _("removing all packages from cache... "));
if(rmrf(dirpath)) { if(rmrf(dirpath)) {
ERR(NL, "could not remove cache directory\n"); ERR(NL, _("could not remove cache directory\n"));
return(1); return(1);
} }
if(makepath(dirpath)) { if(makepath(dirpath)) {
ERR(NL, "could not create new cache directory\n"); ERR(NL, _("could not create new cache directory\n"));
return(1); return(1);
} }
} }
MSG(CL, "done.\n"); MSG(CL, _("done.\n"));
return(0); return(0);
} }
@ -164,7 +165,7 @@ static int sync_synctree(int level, list_t *syncs)
/* get the lastupdate time */ /* get the lastupdate time */
db_getlastupdate(sync->db, lastupdate); db_getlastupdate(sync->db, lastupdate);
if(strlen(lastupdate) == 0) { if(strlen(lastupdate) == 0) {
vprint("failed to get lastupdate time for %s (no big deal)\n", sync->treename); vprint(_("failed to get lastupdate time for %s (no big deal)\n"), sync->treename);
} }
} }
@ -177,18 +178,18 @@ static int sync_synctree(int level, list_t *syncs)
ret = downloadfiles_forreal(sync->servers, path, files, lastupdate, newmtime); ret = downloadfiles_forreal(sync->servers, path, files, lastupdate, newmtime);
FREELIST(files); FREELIST(files);
if(ret > 0) { if(ret > 0) {
ERR(NL, "failed to synchronize %s\n", sync->treename); ERR(NL, _("failed to synchronize %s\n"), sync->treename);
success--; success--;
} else if(ret < 0) { } else if(ret < 0) {
MSG(NL, " %s is up to date\n", sync->treename); MSG(NL, _(" %s is up to date\n"), sync->treename);
} else { } else {
if(strlen(newmtime)) { if(strlen(newmtime)) {
vprint("sync: new mtime for %s: %s\n", sync->treename, newmtime); vprint(_("sync: new mtime for %s: %s\n"), sync->treename, newmtime);
db_setlastupdate(sync->db, newmtime); db_setlastupdate(sync->db, newmtime);
} }
snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename); snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename);
if(alpm_db_update(sync->db, path) == -1) { if(alpm_db_update(sync->db, path) == -1) {
ERR(NL, "failed to update %s (%s)\n", sync->treename, alpm_strerror(pm_errno)); ERR(NL, _("failed to update %s (%s)\n"), sync->treename, alpm_strerror(pm_errno));
} }
/* remove the .tar.gz */ /* remove the .tar.gz */
unlink(path); unlink(path);
@ -214,7 +215,7 @@ static int sync_search(list_t *syncs, list_t *targets)
for(lp = alpm_db_getpkgcache(sync->db); lp; lp = alpm_list_next(lp)) { for(lp = alpm_db_getpkgcache(sync->db); lp; lp = alpm_list_next(lp)) {
PM_PKG *pkg = alpm_list_getdata(lp); PM_PKG *pkg = alpm_list_getdata(lp);
MSG(NL, "%s/%s %s\n ", sync->treename, (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION)); MSG(NL, _("%s/%s %s\n "), sync->treename, (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME), (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 4); indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 4);
MSG(NL, "\n"); MSG(NL, "\n");
} }
@ -282,7 +283,7 @@ static int sync_info(list_t *syncs, list_t *targets)
} }
} }
if(!found) { if(!found) {
ERR(NL, "package \"%s\" was not found.\n", (char *)i->data); ERR(NL, _("package \"%s\" was not found.\n"), (char *)i->data);
break; break;
} }
} }
@ -320,7 +321,7 @@ static int sync_list(list_t *syncs, list_t *targets)
} }
if(sync == NULL) { if(sync == NULL) {
ERR(NL, "repository \"%s\" was not found.\n", (char *)i->data); ERR(NL, _("repository \"%s\" was not found.\n"), (char *)i->data);
FREELISTPTR(ls); FREELISTPTR(ls);
return(1); return(1);
} }
@ -361,7 +362,7 @@ int pacman_sync(list_t *targets)
list_t *files = NULL; list_t *files = NULL;
if(pmc_syncs == NULL || !list_count(pmc_syncs)) { if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
ERR(NL, "no usable package repositories configured.\n"); ERR(NL, _("no usable package repositories configured.\n"));
return(1); return(1);
} }
@ -381,8 +382,8 @@ int pacman_sync(list_t *targets)
if(config->op_s_sync) { if(config->op_s_sync) {
/* grab a fresh package list */ /* grab a fresh package list */
MSG(NL, ":: Synchronizing package databases...\n"); MSG(NL, _(":: Synchronizing package databases...\n"));
alpm_logaction("synchronizing package lists"); alpm_logaction(_("synchronizing package lists"));
if(sync_synctree(config->op_s_sync, pmc_syncs)) { if(sync_synctree(config->op_s_sync, pmc_syncs)) {
return(1); return(1);
} }
@ -407,17 +408,17 @@ int pacman_sync(list_t *targets)
/* Step 1: create a new transaction... /* Step 1: create a new transaction...
*/ */
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) { if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) { if(pm_errno == PM_ERR_HANDLE_LOCK) {
MSG(NL, " if you're sure a package manager is not already running,\n" MSG(NL, _(" if you're sure a package manager is not already running,\n"
" you can remove %s\n", PM_LOCK); " you can remove %s\n"), PM_LOCK);
} }
return(1); return(1);
} }
if(config->op_s_upgrade) { if(config->op_s_upgrade) {
MSG(NL, ":: Starting local database upgrade...\n"); MSG(NL, _(":: Starting local database upgrade...\n"));
alpm_logaction("starting full system upgrade"); alpm_logaction(_("starting full system upgrade"));
if(alpm_trans_sysupgrade() == -1) { if(alpm_trans_sysupgrade() == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno)); ERR(NL, "%s\n", alpm_strerror(pm_errno));
retval = 1; retval = 1;
@ -435,26 +436,26 @@ int pacman_sync(list_t *targets)
PM_SYNCPKG *sync = alpm_list_getdata(lp); PM_SYNCPKG *sync = alpm_list_getdata(lp);
PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG); PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
if(!strcmp("pacman", alpm_pkg_getinfo(spkg, PM_PKG_NAME)) && alpm_list_count(data) > 1) { if(!strcmp("pacman", alpm_pkg_getinfo(spkg, PM_PKG_NAME)) && alpm_list_count(data) > 1) {
MSG(NL, "\n:: pacman has detected a newer version of the \"pacman\" package.\n"); MSG(NL, _("\n:: pacman has detected a newer version of the \"pacman\" package.\n"));
MSG(NL, ":: It is recommended that you allow pacman to upgrade itself\n"); MSG(NL, _(":: It is recommended that you allow pacman to upgrade itself\n"));
MSG(NL, ":: first, then you can re-run the operation with the newer version.\n"); MSG(NL, _(":: first, then you can re-run the operation with the newer version.\n"));
MSG(NL, "::\n"); MSG(NL, _("::\n"));
if(yesno(":: Upgrade pacman first? [Y/n] ")) { if(yesno(_(":: Upgrade pacman first? [Y/n] "))) {
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) { if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) { if(pm_errno == PM_ERR_HANDLE_LOCK) {
MSG(NL, " if you're sure a package manager is not already running,\n" MSG(NL, _(" if you're sure a package manager is not already running,\n"
" you can remove %s\n", PM_LOCK); " you can remove %s\n"), PM_LOCK);
} }
return(1); return(1);
} }
if(alpm_trans_addtarget("pacman") == -1) { if(alpm_trans_addtarget("pacman") == -1) {
ERR(NL, "could not add target '%s': %s\n", (char *)i->data, alpm_strerror(pm_errno)); ERR(NL, _("could not add target '%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -474,7 +475,7 @@ int pacman_sync(list_t *targets)
continue; continue;
} }
if(pm_errno != PM_ERR_PKG_NOT_FOUND) { if(pm_errno != PM_ERR_PKG_NOT_FOUND) {
ERR(NL, "could not add target '%s': %s\n", (char *)i->data, alpm_strerror(pm_errno)); ERR(NL, _("could not add target '%s': %s\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -485,20 +486,20 @@ int pacman_sync(list_t *targets)
if(grp) { if(grp) {
PM_LIST *pmpkgs; PM_LIST *pmpkgs;
list_t *k, *pkgs; list_t *k, *pkgs;
MSG(NL, ":: group %s:\n", targ); MSG(NL, _(":: group %s:\n"), targ);
pmpkgs = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES); pmpkgs = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES);
/* remove dupe entries in case a package exists in multiple repos */ /* remove dupe entries in case a package exists in multiple repos */
/* (the dupe function takes a PM_LIST* and returns a list_t*) */ /* (the dupe function takes a PM_LIST* and returns a list_t*) */
pkgs = PM_LIST_remove_dupes(pmpkgs); pkgs = PM_LIST_remove_dupes(pmpkgs);
list_display(" ", pkgs); list_display(" ", pkgs);
if(yesno(":: Install whole content? [Y/n] ")) { if(yesno(_(":: Install whole content? [Y/n] "))) {
for(k = pkgs; k; k = k->next) { for(k = pkgs; k; k = k->next) {
targets = list_add(targets, strdup(k->data)); targets = list_add(targets, strdup(k->data));
} }
} else { } else {
for(k = pkgs; k; k = k->next) { for(k = pkgs; k; k = k->next) {
char *pkgname = k->data; char *pkgname = k->data;
if(yesno(":: Install %s from group %s? [Y/n] ", pkgname, targ)) { if(yesno(_(":: Install %s from group %s? [Y/n] "), pkgname, targ)) {
targets = list_add(targets, strdup(pkgname)); targets = list_add(targets, strdup(pkgname));
} }
} }
@ -518,13 +519,13 @@ int pacman_sync(list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags /* Step 2: "compute" the transaction based on targets and flags
*/ */
if(alpm_trans_prepare(&data) == -1) { if(alpm_trans_prepare(&data) == -1) {
ERR(NL, "failed to prepare transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) { switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS: case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp); PM_DEPMISS *miss = alpm_list_getdata(lp);
MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET), MSG(NL, _(":: %s: %s %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
(int)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? "requires" : "is required by", (int)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
alpm_dep_getinfo(miss, PM_DEP_NAME)); alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) { switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break; case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@ -589,7 +590,7 @@ int pacman_sync(list_t *targets)
list_install = list_add(list_install, str); list_install = list_add(list_install, str);
} }
if(list_remove) { if(list_remove) {
MSG(NL, "\nRemove: "); MSG(NL, _("\nRemove: "));
str = buildstring(list_remove); str = buildstring(list_remove);
indentprint(str, 9); indentprint(str, 9);
MSG(CL, "\n"); MSG(CL, "\n");
@ -601,20 +602,20 @@ int pacman_sync(list_t *targets)
if(mb < 0.1) { if(mb < 0.1) {
mb = 0.1; mb = 0.1;
} }
MSG(NL, "\nTargets: "); MSG(NL, _("\nTargets: "));
str = buildstring(list_install); str = buildstring(list_install);
indentprint(str, 9); indentprint(str, 9);
MSG(NL, "\nTotal Package Size: %.1f MB\n", mb); MSG(NL, _("\nTotal Package Size: %.1f MB\n"), mb);
FREELIST(list_install); FREELIST(list_install);
FREE(str); FREE(str);
if(config->op_s_downloadonly) { if(config->op_s_downloadonly) {
if(config->noconfirm) { if(config->noconfirm) {
MSG(NL, "\nBeginning download...\n"); MSG(NL, _("\nBeginning download...\n"));
confirm = 1; confirm = 1;
} else { } else {
MSG(NL, "\n"); MSG(NL, "\n");
confirm = yesno("Proceed with download? [Y/n] "); confirm = yesno(_("Proceed with download? [Y/n] "));
} }
} else { } else {
/* don't get any confirmation if we're called from makepkg */ /* don't get any confirmation if we're called from makepkg */
@ -622,11 +623,11 @@ int pacman_sync(list_t *targets)
confirm = 1; confirm = 1;
} else { } else {
if(config->noconfirm) { if(config->noconfirm) {
MSG(NL, "\nBeginning upgrade process...\n"); MSG(NL, _("\nBeginning upgrade process...\n"));
confirm = 1; confirm = 1;
} else { } else {
MSG(NL, "\n"); MSG(NL, "\n");
confirm = yesno("Proceed with upgrade? [Y/n] "); confirm = yesno(_("Proceed with upgrade? [Y/n] "));
} }
} }
} }
@ -672,7 +673,7 @@ int pacman_sync(list_t *targets)
snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver); snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver);
files = list_add(files, strdup(path)); files = list_add(files, strdup(path));
} else { } else {
vprint(" %s-%s" PM_EXT_PKG " is already in the cache\n", pkgname, pkgver); vprint(_(" %s-%s" PM_EXT_PKG " is already in the cache\n"), pkgname, pkgver);
} }
} }
} }
@ -680,28 +681,28 @@ int pacman_sync(list_t *targets)
if(files) { if(files) {
struct stat buf; struct stat buf;
MSG(NL, "\n:: Retrieving packages from %s...\n", current->treename); MSG(NL, _("\n:: Retrieving packages from %s...\n"), current->treename);
fflush(stdout); fflush(stdout);
if(stat(ldir, &buf)) { if(stat(ldir, &buf)) {
/* no cache directory.... try creating it */ /* no cache directory.... try creating it */
WARN(NL, "no %s cache exists. creating...\n", ldir); WARN(NL, _("no %s cache exists. creating...\n"), ldir);
alpm_logaction("warning: no %s cache exists. creating...", ldir); alpm_logaction(_("warning: no %s cache exists. creating..."), ldir);
if(makepath(ldir)) { if(makepath(ldir)) {
/* couldn't mkdir the cache directory, so fall back to /tmp and unlink /* couldn't mkdir the cache directory, so fall back to /tmp and unlink
* the package afterwards. * the package afterwards.
*/ */
WARN(NL, "couldn't create package cache, using /tmp instead"); WARN(NL, _("couldn't create package cache, using /tmp instead"));
alpm_logaction("warning: couldn't create package cache, using /tmp instead"); alpm_logaction(_("warning: couldn't create package cache, using /tmp instead"));
snprintf(ldir, PATH_MAX, "/tmp"); snprintf(ldir, PATH_MAX, "/tmp");
if(alpm_set_option(PM_OPT_CACHEDIR, (long)ldir) == -1) { if(alpm_set_option(PM_OPT_CACHEDIR, (long)ldir) == -1) {
ERR(NL, "failed to set option CACHEDIR (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to set option CACHEDIR (%s)\n"), alpm_strerror(pm_errno));
goto cleanup; goto cleanup;
} }
varcache = 0; varcache = 0;
} }
} }
if(downloadfiles(current->servers, ldir, files)) { if(downloadfiles(current->servers, ldir, files)) {
ERR(NL, "failed to retrieve some files from %s\n", current->treename); ERR(NL, _("failed to retrieve some files from %s\n"), current->treename);
retval = 1; retval = 1;
goto cleanup; goto cleanup;
} }
@ -714,16 +715,16 @@ int pacman_sync(list_t *targets)
MSG(NL, "\n"); MSG(NL, "\n");
/* Check integrity of files */ /* Check integrity of files */
MSG(NL, "checking package integrity... "); MSG(NL, _("checking package integrity... "));
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
PM_SYNCPKG *sync = alpm_list_getdata(lp); PM_SYNCPKG *sync = alpm_list_getdata(lp);
PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG); PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
if(alpm_pkg_checkmd5sum(spkg) == -1) { if(alpm_pkg_checkmd5sum(spkg) == -1) {
if(pm_errno == PM_ERR_PKG_INVALID) { if(pm_errno == PM_ERR_PKG_INVALID) {
ERR(NL, "archive %s is corrupted\n", alpm_pkg_getinfo(spkg, PM_PKG_NAME)); ERR(NL, _("archive %s is corrupted\n"), alpm_pkg_getinfo(spkg, PM_PKG_NAME));
} else { } else {
ERR(NL, "could not get checksum for package %s (%s)\n", ERR(NL, _("could not get checksum for package %s (%s)\n"),
alpm_pkg_getinfo(spkg, PM_PKG_NAME), alpm_strerror(pm_errno)); alpm_pkg_getinfo(spkg, PM_PKG_NAME), alpm_strerror(pm_errno));
} }
retval = 1; retval = 1;
@ -732,7 +733,7 @@ int pacman_sync(list_t *targets)
if(retval) { if(retval) {
goto cleanup; goto cleanup;
} }
MSG(CL, "done.\n"); MSG(CL, _("done.\n"));
if(config->op_s_downloadonly) { if(config->op_s_downloadonly) {
goto cleanup; goto cleanup;
@ -741,27 +742,27 @@ int pacman_sync(list_t *targets)
/* Step 3: actually perform the installation /* Step 3: actually perform the installation
*/ */
if(alpm_trans_commit(&data) == -1) { if(alpm_trans_commit(&data) == -1) {
ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) { switch(pm_errno) {
case PM_ERR_FILE_CONFLICTS: case PM_ERR_FILE_CONFLICTS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_CONFLICT *conflict = alpm_list_getdata(lp); PM_CONFLICT *conflict = alpm_list_getdata(lp);
switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) { switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET: case PM_CONFLICT_TYPE_TARGET:
MSG(NL, "%s exists in \"%s\" (target) and \"%s\" (target)", MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE), (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET), (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET)); (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break; break;
case PM_CONFLICT_TYPE_FILE: case PM_CONFLICT_TYPE_FILE:
MSG(NL, "%s: %s exists in filesystem", MSG(NL, _("%s: %s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET), (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE)); (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break; break;
} }
} }
alpm_list_free(data); alpm_list_free(data);
MSG(NL, "\nerrors occurred, no packages were upgraded.\n"); MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break; break;
default: default:
break; break;
@ -781,7 +782,7 @@ int pacman_sync(list_t *targets)
*/ */
cleanup: cleanup:
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1; retval = 1;
} }

View File

@ -26,6 +26,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <libintl.h>
#include <alpm.h> #include <alpm.h>
/* pacman */ /* pacman */
@ -47,49 +48,49 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
switch(event) { switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START: case PM_TRANS_EVT_CHECKDEPS_START:
MSG(NL, "checking dependencies... "); MSG(NL, _("checking dependencies... "));
break; break;
case PM_TRANS_EVT_FILECONFLICTS_START: case PM_TRANS_EVT_FILECONFLICTS_START:
MSG(NL, "checking for file conflicts... "); MSG(NL, _("checking for file conflicts... "));
break; break;
case PM_TRANS_EVT_RESOLVEDEPS_START: case PM_TRANS_EVT_RESOLVEDEPS_START:
MSG(NL, "resolving dependencies... "); MSG(NL, _("resolving dependencies... "));
break; break;
case PM_TRANS_EVT_INTERCONFLICTS_START: case PM_TRANS_EVT_INTERCONFLICTS_START:
MSG(NL, "looking for inter-conflicts... "); MSG(NL, _("looking for inter-conflicts... "));
break; break;
case PM_TRANS_EVT_CHECKDEPS_DONE: case PM_TRANS_EVT_CHECKDEPS_DONE:
case PM_TRANS_EVT_FILECONFLICTS_DONE: case PM_TRANS_EVT_FILECONFLICTS_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE: case PM_TRANS_EVT_RESOLVEDEPS_DONE:
case PM_TRANS_EVT_INTERCONFLICTS_DONE: case PM_TRANS_EVT_INTERCONFLICTS_DONE:
MSG(CL, "done.\n"); MSG(CL, _("done.\n"));
break; break;
case PM_TRANS_EVT_ADD_START: case PM_TRANS_EVT_ADD_START:
MSG(NL, "installing %s... ", (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME)); MSG(NL, _("installing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
break; break;
case PM_TRANS_EVT_ADD_DONE: case PM_TRANS_EVT_ADD_DONE:
MSG(CL, "done.\n"); MSG(CL, _("done.\n"));
snprintf(str, LOG_STR_LEN, "installed %s (%s)", snprintf(str, LOG_STR_LEN, _("installed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str); alpm_logaction(str);
break; break;
case PM_TRANS_EVT_REMOVE_START: case PM_TRANS_EVT_REMOVE_START:
MSG(NL, "removing %s... ", (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME)); MSG(NL, _("removing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
break; break;
case PM_TRANS_EVT_REMOVE_DONE: case PM_TRANS_EVT_REMOVE_DONE:
MSG(CL, "done.\n"); MSG(CL, _("done.\n"));
snprintf(str, LOG_STR_LEN, "removed %s (%s)", snprintf(str, LOG_STR_LEN, _("removed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str); alpm_logaction(str);
break; break;
case PM_TRANS_EVT_UPGRADE_START: case PM_TRANS_EVT_UPGRADE_START:
MSG(NL, "upgrading %s... ", (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME)); MSG(NL, _("upgrading %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
break; break;
case PM_TRANS_EVT_UPGRADE_DONE: case PM_TRANS_EVT_UPGRADE_DONE:
MSG(CL, "done.\n"); MSG(CL, _("done.\n"));
snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)", snprintf(str, LOG_STR_LEN, _("upgraded %s (%s -> %s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION), (char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
@ -104,20 +105,20 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
switch(event) { switch(event) {
case PM_TRANS_CONV_INSTALL_IGNOREPKG: case PM_TRANS_CONV_INSTALL_IGNOREPKG:
snprintf(str, LOG_STR_LEN, ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] ", snprintf(str, LOG_STR_LEN, _(":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
*response = yesno(str); *response = yesno(str);
break; break;
case PM_TRANS_CONV_REPLACE_PKG: case PM_TRANS_CONV_REPLACE_PKG:
snprintf(str, LOG_STR_LEN, ":: Replace %s with %s/%s? [Y/n] ", snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)data3, (char *)data3,
(char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
*response = yesno(str); *response = yesno(str);
break; break;
case PM_TRANS_CONV_CONFLICT_PKG: case PM_TRANS_CONV_CONFLICT_PKG:
snprintf(str, LOG_STR_LEN, ":: %s conflicts with %s. Remove %s? [Y/n] ", snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
(char *)data1, (char *)data1,
(char *)data2, (char *)data2,
(char *)data2); (char *)data2);
@ -125,7 +126,7 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
break; break;
case PM_TRANS_CONV_LOCAL_NEWER: case PM_TRANS_CONV_LOCAL_NEWER:
if(!config->op_s_downloadonly) { if(!config->op_s_downloadonly) {
snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ", snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
*response = yesno(str); *response = yesno(str);
@ -135,7 +136,7 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
break; break;
case PM_TRANS_CONV_LOCAL_UPTODATE: case PM_TRANS_CONV_LOCAL_UPTODATE:
if(!config->op_s_downloadonly) { if(!config->op_s_downloadonly) {
snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] ", snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
*response = yesno(str); *response = yesno(str);

View File

@ -30,6 +30,7 @@
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <regex.h> #include <regex.h>
#include <libintl.h>
#ifdef CYGWIN #ifdef CYGWIN
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#endif #endif
@ -168,7 +169,7 @@ char *buildstring(list_t *strlist)
} }
str = (char *)malloc(size); str = (char *)malloc(size);
if(str == NULL) { if(str == NULL) {
ERR(NL, "failed to allocated %d bytes\n", size); ERR(NL, _("failed to allocated %d bytes\n"), size);
} }
str[0] = '\0'; str[0] = '\0';
for(lp = strlist; lp; lp = lp->next) { for(lp = strlist; lp; lp = lp->next) {
@ -222,7 +223,7 @@ int reg_match(char *string, char *pattern)
regex_t reg; regex_t reg;
if(regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) { if(regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) {
ERR(NL, "%s is not a valid regular expression.\n", pattern); ERR(NL, _("%s is not a valid regular expression.\n"), pattern);
return(-1); return(-1);
} }
result = regexec(&reg, string, 0, 0, 0); result = regexec(&reg, string, 0, 0, 0);

View File

@ -42,6 +42,8 @@
s1[(len)-1] = 0; \ s1[(len)-1] = 0; \
} while(0) } while(0)
#define _(str) gettext(str)
int makepath(char *path); int makepath(char *path);
int rmrf(char *path); int rmrf(char *path);
void indentprint(char *str, int indent); void indentprint(char *str, int indent);