summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-10-15 21:34:52 +0200
committerAaron Griffin <aaron@archlinux.org>2006-10-15 21:34:52 +0200
commit3f27542156125118800235c5ac1bac125fd7752c (patch)
treee0ba3d5fd23be2c7ad5da14234622b032ab79191 /src
parentd37ad048732fbcef38aec001993553896dbe4198 (diff)
downloadpacman-3f27542156125118800235c5ac1bac125fd7752c.tar.gz
pacman-3f27542156125118800235c5ac1bac125fd7752c.tar.xz
Merged frugalware changes. Added a few other minor things too, but there's alot
to list. The diff should show you 8)
Diffstat (limited to 'src')
-rw-r--r--src/pacman/Makefile.am8
-rw-r--r--src/pacman/add.c34
-rw-r--r--src/pacman/conf.c296
-rw-r--r--src/pacman/conf.h14
-rw-r--r--src/pacman/deptest.c14
-rw-r--r--src/pacman/download.c483
-rw-r--r--src/pacman/download.h22
-rw-r--r--src/pacman/log.c9
-rw-r--r--src/pacman/log.h4
-rw-r--r--src/pacman/package.c69
-rw-r--r--src/pacman/package.h1
-rw-r--r--src/pacman/pacman.c245
-rw-r--r--src/pacman/po/LINGUAS4
-rw-r--r--src/pacman/po/Makefile.in.in4
-rw-r--r--src/pacman/po/POTFILES.in1
-rw-r--r--src/pacman/po/pacman.pot866
-rw-r--r--src/pacman/query.c49
-rw-r--r--src/pacman/remove.c12
-rw-r--r--src/pacman/sync.c295
-rw-r--r--src/pacman/sync.h1
-rw-r--r--src/pacman/trans.c257
-rw-r--r--src/pacman/trans.h2
-rw-r--r--src/pacman/util.c22
-rw-r--r--src/pacman/util.h2
24 files changed, 1009 insertions, 1705 deletions
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 8ebe02d5..6b5f8bc1 100644
--- a/src/pacman/Makefile.am
+++ b/src/pacman/Makefile.am
@@ -9,17 +9,15 @@ AM_CFLAGS = -D_GNU_SOURCE \
-I$(top_srcdir)/lib/libalpm \
-I$(top_srcdir)/lib/libftp
-pacman_SOURCES = util.c log.c list.c package.c db.c download.c trans.c add.c \
+pacman_SOURCES = util.c log.c list.c package.c download.c trans.c add.c \
remove.c upgrade.c query.c sync.c conf.c deptest.c pacman.c
pacman_static_SOURCES = $(pacman_SOURCES)
pacman_LDADD = \
- $(top_srcdir)/lib/libalpm/libalpm.la \
- $(top_srcdir)/lib/libftp/libftp.la
+ $(top_srcdir)/lib/libalpm/libalpm.la
pacman_static_LDADD = \
- $(top_srcdir)/lib/libalpm/.libs/libalpm.a \
- $(top_srcdir)/lib/libftp/.libs/libftp.a $(LDFLAGS)
+ $(top_srcdir)/lib/libalpm/.libs/libalpm.a $(LDFLAGS)
pacman_static_LDFLAGS = -all-static
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 04182df9..7c4cd909 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -50,7 +50,7 @@ int pacman_add(list_t *targets)
*/
for(i = targets; i; i = i->next) {
if(strstr(i->data, "://")) {
- char *str = fetch_pkgurl(i->data);
+ char *str = alpm_fetch_pkgurl(i->data);
if(str == NULL) {
return(1);
} else {
@@ -63,11 +63,11 @@ int pacman_add(list_t *targets)
/* Step 1: create a new transaction
*/
if(alpm_trans_init((config->upgrade == 0) ? PM_TRANS_TYPE_ADD : PM_TRANS_TYPE_UPGRADE,
- config->flags, cb_trans_evt, cb_trans_conv) == -1) {
+ config->flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
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%s\n"), config->root, PM_LOCK);
}
return(1);
}
@@ -86,6 +86,7 @@ int pacman_add(list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags
*/
if(alpm_trans_prepare(&data) == -1) {
+ long long *pkgsize, *freespace;
PM_LIST *i;
ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
@@ -95,7 +96,7 @@ int pacman_add(list_t *targets)
PM_DEPMISS *miss = alpm_list_getdata(i);
MSG(NL, _(":: %s: requires %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
+ switch((long)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_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -115,16 +116,18 @@ int pacman_add(list_t *targets)
case PM_ERR_FILE_CONFLICTS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
PM_CONFLICT *conflict = alpm_list_getdata(i);
- switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
+ switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET:
- MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
+ MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
+ config->root,
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break;
case PM_CONFLICT_TYPE_FILE:
- MSG(NL, _("%s: %s exists in filesystem"),
+ MSG(NL, _("%s: %s%s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
+ config->root,
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break;
}
@@ -132,10 +135,19 @@ int pacman_add(list_t *targets)
alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
+ case PM_ERR_DISK_FULL:
+ i = alpm_list_first(data);
+ pkgsize = alpm_list_getdata(i);
+ i = alpm_list_next(i);
+ freespace = alpm_list_getdata(i);
+ MSG(NL, _(":: %.1f MB required, have %.1f MB"),
+ (double)(*pkgsize / 1048576.0), (double)(*freespace / 1048576.0));
+ alpm_list_free(data);
+ break;
default:
break;
}
- retval = 1;
+ retval=1;
goto cleanup;
}
@@ -143,16 +155,14 @@ int pacman_add(list_t *targets)
*/
if(alpm_trans_commit(NULL) == -1) {
ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
- retval = 1;
+ retval=1;
goto cleanup;
}
- /* Step 4: release transaction resources
- */
cleanup:
if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
- retval = 1;
+ retval=1;
}
return(retval);
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 1caefd32..dc7b64b6 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -34,8 +34,6 @@
#include "download.h"
#include "conf.h"
-#define min(X, Y) ((X) < (Y) ? (X) : (Y))
-
extern list_t *pmc_syncs;
config_t *config_new()
@@ -56,303 +54,21 @@ int config_free(config_t *config)
}
FREE(config->root);
- FREE(config->dbpath);
- FREE(config->cachedir);
FREE(config->configfile);
FREELIST(config->op_s_ignore);
- FREE(config->proxyhost);
- FREE(config->xfercommand);
- FREELIST(config->holdpkg);
free(config);
return(0);
}
-int parseconfig(char *file, config_t *config)
+void cb_db_register(char *section, PM_DB *db)
{
- FILE *fp = NULL;
- char line[PATH_MAX+1];
- char *ptr = NULL;
- char *key = NULL;
- int linenum = 0;
- char section[256] = "";
- sync_t *sync = NULL;
-
- if(config == NULL) {
- return(-1);
- }
-
- fp = fopen(file, "r");
- if(fp == NULL) {
- return(0);
- }
-
- while(fgets(line, PATH_MAX, fp)) {
- linenum++;
- strtrim(line);
- if(strlen(line) == 0 || line[0] == '#') {
- continue;
- }
- if(line[0] == '[' && line[strlen(line)-1] == ']') {
- /* new config section */
- ptr = line;
- ptr++;
- strncpy(section, ptr, min(255, strlen(ptr)-1));
- section[min(255, strlen(ptr)-1)] = '\0';
- vprint(_("config: new section '%s'\n"), section);
- if(!strlen(section)) {
- ERR(NL, _("config: line %d: bad section name\n"), linenum);
- return(1);
- }
- if(!strcmp(section, "local")) {
- ERR(NL, _("config: line %d: '%s' is reserved and cannot be used as a package tree\n"),
- linenum, section);
- return(1);
- }
- if(strcmp(section, "options")) {
- list_t *i;
- int found = 0;
- for(i = pmc_syncs; i && !found; i = i->next) {
- sync = (sync_t *)i->data;
- if(!strcmp(sync->treename, section)) {
- found = 1;
- }
- }
- if(!found) {
- /* start a new sync record */
- MALLOC(sync, sizeof(sync_t));
- sync->treename = strdup(section);
- sync->servers = NULL;
- pmc_syncs = list_add(pmc_syncs, sync);
- }
- }
- } else {
- /* directive */
- ptr = line;
- key = strsep(&ptr, "=");
- if(key == NULL) {
- ERR(NL, _("config: line %d: syntax error\n"), linenum);
- return(1);
- }
- strtrim(key);
- key = strtoupper(key);
- if(!strlen(section) && strcmp(key, "INCLUDE")) {
- ERR(NL, _("config: line %d: all directives must belong to a section\n"), linenum);
- return(1);
- }
- if(ptr == NULL) {
- if(!strcmp(key, "NOPASSIVEFTP")) {
- config->nopassiveftp = 1;
- vprint(_("config: nopassiveftp\n"));
- } else if(!strcmp(key, "USESYSLOG")) {
- if(alpm_set_option(PM_OPT_USESYSLOG, (long)1) == -1) {
- ERR(NL, _("failed to set option USESYSLOG (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: usesyslog\n"));
- } else if(!strcmp(key, "ILOVECANDY")) {
- config->chomp = 1;
- } else {
- ERR(NL, _("config: line %d: syntax error\n"), linenum);
- return(1);
- }
- } else {
- strtrim(ptr);
- if(!strcmp(key, "INCLUDE")) {
- char conf[PATH_MAX];
- strncpy(conf, ptr, PATH_MAX);
- vprint(_("config: including %s\n"), conf);
- parseconfig(conf, config);
- } else if(!strcmp(section, "options")) {
- if(!strcmp(key, "NOUPGRADE")) {
- char *p = ptr;
- char *q;
- while((q = strchr(p, ' '))) {
- *q = '\0';
- if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) {
- ERR(NL, _("failed to set option NOUPGRADE (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: noupgrade: %s\n"), p);
- p = q;
- p++;
- }
- if(alpm_set_option(PM_OPT_NOUPGRADE, (long)p) == -1) {
- ERR(NL, _("failed to set option NOUPGRADE (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: noupgrade: %s\n"), p);
- } else if(!strcmp(key, "NOEXTRACT")) {
- char *p = ptr;
- char *q;
- while((q = strchr(p, ' '))) {
- *q = '\0';
- if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) {
- ERR(NL, _("failed to set option NOEXTRACT (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: noextract: %s\n"), p);
- p = q;
- p++;
- }
- if(alpm_set_option(PM_OPT_NOEXTRACT, (long)p) == -1) {
- ERR(NL, _("failed to set option NOEXTRACT (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: noextract: %s\n"), p);
- } else if(!strcmp(key, "IGNOREPKG")) {
- char *p = ptr;
- char *q;
- while((q = strchr(p, ' '))) {
- *q = '\0';
- if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) {
- ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: ignorepkg: %s\n"), p);
- p = q;
- p++;
- }
- if(alpm_set_option(PM_OPT_IGNOREPKG, (long)p) == -1) {
- ERR(NL, _("failed to set option IGNOREPKG (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: ignorepkg: %s\n"), p);
- } else if(!strcmp(key, "HOLDPKG")) {
- char *p = ptr;
- char *q;
- while((q = strchr(p, ' '))) {
- *q = '\0';
- config->holdpkg = list_add(config->holdpkg, strdup(p));
- vprint(_("config: holdpkg: %s\n"), p);
- p = q;
- p++;
- }
- config->holdpkg = list_add(config->holdpkg, strdup(p));
- vprint(_("config: holdpkg: %s\n"), p);
- } else if(!strcmp(key, "DBPATH")) {
- /* shave off the leading slash, if there is one */
- if(*ptr == '/') {
- ptr++;
- }
- FREE(config->dbpath);
- config->dbpath = strdup(ptr);
- vprint(_("config: dbpath: %s\n"), ptr);
- } else if(!strcmp(key, "CACHEDIR")) {
- /* shave off the leading slash, if there is one */
- if(*ptr == '/') {
- ptr++;
- }
- FREE(config->cachedir);
- config->cachedir = strdup(ptr);
- vprint(_("config: cachedir: %s\n"), ptr);
- } else if (!strcmp(key, "LOGFILE")) {
- if(alpm_set_option(PM_OPT_LOGFILE, (long)ptr) == -1) {
- ERR(NL, _("failed to set option LOGFILE (%s)\n"), alpm_strerror(pm_errno));
- return(1);
- }
- vprint(_("config: log file: %s\n"), ptr);
- } else if (!strcmp(key, "XFERCOMMAND")) {
- FREE(config->xfercommand);
- config->xfercommand = strndup(ptr, PATH_MAX);
- vprint(_("config: xfercommand: %s\n"), config->xfercommand);
- } else if (!strcmp(key, "PROXYSERVER")) {
- char *p;
- if(config->proxyhost) {
- FREE(config->proxyhost);
- }
- p = strstr(ptr, "://");
- if(p) {
- p += 3;
- if(p == NULL || *p == '\0') {
- ERR(NL, _("config: line %d: bad server location\n"), linenum);
- return(1);
- }
- ptr = p;
- }
- config->proxyhost = strndup(ptr, PATH_MAX);
- vprint(_("config: proxyserver: %s\n"), config->proxyhost);
- } else if (!strcmp(key, "PROXYPORT")) {
- config->proxyport = (unsigned short)atoi(ptr);
- vprint(_("config: proxyport: %u\n"), config->proxyport);
- } else {
- ERR(NL, _("config: line %d: syntax error\n"), linenum);
- return(1);
- }
- } else {
- if(!strcmp(key, "SERVER")) {
- /* parse our special url */
- server_t *server;
- char *p;
-
- MALLOC(server, sizeof(server_t));
- server->server = server->path = NULL;
- server->protocol = NULL;
+ sync_t *sync;
- p = strstr(ptr, "://");
- if(p == NULL) {
- ERR(NL, _("config: line %d: bad server location\n"), linenum);
- return(1);
- }
- *p = '\0';
- p++; p++; p++;
- if(p == NULL || *p == '\0') {
- ERR(NL, _("config: line %d: bad server location\n"), linenum);
- return(1);
- }
- server->protocol = strdup(ptr);
- if(!strcmp(server->protocol, "ftp") || !strcmp(server->protocol, "http")) {
- char *slash;
- /* split the url into domain and path */
- slash = strchr(p, '/');
- if(slash == NULL) {
- /* no path included, default to / */
- server->path = strdup("/");
- } else {
- /* add a trailing slash if we need to */
- if(slash[strlen(slash)-1] == '/') {
- server->path = strdup(slash);
- } else {
- if((server->path = (char *)malloc(strlen(slash)+2)) == NULL) {
- ERR(NL, _("could not allocate %d bytes\n"), sizeof(strlen(slash+2)));
- return(1);
- }
- sprintf(server->path, "%s/", slash);
- }
- *slash = '\0';
- }
- server->server = strdup(p);
- } else if(!strcmp(server->protocol, "file")){
- /* add a trailing slash if we need to */
- if(p[strlen(p)-1] == '/') {
- server->path = strdup(p);
- } else {
- server->path = (char *)malloc(strlen(p)+2);
- if(server->path == NULL) {
- ERR(NL, _("could not allocate %d bytes\n"), sizeof(strlen(p+2)));
- return(1);
- }
- sprintf(server->path, "%s/", p);
- }
- } else {
- ERR(NL, _("config: line %d: protocol %s is not supported\n"), linenum, ptr);
- return(1);
- }
- /* add to the list */
- vprint(_("config: %s: server: %s %s %s\n"), section, server->protocol, server->server, server->path);
- sync->servers = list_add(sync->servers, server);
- } else {
- ERR(NL, _("config: line %d: syntax error\n"), linenum);
- return(1);
- }
- }
- line[0] = '\0';
- }
- }
- }
- fclose(fp);
-
- return(0);
+ MALLOC(sync, sizeof(sync_t));
+ sync->treename = strdup(section);
+ sync->db = db;
+ pmc_syncs = list_add(pmc_syncs, sync);
}
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 319c75f8..f7b5d2fb 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -43,31 +43,27 @@ typedef struct __config_t {
unsigned short op_q_orphans;
unsigned short op_q_owns;
unsigned short op_q_search;
+ unsigned short op_q_changelog;
unsigned short op_s_clean;
+ unsigned short op_s_dependsonly;
unsigned short op_s_downloadonly;
list_t *op_s_ignore;
unsigned short op_s_info;
- unsigned short op_s_printuris;
unsigned short op_s_sync;
unsigned short op_s_search;
unsigned short op_s_upgrade;
unsigned short group;
unsigned int flags;
unsigned short debug;
- /* configuration file option */
- char *proxyhost;
- unsigned short proxyport;
- char *xfercommand;
- unsigned short chomp;
- unsigned short nopassiveftp;
- list_t *holdpkg;
+ unsigned short noask;
+ unsigned int ask;
} config_t;
#define FREECONF(p) do { if(p) { config_free(p); p = NULL; } } while(0)
config_t *config_new(void);
int config_free(config_t *config);
-int parseconfig(char *file, config_t *config);
+void cb_db_register(char *section, PM_DB *db);
#endif /* _PM_CONF_H */
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 425bd1da..4f6723e7 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -58,11 +58,11 @@ int pacman_deptest(list_t *targets)
/* we create a transaction to hold a dummy package to be able to use
* deps checkings from alpm_trans_prepare() */
- if(alpm_trans_init(PM_TRANS_TYPE_ADD, 0, NULL, NULL) == -1) {
+ if(alpm_trans_init(PM_TRANS_TYPE_ADD, 0, NULL, NULL, NULL) == -1) {
ERR(NL, "%s", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
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%s\n"), config->root, PM_LOCK);
}
return(1);
}
@@ -108,7 +108,7 @@ int pacman_deptest(list_t *targets)
PM_DEPMISS *miss = alpm_list_getdata(lp);
if(!config->op_d_resolve) {
MSG(NL, _("requires: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
+ switch((long)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_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -153,9 +153,11 @@ int pacman_deptest(list_t *targets)
}
cleanup:
- if(alpm_trans_release() == -1) {
- ERR(NL, _("could not release transaction (%s)"), alpm_strerror(pm_errno));
- retval = 1;
+ if(!config->op_d_resolve) {
+ if(alpm_trans_release() == -1) {
+ ERR(NL, _("could not release transaction (%s)"), alpm_strerror(pm_errno));
+ retval = 1;
+ }
}
return(retval);
diff --git a/src/pacman/download.c b/src/pacman/download.c
index b59aeada..63d2ccbf 100644
--- a/src/pacman/download.c
+++ b/src/pacman/download.c
@@ -40,35 +40,42 @@
#include "conf.h"
/* progress bar */
-static char sync_fnm[25];
-static int offset;
-static struct timeval t0, t;
-static float rate;
-static int xfered1;
-static unsigned char eta_h, eta_m, eta_s;
+char sync_fnm[25];
+int offset;
+struct timeval t0, t;
+float rate;
+int xfered1;
+unsigned char eta_h, eta_m, eta_s;
/* pacman options */
extern config_t *config;
-extern int maxcols;
+extern unsigned int maxcols;
-static int log_progress(netbuf *ctl, int xfered, void *arg)
+int log_progress(netbuf *ctl, int xfered, void *arg)
{
int fsz = *(int*)arg;
int pct = ((float)(xfered+offset) / fsz) * 100;
- int i, cur;
+ static int lastpct=0;
+ unsigned int i, cur;
struct timeval t1;
float timediff;
/* a little hard to conceal easter eggs in open-source software, but
* they're still fun. ;)
*/
+ int chomp;
static unsigned short mouth;
static unsigned int lastcur = 0;
- if(config->noprogressbar) {
+ /* we don't need that parameter */
+ ctl=NULL;
+
+ if(config->noprogressbar || (pct == 100 && lastpct == 100)) {
return(1);
}
+ alpm_get_option(PM_OPT_CHOMP, (long *)&chomp);
+
gettimeofday(&t1, NULL);
if(xfered+offset == fsz) {
t = t0;
@@ -100,7 +107,7 @@ static int log_progress(netbuf *ctl, int xfered, void *arg)
printf(" %s [", sync_fnm);
cur = (int)((maxcols-64)*pct/100);
for(i = 0; i < maxcols-64; i++) {
- if(config->chomp) {
+ if(chomp) {
if(i < cur) {
printf("-");
} else {
@@ -132,459 +139,13 @@ static int log_progress(netbuf *ctl, int xfered, void *arg)
} else {
printf("] %3d%% %6dK %6.1fK/s %02d:%02d:%02d\r", pct, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s);
}
+ if(lastpct != 100 && pct == 100) {
+ printf("\n");
+ }
lastcur = cur;
+ lastpct = pct;
fflush(stdout);
return(1);
}
-static int copyfile(char *src, char *dest)
-{
- FILE *in, *out;
- size_t len;
- char buf[4097];
-
- in = fopen(src, "r");
- if(in == NULL) {
- return(1);
- }
- out = fopen(dest, "w");
- if(out == NULL) {
- return(1);
- }
-
- while((len = fread(buf, 1, 4096, in))) {
- fwrite(buf, 1, len, out);
- }
-
- fclose(in);
- fclose(out);
- return(0);
-}
-
-/*
- * Download a list of files from a list of servers
- * - if one server fails, we try the next one in the list
- *
- * RETURN: 0 for successful download, 1 on error
- */
-int downloadfiles(list_t *servers, const char *localpath, list_t *files)
-{
- return(!!downloadfiles_forreal(servers, localpath, files, NULL, NULL));
-}
-
-/*
- * This is the real downloadfiles, used directly by sync_synctree() to check
- * modtimes on remote files.
- * - if *mtime1 is non-NULL, then only download files
- * if they are different than *mtime1. String should be in the form
- * "YYYYMMDDHHMMSS" to match the form of ftplib's FtpModDate() function.
- * - if *mtime2 is non-NULL, then it will be filled with the mtime
- * of the remote file (from MDTM FTP cmd or Last-Modified HTTP header).
- *
- * RETURN: 0 for successful download
- * -1 if the mtimes are identical
- * 1 on error
- */
-int downloadfiles_forreal(list_t *servers, const char *localpath,
- list_t *files, const char *mtime1, char *mtime2)
-{
- int fsz;
- netbuf *control = NULL;
- list_t *lp;
- int done = 0;
- list_t *complete = NULL;
- list_t *i;
-
- if(files == NULL) {
- return(0);
- }
-
- for(i = servers; i && !done; i = i->next) {
- server_t *server = (server_t*)i->data;
-
- if(!config->xfercommand && strcmp(server->protocol, "file")) {
- if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
- FtpInit();
- vprint(_("connecting to %s:21\n"), server->server);
- if(!FtpConnect(server->server, &control)) {
- ERR(NL, _("cannot connect to %s\n"), server->server);
- continue;
- }
- if(!FtpLogin("anonymous", "arch@guest", control)) {
- ERR(NL, _("anonymous login failed\n"));
- FtpQuit(control);
- continue;
- }
- if(!FtpChdir(server->path, control)) {
- ERR(NL, _("could not cwd to %s: %s\n"), server->path, FtpLastResponse(control));
- FtpQuit(control);
- continue;
- }
- if(!config->nopassiveftp) {
- if(!FtpOptions(FTPLIB_CONNMODE, FTPLIB_PASSIVE, control)) {
- WARN(NL, _("failed to set passive mode\n"));
- }
- } else {
- vprint(_("FTP passive mode not set\n"));
- }
- } else if(config->proxyhost) {
- char *host;
- unsigned port;
- host = (config->proxyhost) ? config->proxyhost : server->server;
- port = (config->proxyport) ? config->proxyport : 80;
- if(strchr(host, ':')) {
- vprint(_("connecting to %s\n"), host);
- } else {
- vprint(_("connecting to %s:%u\n"), host, port);
- }
- if(!HttpConnect(host, port, &control)) {
- ERR(NL, _("cannot connect to %s\n"), host);
- continue;
- }
- }
-
- /* set up our progress bar's callback (and idle timeout) */
- if(strcmp(server->protocol, "file") && control) {
- FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
- FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
- FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
- FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
- }
- }
-
- /* get each file in the list */
- for(lp = files; lp; lp = lp->next) {
- char *fn = (char *)lp->data;
-
- if(list_is_strin(fn, complete)) {
- continue;
- }
-
- if(config->xfercommand && strcmp(server->protocol, "file")) {
- int ret;
- int usepart = 0;
- char *ptr1, *ptr2;
- char origCmd[PATH_MAX];
- char parsedCmd[PATH_MAX] = "";
- char url[PATH_MAX];
- char cwd[PATH_MAX];
- /* build the full download url */
- snprintf(url, PATH_MAX, "%s://%s%s%s", server->protocol, server->server,
- server->path, fn);
- /* replace all occurrences of %o with fn.part */
- strncpy(origCmd, config->xfercommand, sizeof(origCmd));
- ptr1 = origCmd;
- while((ptr2 = strstr(ptr1, "%o"))) {
- usepart = 1;
- ptr2[0] = '\0';
- strcat(parsedCmd, ptr1);
- strcat(parsedCmd, fn);
- strcat(parsedCmd, ".part");
- ptr1 = ptr2 + 2;
- }
- strcat(parsedCmd, ptr1);
- /* replace all occurrences of %u with the download URL */
- strncpy(origCmd, parsedCmd, sizeof(origCmd));
- parsedCmd[0] = '\0';
- ptr1 = origCmd;
- while((ptr2 = strstr(ptr1, "%u"))) {
- ptr2[0] = '\0';
- strcat(parsedCmd, ptr1);
- strcat(parsedCmd, url);
- ptr1 = ptr2 + 2;
- }
- strcat(parsedCmd, ptr1);
- /* cwd to the download directory */
- getcwd(cwd, PATH_MAX);
- if(chdir(localpath)) {
- ERR(NL, _("could not chdir to %s\n"), localpath);
- return(1);
- }
- /* execute the parsed command via /bin/sh -c */
- vprint(_("running command: %s\n"), parsedCmd);
- ret = system(parsedCmd);
- if(ret == -1) {
- ERR(NL, _("running XferCommand: fork failed!\n"));
- return(1);
- } else if(ret != 0) {
- /* download failed */
- vprint(_("XferCommand command returned non-zero status code (%d)\n"), ret);
- } else {
- /* download was successful */
- complete = list_add(complete, fn);
- if(usepart) {
- char fnpart[PATH_MAX];
- /* rename "output.part" file to "output" file */
- snprintf(fnpart, PATH_MAX, "%s.part", fn);
- rename(fnpart, fn);
- }
- }
- chdir(cwd);
- } else {
- char output[PATH_MAX];
- int j, filedone = 0;
- char *ptr;
- struct stat st;
- snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
- strncpy(sync_fnm, fn, 24);
- /* drop filename extension */
- ptr = strstr(fn, PM_EXT_DB);
- if(ptr && (ptr-fn) < 24) {
- sync_fnm[ptr-fn] = '\0';
- }
- ptr = strstr(fn, PM_EXT_PKG);
- if(ptr && (ptr-fn) < 24) {
- sync_fnm[ptr-fn] = '\0';
- }
- for(j = strlen(sync_fnm); j < 24; j++) {
- sync_fnm[j] = ' ';
- }
- sync_fnm[24] = '\0';
- offset = 0;
-
- /* ETA setup */
- gettimeofday(&t0, NULL);
- t = t0;
- rate = 0;
- xfered1 = 0;
- eta_h = 0;
- eta_m = 0;
- eta_s = 0;
-
- if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
- if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) {
- WARN(NL, _("failed to get filesize for %s\n"), fn);
- }
- /* check mtimes */
- if(mtime1) {
- char fmtime[64];
- if(!FtpModDate(fn, fmtime, sizeof(fmtime)-1, control)) {
- WARN(NL, _("failed to get mtime for %s\n"), fn);
- } else {
- strtrim(fmtime);
- if(mtime1 && !strcmp(mtime1, fmtime)) {
- /* mtimes are identical, skip this file */
- vprint(_("mtimes are identical, skipping %s\n"), fn);
- filedone = -1;
- complete = list_add(complete, fn);
- } else {
- if(mtime2) {
- strncpy(mtime2, fmtime, 15); /* YYYYMMDDHHMMSS (=14b) */
- mtime2[14] = '\0';
- }
- }
- }
- }
- if(!filedone) {
- if(!stat(output, &st)) {
- offset = (int)st.st_size;
- if(!FtpRestart(offset, control)) {
- WARN(NL, _("failed to resume download -- restarting\n"));
- /* can't resume: */
- /* unlink the file in order to restart download from scratch */
- unlink(output);
- }
- }
- if(!FtpGet(output, fn, FTPLIB_IMAGE, 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 */
- } else {
- filedone = 1;
- }
- }
- } else if(!strcmp(server->protocol, "http") || (config->proxyhost && strcmp(server->protocol, "file"))) {
- char src[PATH_MAX];
- char *host;
- unsigned port;
- struct tm fmtime1;
- struct tm fmtime2;
- memset(&fmtime1, 0, sizeof(struct tm));
- memset(&fmtime2, 0, sizeof(struct tm));
- if(!strcmp(server->protocol, "http") && !config->proxyhost) {
- /* HTTP servers hang up after each request (but not proxies), so
- * we have to re-connect for each file.
- */
- host = (config->proxyhost) ? config->proxyhost : server->server;
- port = (config->proxyhost) ? config->proxyport : 80;
- if(strchr(host, ':')) {
- vprint(_("connecting to %s\n"), host);
- } else {
- vprint(_("connecting to %s:%u\n"), host, port);
- }
- if(!HttpConnect(host, port, &control)) {
- ERR(NL, _("cannot connect to %s\n"), host);
- continue;
- }
- /* set up our progress bar's callback (and idle timeout) */
- if(strcmp(server->protocol, "file") && control) {
- FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
- FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
- FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
- FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
- }
- }
-
- if(!stat(output, &st)) {
- offset = (int)st.st_size;
- }
- if(!config->proxyhost) {
- snprintf(src, PATH_MAX, "%s%s", server->path, fn);
- } else {
- snprintf(src, PATH_MAX, "%s://%s%s%s", server->protocol, server->server, server->path, fn);
- }
- if(mtime1 && strlen(mtime1)) {
- struct tm tmref;
- time_t t, tref;
- int diff;
- /* date conversion from YYYYMMDDHHMMSS to "rfc1123-date" */
- sscanf(mtime1, "%4d%2d%2d%2d%2d%2d",
- &fmtime1.tm_year, &fmtime1.tm_mon, &fmtime1.tm_mday,
- &fmtime1.tm_hour, &fmtime1.tm_min, &fmtime1.tm_sec);
- fmtime1.tm_year -= 1900;
- fmtime1.tm_mon--;
- /* compute the week day because some web servers (like lighttpd) need them. */
- /* we set tmref to "Thu, 01 Jan 1970 00:00:00" */
- memset(&tmref, 0, sizeof(struct tm));
- tmref.tm_mday = 1;
- tref = mktime(&tmref);
- /* then we compute the difference with mtime1 */
- t = mktime(&fmtime1);
- diff = ((t-tref)/3600/24)%7;
- fmtime1.tm_wday = diff+(diff >= 3 ? -3 : 4);
-
- }
- fmtime2.tm_year = 0;
- if(!HttpGet(server->server, output, src, &fsz, control, offset,
- (mtime1) ? &fmtime1 : NULL, (mtime2) ? &fmtime2 : NULL)) {
- if(strstr(FtpLastResponse(control), "304")) {
- vprint(_("mtimes are identical, skipping %s\n"), fn);
- filedone = -1;
- complete = list_add(complete, fn);
- } else {
- 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 */
- }
- } else {
- if(mtime2) {
- if(fmtime2.tm_year) {
- /* date conversion from "rfc1123-date" to YYYYMMDDHHMMSS */
- sprintf(mtime2, "%4d%02d%02d%02d%02d%02d",
- fmtime2.tm_year+1900, fmtime2.tm_mon+1, fmtime2.tm_mday,
- fmtime2.tm_hour, fmtime2.tm_min, fmtime2.tm_sec);
- } else {
- WARN(NL, _("failed to get mtime for %s\n"), fn);
- }
- }
- filedone = 1;
- }
- } else if(!strcmp(server->protocol, "file")) {
- char src[PATH_MAX];
- snprintf(src, PATH_MAX, "%s%s", server->path, fn);
- vprint(_("copying %s to %s/%s\n"), src, localpath, fn);
- /* local repository, just copy the file */
- if(copyfile(src, output)) {
- ERR(NL, _("failed copying %s\n"), src);
- } else {
- filedone = 1;
- }
- }
-
- if(filedone > 0) {
- char completefile[PATH_MAX];
- if(!strcmp(server->protocol, "file")) {
- char out[56];
- printf(" %s [", sync_fnm);
- STRNCPY(out, server->path, 33);
- printf("%s", out);
- for(j = strlen(out); j < maxcols-64; j++) {
- printf(" ");
- }
- fputs(_("] 100% LOCAL "), stdout);
- } else {
- log_progress(control, fsz-offset, &fsz);
- }
- complete = list_add(complete, fn);
- /* rename "output.part" file to "output" file */
- snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn);
- rename(output, completefile);
- } else if(filedone < 0) {
- return(-1);
- }
- printf("\n");
- fflush(stdout);
- }
- }
- if(!config->xfercommand) {
- if(!strcmp(server->protocol, "ftp") && !config->proxyhost) {
- FtpQuit(control);
- } else if(!strcmp(server->protocol, "http") || (config->proxyhost && strcmp(server->protocol, "file"))) {
- HttpQuit(control);
- }
- }
-
- if(list_count(complete) == list_count(files)) {
- done = 1;
- }
- }
-
- return(!done);
-}
-
-char *fetch_pkgurl(char *target)
-{
- char spath[PATH_MAX];
- char url[PATH_MAX];
- char *host, *path, *fn;
- struct stat buf;
-
- strncpy(url, target, PATH_MAX);
- host = strstr(url, "://");
- *host = '\0';
- host += 3;
- path = strchr(host, '/');
- *path = '\0';
- path++;
- fn = strrchr(path, '/');
- if(fn) {
- *fn = '\0';
- if(path[0] == '/') {
- snprintf(spath, PATH_MAX, "%s/", path);
- } else {
- snprintf(spath, PATH_MAX, "/%s/", path);
- }
- fn++;
- } else {
- fn = path;
- strcpy(spath, "/");
- }
-
- /* do not download the file if it exists in the current dir
- */
- if(stat(fn, &buf) == 0) {
- vprint(_(" %s is already in the current directory\n"), fn);
- } else {
- server_t *server;
- list_t *servers = NULL;
- list_t *files;
-
- MALLOC(server, sizeof(server_t));
- server->protocol = url;
- server->server = host;
- server->path = spath;
- servers = list_add(servers, server);
-
- files = list_add(NULL, fn);
- if(downloadfiles(servers, ".", files)) {
- ERR(NL, _("failed to download %s\n"), target);
- return(NULL);
- }
- FREELISTPTR(files);
-
- FREELIST(servers);
- }
-
- /* return the target with the raw filename, no URL */
- return(strndup(fn, PATH_MAX));
-}
-
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/download.h b/src/pacman/download.h
index 8026df1f..45afa647 100644
--- a/src/pacman/download.h
+++ b/src/pacman/download.h
@@ -21,20 +21,16 @@
#ifndef _PM_DOWNLOAD_H
#define _PM_DOWNLOAD_H
-#include "list.h"
+extern char sync_fnm[25];
+extern int offset;
+extern struct timeval t0, t;
+extern float rate;
+extern int xfered1;
+extern unsigned char eta_h, eta_m, eta_s;
-/* Servers */
-typedef struct __server_t {
- char *protocol;
- char *server;
- char *path;
-} server_t;
-
-int downloadfiles(list_t *servers, const char *localpath, list_t *files);
-int downloadfiles_forreal(list_t *servers, const char *localpath,
- list_t *files, const char *mtime1, char *mtime2);
-
-char *fetch_pkgurl(char *target);
+#ifdef __FTPLIB_H
+int log_progress(netbuf *ctl, int xfered, void *arg);
+#endif
#endif /* _PM_DOWNLOAD_H */
diff --git a/src/pacman/log.c b/src/pacman/log.c
index 2d929bd1..25524fe3 100644
--- a/src/pacman/log.c
+++ b/src/pacman/log.c
@@ -24,14 +24,15 @@
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
+#include <time.h>
#include <libintl.h>
#include <alpm.h>
/* pacman */
-#include "util.h"
#include "log.h"
#include "list.h"
#include "conf.h"
+#include "util.h"
#define LOG_STR_LEN 256
@@ -43,7 +44,7 @@ int neednl; /* for cleaner message output */
*/
void cb_log(unsigned short level, char *msg)
{
- char str[9] = "";
+ char str[LOG_STR_LEN] = "";
if(!strlen(msg)) {
return;
@@ -69,7 +70,7 @@ void cb_log(unsigned short level, char *msg)
sprintf(str, _("function"));
break;
default:
- sprintf(str, _("???"));
+ sprintf(str, "???");
break;
}
@@ -132,7 +133,7 @@ int yesno(char *fmt, ...)
va_start(args, fmt);
vsnprintf(str, LOG_STR_LEN, fmt, args);
va_end(args);
- MSG(NL, str);
+ pm_fprintf(stderr, NL, str);
if(fgets(response, 32, stdin)) {
/* trim whitespace and newlines */
diff --git a/src/pacman/log.h b/src/pacman/log.h
index bafaae81..ff7fde50 100644
--- a/src/pacman/log.h
+++ b/src/pacman/log.h
@@ -23,11 +23,11 @@
#define MSG(line, fmt, args...) pm_fprintf(stdout, line, fmt, ##args)
#define ERR(line, fmt, args...) do { \
- pm_fprintf(stderr, line, "error: "); \
+ pm_fprintf(stderr, line, _("error: ")); \
pm_fprintf(stderr, CL, fmt, ##args); \
} while(0)
#define WARN(line, fmt, args...) do { \
- pm_fprintf(stderr, line, "warning: "); \
+ pm_fprintf(stderr, line, _("warning: ")); \
pm_fprintf(stderr, CL, fmt, ##args); \
} while(0)
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 72cf3c83..af60421a 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -37,7 +37,7 @@
*/
void dump_pkg_full(PM_PKG *pkg, int level)
{
- char *date;
+ char *date, *type;
if(pkg == NULL) {
return;
@@ -49,20 +49,22 @@ void dump_pkg_full(PM_PKG *pkg, int level)
PM_LIST_display(_("Groups :"), alpm_pkg_getinfo(pkg, PM_PKG_GROUPS));
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));
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));
date = alpm_pkg_getinfo(pkg, PM_PKG_BUILDDATE);
printf(_("Build Date : %s %s\n"), date, strlen(date) ? "UTC" : "");
+ type = alpm_pkg_getinfo(pkg, PM_PKG_BUILDTYPE);
+ printf(_("Build Type : %s\n"), strlen(type) ? type : _("Unknown"));
date = alpm_pkg_getinfo(pkg, PM_PKG_INSTALLDATE);
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: : "));
- switch((int)alpm_pkg_getinfo(pkg, PM_PKG_REASON)) {
+ printf(_("Reason : "));
+ switch((long)alpm_pkg_getinfo(pkg, PM_PKG_REASON)) {
case PM_PKG_REASON_EXPLICIT:
printf(_("Explicitly installed\n"));
break;
@@ -76,6 +78,7 @@ void dump_pkg_full(PM_PKG *pkg, int level)
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(_("Removes :"), alpm_pkg_getinfo(pkg, PM_PKG_REMOVES));
PM_LIST_display(_("Required By :"), alpm_pkg_getinfo(pkg, PM_PKG_REQUIREDBY));
PM_LIST_display(_("Conflicts With :"), alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
@@ -102,13 +105,18 @@ void dump_pkg_full(PM_PKG *pkg, int level)
snprintf(path, PATH_MAX-1, "%s%s", root, str);
if(!stat(path, &buf)) {
char *md5sum = alpm_get_md5sum(path);
- if(md5sum == NULL) {
- ERR(NL, _("error calculating md5sum for %s\n"), path);
+ char *sha1sum = alpm_get_sha1sum(path);
+ if(md5sum == NULL && sha1sum == NULL) {
+ ERR(NL, _("error calculating md5sum or sha1sum for %s\n"), path);
FREE(str);
continue;
}
- printf(_("%sMODIFIED\t%s\n"), strcmp(md5sum, ptr) ? "" : "NOT ", path);
+ if (!sha1sum)
+ printf(_("%sMODIFIED\t%s\n"), strcmp(md5sum, ptr) ? "" : _("NOT "), path);
+ if (!md5sum)
+ printf(_("%sMODIFIED\t%s\n"), strcmp(sha1sum, ptr) ? "" : _("NOT "), path);
FREE(md5sum);
+ FREE(sha1sum);
} else {
printf(_("MISSING\t\t%s\n"), path);
}
@@ -119,11 +127,11 @@ void dump_pkg_full(PM_PKG *pkg, int level)
printf("\n");
}
-
/* Display the content of a sync package
*/
void dump_pkg_sync(PM_PKG *pkg, char *treename)
{
+ char *tmp1, *tmp2;
if(pkg == NULL) {
return;
}
@@ -135,13 +143,23 @@ void dump_pkg_sync(PM_PKG *pkg, char *treename)
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(_("Depends On :"), alpm_pkg_getinfo(pkg, PM_PKG_DEPENDS));
+ PM_LIST_display(_("Removes :"), alpm_pkg_getinfo(pkg, PM_PKG_REMOVES));
PM_LIST_display(_("Conflicts With :"), alpm_pkg_getinfo(pkg, PM_PKG_CONFLICTS));
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 (uncompressed):%ld\n"), (long)alpm_pkg_getinfo(pkg, PM_PKG_USIZE));
printf(_("Description : "));
indentprint(alpm_pkg_getinfo(pkg, PM_PKG_DESC), 20);
- printf(_("\nMD5 Sum : %s\n"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM));
+ tmp1 = (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM);
+ if (tmp1 != NULL && tmp1[0] != '\0') {
+ printf(_("\nMD5 Sum : %s"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_MD5SUM));
+ }
+ tmp2 = (char *)alpm_pkg_getinfo(pkg, PM_PKG_SHA1SUM);
+ if (tmp2 != NULL && tmp2[0] != '\0') {
+ printf(_("\nSHA1 Sum : %s"), (char *)alpm_pkg_getinfo(pkg, PM_PKG_SHA1SUM));
+ }
+ printf("\n");
}
void dump_pkg_files(PM_PKG *pkg)
@@ -153,12 +171,37 @@ void dump_pkg_files(PM_PKG *pkg)
pkgfiles = alpm_pkg_getinfo(pkg, PM_PKG_FILES);
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);
}
+/* Display the changelog of an installed package
+ */
+void dump_pkg_changelog(char *clfile, char *pkgname)
+{
+ FILE* fp = NULL;
+ char line[PATH_MAX+1];
+
+ if((fp = fopen(clfile, "r")) == NULL)
+ {
+ ERR(NL, _("No changelog available for '%s'.\n"), pkgname);
+ return;
+ }
+ else
+ {
+ while(!feof(fp))
+ {
+ fgets(line, PATH_MAX, fp);
+ printf("%s", line);
+ line[0] = '\0';
+ }
+ fclose(fp);
+ return;
+ }
+}
+
int split_pkgname(char *target, char *name, char *version)
{
char tmp[512];
@@ -179,6 +222,10 @@ int split_pkgname(char *target, char *name, char *version)
if((p = strstr(tmp, PM_EXT_PKG))) {
*p = 0;
}
+ /* trim architecture */
+ if((p = strrchr(tmp, '-'))) {
+ *p = 0;
+ }
p = tmp + strlen(tmp);
diff --git a/src/pacman/package.h b/src/pacman/package.h
index af624c72..284105cb 100644
--- a/src/pacman/package.h
+++ b/src/pacman/package.h
@@ -25,6 +25,7 @@ void dump_pkg_full(PM_PKG *pkg, int level);
void dump_pkg_sync(PM_PKG *pkg, char *treename);
void dump_pkg_files(PM_PKG *pkg);
+void dump_pkg_changelog(char *clfile, char *pkgname);
int split_pkgname(char *target, char *name, char *version);
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 89593e3b..69504d43 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -29,11 +29,18 @@
#include <unistd.h>
#include <libintl.h>
#include <locale.h>
-#ifndef CYGWIN
-#include <mcheck.h> /* debug */
-#else
+#if defined(__APPLE__)
+#include <malloc/malloc.h>
+#elif defined(__OpenBSD__) || defined(__APPLE__)
+#include <sys/malloc.h>
+#include <sys/types.h>
+#elif defined(CYGWIN)
#include <libgen.h> /* basename */
+#else
+#include <mcheck.h> /* debug */
#endif
+#include <time.h>
+#include <ftplib.h>
#include <alpm.h>
/* pacman */
@@ -52,6 +59,10 @@
#define PACCONF "/etc/pacman.conf"
+#if defined(__OpenBSD__) || defined(__APPLE__)
+#define BSD
+#endif
+
/* Operations */
enum {
PM_OP_MAIN = 1,
@@ -71,23 +82,10 @@ list_t *pmc_syncs = NULL;
/* list of targets specified on command line */
list_t *pm_targets = NULL;
-int maxcols = 80;
+unsigned int maxcols = 80;
extern int neednl;
-/* Version
- */
-static void version()
-{
- printf(_("\n"));
- printf(_(" .--. Pacman v%s - libalpm v%s\n"), PACKAGE_VERSION, PM_VERSION);
- printf(_("/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>\n"));
- printf(_("\\ '-. '-' '-' '-' \n"));
- printf(_(" '--' This program may be freely redistributed under\n"));
- printf(_(" the terms of the GNU General Public License\n"));
- printf("\n");
-}
-
/* Display usage/syntax for the specified operation.
* op: the operation code requested
* myname: basename(argv[0])
@@ -130,12 +128,13 @@ static void usage(int op, char *myname)
} else if(op == PM_OP_QUERY) {
printf(_("usage: %s {-Q --query} [options] [package]\n"), myname);
printf(_("options:\n"));
- printf(_(" -e, --orphans list all packages that were explicitly installed\n"));
+ printf(_(" -c, --changelog view the changelog of a package\n"));
+ printf(_(" -e, --orphans list all packages that were installed as a dependency\n"));
printf(_(" and are not required by any other packages\n"));
printf(_(" -g, --groups view all members of a package group\n"));
printf(_(" -i, --info view package information\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 db(s)\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(_(" looking in the database\n"));
@@ -145,6 +144,7 @@ static void usage(int op, char *myname)
printf(_("options:\n"));
printf(_(" -c, --clean remove old packages from cache directory (use -cc for all)\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
+ printf(_(" -e, --dependsonly install dependencies only\n"));
printf(_(" -f, --force force install, overwrite conflicting files\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"));
@@ -156,6 +156,7 @@ static void usage(int op, char *myname)
}
printf(_(" --config <path> set an alternate configuration file\n"));
printf(_(" --noconfirm do not ask for anything confirmation\n"));
+ printf(_(" --ask <number> pre-specify answers for questions (see manpage)\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(_(" -v, --verbose be verbose\n"));
@@ -164,6 +165,67 @@ static void usage(int op, char *myname)
}
}
+/* Version
+ */
+static void version()
+{
+ printf("\n");
+ printf(" .--. Pacman v%s - libalpm v%s\n", PACKAGE_VERSION, PM_VERSION);
+ printf("/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>\n");
+ printf("\\ '-. '-' '-' '-' & Frugalware developers <frugalware-devel@frugalware.org>\n");
+ printf(" '--' \n");
+ printf(_(" This program may be freely redistributed under\n"));
+ printf(_(" the terms of the GNU General Public License\n"));
+ printf("\n");
+}
+
+static void cleanup(int signum)
+{
+ list_t *lp;
+
+ if(signum==SIGSEGV)
+ {
+ fprintf(stderr, "Internal pacman error: Segmentation fault\n"
+ "Please submit a full bug report, with the given package if appropriate.\n"
+ "See <URL:http://wiki.frugalware.org/Bugs> for instructions.\n");
+ exit(signum);
+ } else if((signum == SIGINT) && (alpm_trans_release() == -1) && (pm_errno ==
+ PM_ERR_TRANS_COMMITING)) {
+ return;
+ }
+ if(signum != 0 && config->op_d_vertest == 0) {
+ fprintf(stderr, "\n");
+ }
+
+ /* free alpm library resources */
+ if(alpm_release() == -1) {
+ ERR(NL, "%s\n", alpm_strerror(pm_errno));
+ }
+
+ /* free memory */
+ for(lp = pmc_syncs; lp; lp = lp->next) {
+ sync_t *sync = lp->data;
+ FREE(sync->treename);
+ }
+ FREELIST(pmc_syncs);
+ FREELIST(pm_targets);
+ FREECONF(config);
+
+#ifndef CYGWIN
+#ifndef BSD
+ /* debug */
+ muntrace();
+#endif
+#endif
+
+ if(neednl) {
+ putchar('\n');
+ }
+ fflush(stdout);
+
+ exit(signum);
+}
+
/* Parse command-line arguments for each operation
* argc: argc
* argv: argv
@@ -188,8 +250,10 @@ static int parseargs(int argc, char *argv[])
{"vertest", no_argument, 0, 'Y'}, /* does the same as the 'vercmp' binary */
{"dbpath", required_argument, 0, 'b'},
{"cascade", no_argument, 0, 'c'},
+ {"changelog", no_argument, 0, 'c'},
{"clean", no_argument, 0, 'c'},
{"nodeps", no_argument, 0, 'd'},
+ {"dependsonly",no_argument, 0, 'e'},
{"orphans", no_argument, 0, 'e'},
{"force", no_argument, 0, 'f'},
{"groups", no_argument, 0, 'g'},
@@ -215,6 +279,7 @@ static int parseargs(int argc, char *argv[])
{"debug", required_argument, 0, 1003},
{"noprogressbar", no_argument, 0, 1004},
{"noscriptlet", no_argument, 0, 1005},
+ {"ask", required_argument, 0, 1006},
{0, 0, 0, 0}
};
char root[PATH_MAX];
@@ -230,12 +295,17 @@ static int parseargs(int argc, char *argv[])
if(config->configfile) {
free(config->configfile);
}
+ #if defined(__OpenBSD__) || defined(__APPLE__)
+ config->configfile = strdup(optarg);
+ #else
config->configfile = strndup(optarg, PATH_MAX);
+ #endif
break;
case 1002: config->op_s_ignore = list_add(config->op_s_ignore, strdup(optarg)); break;
case 1003: config->debug = atoi(optarg); break;
case 1004: config->noprogressbar = 1; break;
case 1005: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
+ case 1006: config->noask = 1; config->ask = atoi(optarg); break;
case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
case 'D':
config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_DEPTEST);
@@ -265,9 +335,10 @@ static int parseargs(int argc, char *argv[])
case 'c':
config->op_s_clean++;
config->flags |= PM_TRANS_FLAG_CASCADE;
+ config->op_q_changelog = 1;
break;
case 'd': config->flags |= PM_TRANS_FLAG_NODEPS; break;
- case 'e': config->op_q_orphans = 1; break;
+ case 'e': config->op_q_orphans = 1; config->flags |= PM_TRANS_FLAG_DEPENDSONLY; break;
case 'f': config->flags |= PM_TRANS_FLAG_FORCE; break;
case 'g': config->group++; break;
case 'h': config->help = 1; break;
@@ -282,7 +353,7 @@ static int parseargs(int argc, char *argv[])
case 'o': config->op_q_owns = 1; break;
case 'p':
config->op_q_isfile = 1;
- config->op_s_printuris = 1;
+ config->flags |= PM_TRANS_FLAG_PRINTURIS;
break;
case 'r':
if(realpath(optarg, root) == NULL) {
@@ -303,6 +374,7 @@ static int parseargs(int argc, char *argv[])
case 'v': config->verbose++; break;
case 'w':
config->op_s_downloadonly = 1;
+ config->flags |= PM_TRANS_FLAG_DOWNLOADONLY;
config->flags |= PM_TRANS_FLAG_NOCONFLICTS;
break;
case 'y': config->op_s_sync++; break;
@@ -334,52 +406,6 @@ static int parseargs(int argc, char *argv[])
return(0);
}
-static void cleanup(int signum)
-{
- list_t *lp;
-
- if((signum == SIGINT) && (alpm_trans_release() == -1)) {
- return;
- }
- if(signum != 0 && config->op_d_vertest == 0) {
- fprintf(stderr, "\n");
- }
-
- /* free alpm library resources */
- if(alpm_release() == -1) {
- ERR(NL, _("%s\n"), alpm_strerror(pm_errno));
- }
-
- /* free memory */
- for(lp = pmc_syncs; lp; lp = lp->next) {
- sync_t *sync = lp->data;
- list_t *i;
- for(i = sync->servers; i; i = i->next) {
- server_t *server = i->data;
- FREE(server->protocol);
- FREE(server->server);
- FREE(server->path);
- }
- FREELIST(sync->servers);
- FREE(sync->treename);
- }
- FREELIST(pmc_syncs);
- FREELIST(pm_targets);
- FREECONF(config);
-
-#ifndef CYGWIN
- /* debug */
- muntrace();
-#endif
-
- if(neednl) {
- putchar('\n');
- }
- fflush(stdout);
-
- exit(signum);
-}
-
int main(int argc, char *argv[])
{
int ret = 0;
@@ -390,9 +416,11 @@ int main(int argc, char *argv[])
list_t *lp;
#ifndef CYGWIN
+#ifndef BSD
/* debug */
mtrace();
#endif
+#endif
cenv = getenv("COLUMNS");
if(cenv != NULL) {
@@ -402,6 +430,7 @@ int main(int argc, char *argv[])
/* set signal handlers */
signal(SIGINT, cleanup);
signal(SIGTERM, cleanup);
+ signal(SIGSEGV, cleanup);
/* i18n init */
lang=getenv("LC_ALL");
@@ -411,6 +440,9 @@ int main(int argc, char *argv[])
lang=getenv("LANG");
setlocale(LC_ALL, lang);
+ // workaround for tr_TR
+ if(lang && !strcmp(lang, "tr_TR"))
+ setlocale(LC_CTYPE, "C");
bindtextdomain("pacman", "/usr/share/locale");
textdomain("pacman");
@@ -444,9 +476,12 @@ int main(int argc, char *argv[])
if(myuid > 0) {
if(config->op != PM_OP_MAIN && config->op != PM_OP_QUERY && config->op != PM_OP_DEPTEST) {
if((config->op == PM_OP_SYNC && !config->op_s_sync &&
- (config->op_s_search || config->op_s_printuris || config->group || config->op_q_list ||
- 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 */
+ (config->op_s_search || config->group || config->op_q_list || config->op_q_info))
+ || (config->op == PM_OP_DEPTEST && !config->op_d_resolve)
+ || (config->root != NULL)) {
+ /* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */
+ /* special case: ignore root user check if -r is specified, fall back on
+ * normal FS checking */
} else {
ERR(NL, _("you cannot perform this operation unless you are root.\n"));
config_free(config);
@@ -476,35 +511,69 @@ int main(int argc, char *argv[])
cleanup(1);
}
+ /* Setup logging as soon as possible, to print out maximum debugging info */
+ if(alpm_set_option(PM_OPT_LOGMASK, (long)config->debug) == -1) {
+ ERR(NL, _("failed to set option LOGMASK (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(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));
+ cleanup(1);
+ }
+
if(config->configfile == NULL) {
config->configfile = strdup(PACCONF);
}
- if(parseconfig(config->configfile, config) == -1) {
+ if(alpm_parse_config(config->configfile, cb_db_register, "") != 0) {
+ ERR(NL, _("failed to parse config (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
/* set library parameters */
- if(alpm_set_option(PM_OPT_LOGMASK, (long)config->debug) == -1) {
- ERR(NL, _("failed to set option LOGMASK (%s)\n"), alpm_strerror(pm_errno));
+ if(alpm_set_option(PM_OPT_DLCB, (long)log_progress) == -1) {
+ ERR(NL, _("failed to set option DLCB (%s)\n"), alpm_strerror(pm_errno));
cleanup(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));
+ if(alpm_set_option(PM_OPT_DLFNM, (long)sync_fnm) == -1) {
+ ERR(NL, _("failed to set option DLFNM (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
- if(config->dbpath == NULL) {
- config->dbpath = strdup(PM_DBPATH);
- } else {
- /* dbpath has been set by parseargs or parseconfig */
- if(alpm_set_option(PM_OPT_DBPATH, (long)config->dbpath) == -1) {
- ERR(NL, _("failed to set option DBPATH (%s)\n"), alpm_strerror(pm_errno));
- cleanup(1);
- }
+ if(alpm_set_option(PM_OPT_DLOFFSET, (long)&offset) == -1) {
+ ERR(NL, _("failed to set option DLOFFSET (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(1);
+ }
+ if(alpm_set_option(PM_OPT_DLT0, (long)&t0) == -1) {
+ ERR(NL, _("failed to set option DLT0 (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(1);
+ }
+ if(alpm_set_option(PM_OPT_DLT, (long)&t) == -1) {
+ ERR(NL, _("failed to set option DLT (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(1);
+ }
+ if(alpm_set_option(PM_OPT_DLRATE, (long)&rate) == -1) {
+ ERR(NL, _("failed to set option DLRATE (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(1);
+ }
+ if(alpm_set_option(PM_OPT_DLXFERED1, (long)&xfered1) == -1) {
+ ERR(NL, _("failed to set option DLXFERED1 (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(1);
+ }
+ if(alpm_set_option(PM_OPT_DLETA_H, (long)&eta_h) == -1) {
+ ERR(NL, _("failed to set option DLETA_H (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(1);
+ }
+ if(alpm_set_option(PM_OPT_DLETA_M, (long)&eta_m) == -1) {
+ ERR(NL, _("failed to set option DLETA_M (%s)\n"), alpm_strerror(pm_errno));
+ cleanup(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));
+ if(alpm_set_option(PM_OPT_DLETA_S, (long)&eta_s) == -1) {
+ ERR(NL, _("failed to set option DLETA_S (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
}
+ FREE(config->dbpath);
+ alpm_get_option(PM_OPT_DBPATH, (long *)&config->dbpath);
+ FREE(config->cachedir);
+ alpm_get_option(PM_OPT_CACHEDIR, (long *)&config->cachedir);
for(lp = config->op_s_ignore; lp; lp = lp->next) {
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) {
@@ -514,13 +583,13 @@ int main(int argc, char *argv[])
}
if(config->verbose > 0) {
- printf(_("Root : %s\n"), config->root);
- printf(_("DBPath: %s\n"), config->dbpath);
+ printf("Root : %s\n", config->root);
+ printf("DBPath: %s\n", config->dbpath);
list_display(_("Targets:"), pm_targets);
}
/* Opening local database */
- db_local = alpm_db_register("local");
+ db_local = alpm_db_register("local", NULL);
if(db_local == NULL) {
ERR(NL, _("could not register 'local' database (%s)\n"), alpm_strerror(pm_errno));
cleanup(1);
diff --git a/src/pacman/po/LINGUAS b/src/pacman/po/LINGUAS
index bdb700e6..cc891622 100644
--- a/src/pacman/po/LINGUAS
+++ b/src/pacman/po/LINGUAS
@@ -3,4 +3,6 @@
# This file is in the public domain.
#
# Set of available languages.
-
+de
+fr
+hu
diff --git a/src/pacman/po/Makefile.in.in b/src/pacman/po/Makefile.in.in
index 75c5d469..6f2e2e94 100644
--- a/src/pacman/po/Makefile.in.in
+++ b/src/pacman/po/Makefile.in.in
@@ -23,13 +23,13 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
+datarootdir = @datarootdir@
localedir = $(datadir)/locale
gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+mkinstalldirs = @INSTALL@ -d
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
diff --git a/src/pacman/po/POTFILES.in b/src/pacman/po/POTFILES.in
index 5e0e64aa..bd22902e 100644
--- a/src/pacman/po/POTFILES.in
+++ b/src/pacman/po/POTFILES.in
@@ -4,6 +4,7 @@ deptest.c
download.c
list.c
log.c
+log.h
package.c
pacman.c
query.c
diff --git a/src/pacman/po/pacman.pot b/src/pacman/po/pacman.pot
index 067659c0..720a7a64 100644
--- a/src/pacman/po/pacman.pot
+++ b/src/pacman/po/pacman.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-05-31 14:04-0700\n"
+"POT-Creation-Date: 2006-09-03 13:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,11 +16,11 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../add.c:69 ../deptest.c:64 ../remove.c:83 ../sync.c:413 ../sync.c:452
+#: ../add.c:69 ../deptest.c:64 ../remove.c:83 ../sync.c:378 ../sync.c:417
#, c-format
msgid ""
" if you're sure a package manager is not already running,\n"
-" you can remove %s\n"
+" you can remove %s%s\n"
msgstr ""
#. and add targets to it
@@ -28,7 +28,7 @@ msgstr ""
msgid "loading package data... "
msgstr ""
-#: ../add.c:79 ../remove.c:99
+#: ../add.c:79 ../remove.c:92
#, c-format
msgid "failed to add target '%s' (%s)\n"
msgstr ""
@@ -37,180 +37,50 @@ msgstr ""
msgid "done."
msgstr ""
-#: ../add.c:91 ../remove.c:109 ../sync.c:522
+#: ../add.c:92 ../remove.c:102 ../sync.c:505
#, c-format
msgid "failed to prepare transaction (%s)\n"
msgstr ""
-#: ../add.c:96
+#: ../add.c:97
#, c-format
msgid ":: %s: requires %s"
msgstr ""
-#: ../add.c:110
+#: ../add.c:111 ../sync.c:526
#, c-format
msgid ":: %s: conflicts with %s"
msgstr ""
-#: ../add.c:120 ../sync.c:752
+#: ../add.c:121 ../sync.c:649
#, c-format
-msgid "%s exists in \"%s\" (target) and \"%s\" (target)"
+msgid "%s%s exists in \"%s\" (target) and \"%s\" (target)"
msgstr ""
-#: ../add.c:126 ../sync.c:758
+#: ../add.c:128 ../sync.c:656
#, c-format
-msgid "%s: %s exists in filesystem"
+msgid "%s: %s%s exists in filesystem"
msgstr ""
-#: ../add.c:133 ../sync.c:765
+#: ../add.c:136 ../sync.c:664 ../sync.c:671
msgid ""
"\n"
"errors occurred, no packages were upgraded.\n"
msgstr ""
-#: ../add.c:145 ../remove.c:149 ../sync.c:745
+#: ../add.c:143 ../sync.c:536
#, c-format
-msgid "failed to commit transaction (%s)\n"
-msgstr ""
-
-#: ../add.c:154 ../remove.c:160 ../sync.c:445 ../sync.c:785
-#, c-format
-msgid "failed to release transaction (%s)\n"
-msgstr ""
-
-#: ../conf.c:102
-#, c-format
-msgid "config: new section '%s'\n"
-msgstr ""
-
-#: ../conf.c:104
-#, c-format
-msgid "config: line %d: bad section name\n"
-msgstr ""
-
-#: ../conf.c:108
-#, c-format
-msgid ""
-"config: line %d: '%s' is reserved and cannot be used as a package tree\n"
-msgstr ""
-
-#: ../conf.c:134 ../conf.c:156 ../conf.c:279 ../conf.c:345
-#, c-format
-msgid "config: line %d: syntax error\n"
-msgstr ""
-
-#: ../conf.c:140
-#, c-format
-msgid "config: line %d: all directives must belong to a section\n"
-msgstr ""
-
-#: ../conf.c:146
-msgid "config: nopassiveftp\n"
-msgstr ""
-
-#: ../conf.c:149
-#, c-format
-msgid "failed to set option USESYSLOG (%s)\n"
-msgstr ""
-
-#: ../conf.c:152
-msgid "config: usesyslog\n"
-msgstr ""
-
-#: ../conf.c:164
-#, c-format
-msgid "config: including %s\n"
-msgstr ""
-
-#: ../conf.c:173 ../conf.c:181
-#, c-format
-msgid "failed to set option NOUPGRADE (%s)\n"
-msgstr ""
-
-#: ../conf.c:176 ../conf.c:184
-#, c-format
-msgid "config: noupgrade: %s\n"
-msgstr ""
-
-#: ../conf.c:191 ../conf.c:199
-#, c-format
-msgid "failed to set option NOEXTRACT (%s)\n"
-msgstr ""
-
-#: ../conf.c:194 ../conf.c:202
-#, c-format
-msgid "config: noextract: %s\n"
-msgstr ""
-
-#: ../conf.c:209 ../conf.c:217 ../pacman.c:508
-#, c-format
-msgid "failed to set option IGNOREPKG (%s)\n"
-msgstr ""
-
-#: ../conf.c:212 ../conf.c:220
-#, c-format
-msgid "config: ignorepkg: %s\n"
+msgid ":: %.1f MB required, have %.1f MB"
msgstr ""
-#: ../conf.c:227 ../conf.c:232
+#: ../add.c:157 ../remove.c:142 ../sync.c:642
#, c-format
-msgid "config: holdpkg: %s\n"
-msgstr ""
-
-#: ../conf.c:240
-#, c-format
-msgid "config: dbpath: %s\n"
-msgstr ""
-
-#: ../conf.c:248
-#, c-format
-msgid "config: cachedir: %s\n"
-msgstr ""
-
-#: ../conf.c:251
-#, c-format
-msgid "failed to set option LOGFILE (%s)\n"
-msgstr ""
-
-#: ../conf.c:254
-#, c-format
-msgid "config: log file: %s\n"
-msgstr ""
-
-#: ../conf.c:258
-#, c-format
-msgid "config: xfercommand: %s\n"
-msgstr ""
-
-#: ../conf.c:268 ../conf.c:294 ../conf.c:300
-#, c-format
-msgid "config: line %d: bad server location\n"
-msgstr ""
-
-#: ../conf.c:274
-#, c-format
-msgid "config: proxyserver: %s\n"
-msgstr ""
-
-#: ../conf.c:277
-#, c-format
-msgid "config: proxyport: %u\n"
-msgstr ""
-
-#: ../conf.c:317 ../conf.c:332
-#, c-format
-msgid "could not allocate %d bytes\n"
-msgstr ""
-
-#: ../conf.c:338
-#, c-format
-msgid "config: line %d: protocol %s is not supported\n"
+msgid "failed to commit transaction (%s)\n"
msgstr ""
-#. add to the list
-#: ../conf.c:342
+#: ../add.c:164 ../remove.c:152 ../sync.c:410 ../sync.c:684
#, c-format
-msgid "config: %s: server: %s %s %s\n"
+msgid "failed to release transaction (%s)\n"
msgstr ""
#: ../deptest.c:77
@@ -237,168 +107,62 @@ msgstr ""
msgid "conflict: %s"
msgstr ""
-#: ../deptest.c:140 ../deptest.c:157
+#: ../deptest.c:140 ../deptest.c:158
#, c-format
msgid "could not release transaction (%s)"
msgstr ""
-#: ../download.c:208
-#, c-format
-msgid "connecting to %s:21\n"
-msgstr ""
-
-#: ../download.c:210 ../download.c:241 ../download.c:415
-#, c-format
-msgid "cannot connect to %s\n"
-msgstr ""
-
-#: ../download.c:214
-msgid "anonymous login failed\n"
-msgstr ""
-
-#: ../download.c:219
-#, c-format
-msgid "could not cwd to %s: %s\n"
-msgstr ""
-
-#: ../download.c:225
-msgid "failed to set passive mode\n"
-msgstr ""
-
-#: ../download.c:228
-msgid "FTP passive mode not set\n"
-msgstr ""
-
-#: ../download.c:236 ../download.c:410
-#, c-format
-msgid "connecting to %s\n"
-msgstr ""
-
-#: ../download.c:238 ../download.c:412
-#, c-format
-msgid "connecting to %s:%u\n"
-msgstr ""
-
-#: ../download.c:300
-#, c-format
-msgid "could not chdir to %s\n"
-msgstr ""
-
-#. execute the parsed command via /bin/sh -c
-#: ../download.c:304
-#, c-format
-msgid "running command: %s\n"
-msgstr ""
-
-#: ../download.c:307
-msgid "running XferCommand: fork failed!\n"
-msgstr ""
-
-#. download failed
-#: ../download.c:311
-#, c-format
-msgid "XferCommand command returned non-zero status code (%d)\n"
-msgstr ""
-
-#: ../download.c:356
-#, c-format
-msgid "failed to get filesize for %s\n"
-msgstr ""
-
-#: ../download.c:362 ../download.c:475
-#, c-format
-msgid "failed to get mtime for %s\n"
-msgstr ""
-
-#. mtimes are identical, skip this file
-#: ../download.c:367 ../download.c:460
-#, c-format
-msgid "mtimes are identical, skipping %s\n"
-msgstr ""
-
-#: ../download.c:382
-msgid "failed to resume download -- restarting\n"
-msgstr ""
-
-#: ../download.c:389 ../download.c:464
-#, c-format
-msgid ""
-"\n"
-"failed downloading %s from %s: %s\n"
-msgstr ""
-
-#: ../download.c:483
-#, c-format
-msgid "copying %s to %s/%s\n"
-msgstr ""
-
-#: ../download.c:486
-#, c-format
-msgid "failed copying %s\n"
-msgstr ""
-
-#: ../download.c:502
-msgid "] 100% LOCAL "
-msgstr ""
-
-#: ../download.c:564
-#, c-format
-msgid " %s is already in the current directory\n"
-msgstr ""
-
-#: ../download.c:578
-#, c-format
-msgid "failed to download %s\n"
-msgstr ""
-
#: ../list.c:143 ../list.c:171
#, c-format
msgid "None\n"
msgstr ""
-#: ../log.c:54
+#: ../log.c:55
#, c-format
msgid "debug"
msgstr ""
-#: ../log.c:57
+#: ../log.c:58
#, c-format
msgid "error"
msgstr ""
-#: ../log.c:60
+#: ../log.c:61
#, c-format
msgid "warning"
msgstr ""
-#: ../log.c:63
+#: ../log.c:64
#, c-format
msgid "flow1"
msgstr ""
-#: ../log.c:66
+#: ../log.c:67
#, c-format
msgid "flow2"
msgstr ""
-#: ../log.c:69
+#: ../log.c:70
#, c-format
msgid "function"
msgstr ""
-#: ../log.c:72
-#, c-format
-msgid "???"
-msgstr ""
-
-#: ../log.c:153
+#: ../log.c:154
msgid "Y"
msgstr ""
-#: ../log.c:153
+#: ../log.c:154
msgid "YES"
msgstr ""
+#: ../log.h:26
+msgid "error: "
+msgstr ""
+
+#: ../log.h:30
+msgid "warning: "
+msgstr ""
+
#: ../package.c:46
#, c-format
msgid "Name : %s\n"
@@ -418,11 +182,6 @@ msgstr ""
msgid "Packager : %s\n"
msgstr ""
-#: ../package.c:52
-#, c-format
-msgid "URL : %s\n"
-msgstr ""
-
#: ../package.c:53
msgid "License :"
msgstr ""
@@ -444,338 +203,357 @@ msgstr ""
#: ../package.c:60
#, c-format
-msgid "Install Date : %s %s\n"
+msgid "Build Type : %s\n"
+msgstr ""
+
+#: ../package.c:60
+msgid "Unknown"
msgstr ""
#: ../package.c:62
#, c-format
+msgid "Install Date : %s %s\n"
+msgstr ""
+
+#: ../package.c:64
+#, c-format
msgid "Install Script : %s\n"
msgstr ""
#: ../package.c:64
+msgid "Yes"
+msgstr ""
+
+#: ../package.c:64
+msgid "No"
+msgstr ""
+
+#: ../package.c:66
#, c-format
-msgid "Reason: : "
+msgid "Reason : "
msgstr ""
-#: ../package.c:67
+#: ../package.c:69
#, c-format
msgid "Explicitly installed\n"
msgstr ""
-#: ../package.c:70
+#: ../package.c:72
#, c-format
msgid "Installed as a dependency for another package\n"
msgstr ""
-#: ../package.c:73
+#: ../package.c:75
#, c-format
msgid "Unknown\n"
msgstr ""
-#: ../package.c:77
+#: ../package.c:79
msgid "Provides :"
msgstr ""
-#: ../package.c:78
+#: ../package.c:80
msgid "Depends On :"
msgstr ""
-#: ../package.c:79
+#: ../package.c:81
+msgid "Removes :"
+msgstr ""
+
+#: ../package.c:82
msgid "Required By :"
msgstr ""
-#: ../package.c:80
+#: ../package.c:83
msgid "Conflicts With :"
msgstr ""
-#: ../package.c:82
+#: ../package.c:85
#, c-format
msgid "Description : "
msgstr ""
-#: ../package.c:106
+#: ../package.c:110
#, c-format
-msgid "error calculating md5sum for %s\n"
+msgid "error calculating md5sum or sha1sum for %s\n"
msgstr ""
-#: ../package.c:110
+#: ../package.c:115 ../package.c:117
#, c-format
msgid "%sMODIFIED\t%s\n"
msgstr ""
-#: ../package.c:113
+#: ../package.c:115 ../package.c:117
+msgid "NOT "
+msgstr ""
+
+#: ../package.c:121
#, c-format
msgid "MISSING\t\t%s\n"
msgstr ""
-#: ../package.c:131
+#: ../package.c:139
#, c-format
msgid "Repository : %s\n"
msgstr ""
-#: ../package.c:132
+#: ../package.c:140
#, c-format
msgid "Name : %s\n"
msgstr ""
-#: ../package.c:133
+#: ../package.c:141
#, c-format
msgid "Version : %s\n"
msgstr ""
-#: ../package.c:135
+#: ../package.c:143
msgid "Groups :"
msgstr ""
-#: ../package.c:136
+#: ../package.c:144
msgid "Provides :"
msgstr ""
-#: ../package.c:137
+#: ../package.c:145
msgid "Depends On :"
msgstr ""
-#: ../package.c:138
+#: ../package.c:146
+msgid "Removes :"
+msgstr ""
+
+#: ../package.c:147
msgid "Conflicts With :"
msgstr ""
-#: ../package.c:139
+#: ../package.c:148
msgid "Replaces :"
msgstr ""
-#: ../package.c:141
+#: ../package.c:150
#, c-format
msgid "Size (compressed) : %ld\n"
msgstr ""
-#: ../package.c:142
+#: ../package.c:151
#, c-format
-msgid "Description : "
+msgid "Size (uncompressed):%ld\n"
msgstr ""
-#: ../package.c:144
+#: ../package.c:152
#, c-format
-msgid ""
-"\n"
-"MD5 Sum : %s\n"
+msgid "Description : "
msgstr ""
#: ../package.c:156
#, c-format
-msgid "%s %s\n"
-msgstr ""
-
-#: ../pacman.c:82
-#, c-format
-msgid "\n"
-msgstr ""
-
-#: ../pacman.c:83
-#, c-format
-msgid " .--. Pacman v%s - libalpm v%s\n"
-msgstr ""
-
-#: ../pacman.c:84
-#, c-format
msgid ""
-"/ _.-' .-. .-. .-. Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux."
-"org>\n"
-msgstr ""
-
-#: ../pacman.c:85
-#, c-format
-msgid "\\ '-. '-' '-' '-' \n"
+"\n"
+"MD5 Sum : %s"
msgstr ""
-#: ../pacman.c:86
+#: ../package.c:160
#, c-format
-msgid " '--' This program may be freely redistributed under\n"
+msgid ""
+"\n"
+"SHA1 Sum : %s"
msgstr ""
-#: ../pacman.c:87
+#: ../package.c:189
#, c-format
-msgid " the terms of the GNU General Public License\n"
+msgid "No changelog available for '%s'.\n"
msgstr ""
-#: ../pacman.c:98
+#: ../pacman.c:96
#, c-format
msgid "usage: %s {-h --help}\n"
msgstr ""
-#: ../pacman.c:99
+#: ../pacman.c:97
#, c-format
msgid " %s {-V --version}\n"
msgstr ""
-#: ../pacman.c:100
+#: ../pacman.c:98
#, c-format
msgid " %s {-A --add} [options] <file>\n"
msgstr ""
-#: ../pacman.c:101
+#: ../pacman.c:99
#, c-format
msgid " %s {-R --remove} [options] <package>\n"
msgstr ""
-#: ../pacman.c:102
+#: ../pacman.c:100
#, c-format
msgid " %s {-U --upgrade} [options] <file>\n"
msgstr ""
-#: ../pacman.c:103
+#: ../pacman.c:101
#, c-format
msgid " %s {-F --freshen} [options] <file>\n"
msgstr ""
-#: ../pacman.c:104
+#: ../pacman.c:102
#, c-format
msgid " %s {-Q --query} [options] [package]\n"
msgstr ""
-#: ../pacman.c:105
+#: ../pacman.c:103
#, c-format
msgid " %s {-S --sync} [options] [package]\n"
msgstr ""
-#: ../pacman.c:106
+#: ../pacman.c:104
#, c-format
msgid ""
"\n"
"use '%s --help' with other options for more syntax\n"
msgstr ""
-#: ../pacman.c:109
+#: ../pacman.c:107
#, c-format
msgid "usage: %s {-A --add} [options] <file>\n"
msgstr ""
-#: ../pacman.c:110 ../pacman.c:115 ../pacman.c:127 ../pacman.c:132
-#: ../pacman.c:145
+#: ../pacman.c:108 ../pacman.c:113 ../pacman.c:125 ../pacman.c:130
+#: ../pacman.c:144
#, c-format
msgid "options:\n"
msgstr ""
-#: ../pacman.c:111 ../pacman.c:117 ../pacman.c:128 ../pacman.c:147
+#: ../pacman.c:109 ../pacman.c:115 ../pacman.c:126 ../pacman.c:146
#, c-format
msgid " -d, --nodeps skip dependency checks\n"
msgstr ""
-#: ../pacman.c:112 ../pacman.c:129 ../pacman.c:148
+#: ../pacman.c:110 ../pacman.c:127 ../pacman.c:148
#, c-format
msgid " -f, --force force install, overwrite conflicting files\n"
msgstr ""
-#: ../pacman.c:114
+#: ../pacman.c:112
#, c-format
msgid "usage: %s {-R --remove} [options] <package>\n"
msgstr ""
-#: ../pacman.c:116
+#: ../pacman.c:114
#, c-format
msgid ""
" -c, --cascade remove packages and all packages that depend on them\n"
msgstr ""
-#: ../pacman.c:118
+#: ../pacman.c:116
#, c-format
msgid " -k, --dbonly only remove database entry, do not remove files\n"
msgstr ""
-#: ../pacman.c:119
+#: ../pacman.c:117
#, c-format
msgid " -n, --nosave remove configuration files as well\n"
msgstr ""
-#: ../pacman.c:120
+#: ../pacman.c:118
#, c-format
msgid ""
" -s, --recursive remove dependencies also (that won't break packages)\n"
msgstr ""
-#: ../pacman.c:123
+#: ../pacman.c:121
#, c-format
msgid "usage: %s {-F --freshen} [options] <file>\n"
msgstr ""
-#: ../pacman.c:125
+#: ../pacman.c:123
#, c-format
msgid "usage: %s {-U --upgrade} [options] <file>\n"
msgstr ""
-#: ../pacman.c:131
+#: ../pacman.c:129
#, c-format
msgid "usage: %s {-Q --query} [options] [package]\n"
msgstr ""
-#: ../pacman.c:133
+#: ../pacman.c:131
+#, c-format
+msgid " -c, --changelog view the changelog of a package\n"
+msgstr ""
+
+#: ../pacman.c:132
#, c-format
msgid ""
-" -e, --orphans list all packages that were explicitly installed\n"
+" -e, --orphans list all packages that were installed as a dependency\n"
msgstr ""
-#: ../pacman.c:134
+#: ../pacman.c:133
#, c-format
msgid " and are not required by any other packages\n"
msgstr ""
-#: ../pacman.c:135 ../pacman.c:149
+#: ../pacman.c:134 ../pacman.c:149
#, c-format
msgid " -g, --groups view all members of a package group\n"
msgstr ""
-#: ../pacman.c:136
+#: ../pacman.c:135
#, c-format
msgid " -i, --info view package information\n"
msgstr ""
-#: ../pacman.c:137
+#: ../pacman.c:136
#, c-format
msgid " -l, --list list the contents of the queried package\n"
msgstr ""
-#: ../pacman.c:138
+#: ../pacman.c:137
#, c-format
msgid ""
-" -m, --foreign list all packages that were not found in the sync "
-"repos\n"
+" -m, --foreign list all packages that were not found in the sync db"
+"(s)\n"
msgstr ""
-#: ../pacman.c:139
+#: ../pacman.c:138
#, c-format
msgid " -o, --owns <file> query the package that owns <file>\n"
msgstr ""
-#: ../pacman.c:140
+#: ../pacman.c:139
#, c-format
msgid ""
" -p, --file pacman will query the package file [package] instead "
"of\n"
msgstr ""
-#: ../pacman.c:141
+#: ../pacman.c:140
#, c-format
msgid " looking in the database\n"
msgstr ""
-#: ../pacman.c:142
+#: ../pacman.c:141
#, c-format
msgid ""
" -s, --search search locally-installed packages for matching "
"strings\n"
msgstr ""
-#: ../pacman.c:144
+#: ../pacman.c:143
#, c-format
msgid "usage: %s {-S --sync} [options] [package]\n"
msgstr ""
-#: ../pacman.c:146
+#: ../pacman.c:145
#, c-format
msgid ""
" -c, --clean remove old packages from cache directory (use -cc for "
"all)\n"
msgstr ""
+#: ../pacman.c:147
+#, c-format
+msgid " -e, --dependsonly install dependencies only\n"
+msgstr ""
+
#: ../pacman.c:150
#, c-format
msgid ""
@@ -823,97 +601,147 @@ msgstr ""
#: ../pacman.c:159
#, c-format
+msgid " --ask <number> pre-specify answers for questions (see manpage)\n"
+msgstr ""
+
+#: ../pacman.c:160
+#, c-format
msgid ""
" --noprogressbar do not show a progress bar when downloading files\n"
msgstr ""
-#: ../pacman.c:160
+#: ../pacman.c:161
#, c-format
msgid ""
" --noscriptlet do not execute the install scriptlet if there is any\n"
msgstr ""
-#: ../pacman.c:161
+#: ../pacman.c:162
#, c-format
msgid " -v, --verbose be verbose\n"
msgstr ""
-#: ../pacman.c:162
+#: ../pacman.c:163
#, c-format
msgid " -r, --root <path> set an alternate installation root\n"
msgstr ""
-#: ../pacman.c:163
+#: ../pacman.c:164
#, c-format
msgid " -b, --dbpath <path> set an alternate database location\n"
msgstr ""
-#: ../pacman.c:289
-msgid "bad root path"
+#: ../pacman.c:177
+#, c-format
+msgid " This program may be freely redistributed under\n"
msgstr ""
-#: ../pacman.c:315
-msgid "only one operation may be used at a time\n"
+#: ../pacman.c:178
+#, c-format
+msgid " the terms of the GNU General Public License\n"
msgstr ""
-#: ../pacman.c:347
-#, c-format
-msgid "%s\n"
+#: ../pacman.c:363
+msgid "bad root path"
+msgstr ""
+
+#: ../pacman.c:390
+msgid "only one operation may be used at a time\n"
msgstr ""
-#: ../pacman.c:448
+#: ../pacman.c:486
msgid "you cannot perform this operation unless you are root.\n"
msgstr ""
-#: ../pacman.c:472
+#: ../pacman.c:510
#, c-format
msgid "failed to initilize alpm library (%s)\n"
msgstr ""
-#: ../pacman.c:485
+#: ../pacman.c:518
+#, c-format
+msgid "failed to parse config (%s)\n"
+msgstr ""
+
+#: ../pacman.c:524
#, c-format
msgid "failed to set option LOGMASK (%s)\n"
msgstr ""
-#: ../pacman.c:489
+#: ../pacman.c:528
#, c-format
msgid "failed to set option LOGCB (%s)\n"
msgstr ""
-#: ../pacman.c:497
+#: ../pacman.c:532
+#, c-format
+msgid "failed to set option DLCB (%s)\n"
+msgstr ""
+
+#: ../pacman.c:536
+#, c-format
+msgid "failed to set option DLFNM (%s)\n"
+msgstr ""
+
+#: ../pacman.c:540
+#, c-format
+msgid "failed to set option DLOFFSET (%s)\n"
+msgstr ""
+
+#: ../pacman.c:544
+#, c-format
+msgid "failed to set option DLT0 (%s)\n"
+msgstr ""
+
+#: ../pacman.c:548
+#, c-format
+msgid "failed to set option DLT (%s)\n"
+msgstr ""
+
+#: ../pacman.c:552
+#, c-format
+msgid "failed to set option DLRATE (%s)\n"
+msgstr ""
+
+#: ../pacman.c:556
#, c-format
-msgid "failed to set option DBPATH (%s)\n"
+msgid "failed to set option DLXFERED1 (%s)\n"
msgstr ""
-#: ../pacman.c:502 ../sync.c:698
+#: ../pacman.c:560
#, c-format
-msgid "failed to set option CACHEDIR (%s)\n"
+msgid "failed to set option DLETA_H (%s)\n"
msgstr ""
-#: ../pacman.c:514
+#: ../pacman.c:564
#, c-format
-msgid "Root : %s\n"
+msgid "failed to set option DLETA_M (%s)\n"
msgstr ""
-#: ../pacman.c:515
+#: ../pacman.c:568
#, c-format
-msgid "DBPath: %s\n"
+msgid "failed to set option DLETA_S (%s)\n"
msgstr ""
-#: ../pacman.c:516
+#: ../pacman.c:578
+#, c-format
+msgid "failed to set option IGNOREPKG (%s)\n"
+msgstr ""
+
+#: ../pacman.c:586
msgid "Targets:"
msgstr ""
-#: ../pacman.c:522
+#: ../pacman.c:592
#, c-format
msgid "could not register 'local' database (%s)\n"
msgstr ""
-#: ../pacman.c:529
+#: ../pacman.c:599
msgid "no targets specified (use -h for help)\n"
msgstr ""
-#: ../pacman.c:542
+#: ../pacman.c:612
msgid "no operation specified (use -h for help)\n"
msgstr ""
@@ -936,31 +764,31 @@ msgstr ""
msgid "No package owns %s\n"
msgstr ""
-#: ../query.c:111 ../sync.c:365
+#: ../query.c:111 ../sync.c:340
msgid "no usable package repositories configured.\n"
msgstr ""
-#: ../query.c:160
+#: ../query.c:150
#, c-format
msgid "group \"%s\" was not found\n"
msgstr ""
-#: ../query.c:170
+#: ../query.c:160
msgid "no package file was specified for --file\n"
msgstr ""
-#: ../query.c:174
+#: ../query.c:164
#, c-format
msgid "failed to load package '%s' (%s)\n"
msgstr ""
#. something weird happened
-#: ../query.c:212 ../query.c:256
+#: ../query.c:202 ../query.c:244
#, c-format
msgid "package \"%s\" not found\n"
msgstr ""
-#: ../remove.c:64 ../sync.c:489
+#: ../remove.c:64 ../sync.c:456
#, c-format
msgid ":: group %s:\n"
msgstr ""
@@ -974,187 +802,176 @@ msgstr ""
msgid ":: Remove %s from group %s? [Y/n] "
msgstr ""
-#: ../remove.c:81 ../sync.c:411 ../sync.c:450
+#: ../remove.c:81 ../sync.c:376 ../sync.c:415
#, c-format
msgid "failed to init transaction (%s)\n"
msgstr ""
-#: ../remove.c:94
-#, c-format
-msgid ":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "
-msgstr ""
-
-#: ../remove.c:114
+#: ../remove.c:107
#, c-format
msgid " %s: is required by %s\n"
msgstr ""
-#: ../remove.c:136
+#: ../remove.c:129
msgid ""
"\n"
"Targets:"
msgstr ""
#. get confirmation
-#: ../remove.c:139
+#: ../remove.c:132
msgid ""
"\n"
"Do you want to remove these packages? [Y/n] "
msgstr ""
-#: ../sync.c:68
+#: ../sync.c:73
+msgid "Do you want to remove old packages from cache? [Y/n] "
+msgstr ""
+
+#: ../sync.c:75
msgid "removing old packages from cache... "
msgstr ""
-#: ../sync.c:71
+#: ../sync.c:78
msgid "could not access cache directory\n"
msgstr ""
#. full cleanup
-#: ../sync.c:131
+#: ../sync.c:138
+msgid "Do you want to remove all packages from cache? [Y/n] "
+msgstr ""
+
+#: ../sync.c:140
msgid "removing all packages from cache... "
msgstr ""
-#: ../sync.c:134
+#: ../sync.c:143
msgid "could not remove cache directory\n"
msgstr ""
-#: ../sync.c:139
+#: ../sync.c:148
msgid "could not create new cache directory\n"
msgstr ""
-#: ../sync.c:144 ../sync.c:736 ../trans.c:66 ../trans.c:72 ../trans.c:82
-#: ../trans.c:92
+#: ../sync.c:153 ../trans.c:72 ../trans.c:86 ../trans.c:100 ../trans.c:116
+#: ../trans.c:128
msgid "done.\n"
msgstr ""
#: ../sync.c:168
#, c-format
-msgid "failed to get lastupdate time for %s (no big deal)\n"
-msgstr ""
-
-#: ../sync.c:181
-#, c-format
msgid "failed to synchronize %s\n"
msgstr ""
-#: ../sync.c:184
-#, c-format
-msgid " %s is up to date\n"
-msgstr ""
-
-#: ../sync.c:187
-#, c-format
-msgid "sync: new mtime for %s: %s\n"
-msgstr ""
-
-#: ../sync.c:192
+#: ../sync.c:170
#, c-format
msgid "failed to update %s (%s)\n"
msgstr ""
-#: ../sync.c:218
+#: ../sync.c:174
#, c-format
-msgid ""
-"%s/%s %s\n"
-" "
+msgid " %s is up to date\n"
msgstr ""
-#: ../sync.c:286
+#: ../sync.c:265
#, c-format
msgid "package \"%s\" was not found.\n"
msgstr ""
-#: ../sync.c:324
+#: ../sync.c:303
#, c-format
msgid "repository \"%s\" was not found.\n"
msgstr ""
#. grab a fresh package list
-#: ../sync.c:385
+#: ../sync.c:350
msgid ":: Synchronizing package databases...\n"
msgstr ""
-#: ../sync.c:386
+#: ../sync.c:351
msgid "synchronizing package lists"
msgstr ""
-#: ../sync.c:420
+#: ../sync.c:385
msgid ":: Starting local database upgrade...\n"
msgstr ""
-#: ../sync.c:421
+#: ../sync.c:386
msgid "starting full system upgrade"
msgstr ""
-#: ../sync.c:439
+#: ../sync.c:404
msgid ""
"\n"
":: pacman has detected a newer version of the \"pacman\" package.\n"
msgstr ""
-#: ../sync.c:440
+#: ../sync.c:405
msgid ":: It is recommended that you allow pacman to upgrade itself\n"
msgstr ""
-#: ../sync.c:441
+#: ../sync.c:406
msgid ":: first, then you can re-run the operation with the newer version.\n"
msgstr ""
-#: ../sync.c:442
-msgid "::\n"
-msgstr ""
-
-#: ../sync.c:443
+#: ../sync.c:408
msgid ":: Upgrade pacman first? [Y/n] "
msgstr ""
-#: ../sync.c:458 ../sync.c:478
+#: ../sync.c:423 ../sync.c:444
#, c-format
msgid "could not add target '%s': %s\n"
msgstr ""
-#: ../sync.c:495
+#: ../sync.c:462
msgid ":: Install whole content? [Y/n] "
msgstr ""
-#: ../sync.c:502
+#: ../sync.c:469
#, c-format
msgid ":: Install %s from group %s? [Y/n] "
msgstr ""
-#: ../sync.c:527
+#: ../sync.c:492
#, c-format
-msgid ":: %s: %s %s"
+msgid "could not add target '%s': not found in sync db\n"
msgstr ""
-#: ../sync.c:528
+#: ../sync.c:511
msgid "requires"
msgstr ""
-#: ../sync.c:528
+#: ../sync.c:511
msgid "is required by"
msgstr ""
-#: ../sync.c:593
+#: ../sync.c:588
msgid ""
"\n"
"Remove: "
msgstr ""
-#: ../sync.c:605
+#: ../sync.c:604
msgid ""
"\n"
"Targets: "
msgstr ""
-#: ../sync.c:608
+#: ../sync.c:607
#, c-format
msgid ""
"\n"
"Total Package Size: %.1f MB\n"
msgstr ""
+#: ../sync.c:608
+#, c-format
+msgid ""
+"\n"
+"Total Uncompressed Package Size: %.1f MB\n"
+msgstr ""
+
#: ../sync.c:614
msgid ""
"\n"
@@ -1175,141 +992,128 @@ msgstr ""
msgid "Proceed with upgrade? [Y/n] "
msgstr ""
-#: ../sync.c:676
-#, c-format
-msgid " %s-%s"
+#: ../trans.c:57
+msgid "checking dependencies... "
msgstr ""
-#: ../sync.c:676
-msgid " is already in the cache\n"
+#: ../trans.c:60
+msgid "checking for file conflicts... "
msgstr ""
-#: ../sync.c:684
-#, c-format
-msgid ""
-"\n"
-":: Retrieving packages from %s...\n"
+#: ../trans.c:63
+msgid "resolving dependencies... "
msgstr ""
-#. no cache directory.... try creating it
-#: ../sync.c:688
-#, c-format
-msgid "no %s cache exists. creating...\n"
+#: ../trans.c:66
+msgid "looking for inter-conflicts... "
msgstr ""
-#: ../sync.c:689
+#: ../trans.c:81
#, c-format
-msgid "warning: no %s cache exists. creating..."
-msgstr ""
-
-#. couldn't mkdir the cache directory, so fall back to /tmp and unlink
-#. * the package afterwards.
-#.
-#: ../sync.c:694
-msgid "couldn't create package cache, using /tmp instead"
+msgid "installing %s... "
msgstr ""
-#: ../sync.c:695
-msgid "warning: couldn't create package cache, using /tmp instead"
+#: ../trans.c:88
+#, c-format
+msgid "installed %s (%s)"
msgstr ""
-#: ../sync.c:705
+#: ../trans.c:95
#, c-format
-msgid "failed to retrieve some files from %s\n"
+msgid "removing %s... "
msgstr ""
-#. Check integrity of files
-#: ../sync.c:718
-msgid "checking package integrity... "
+#: ../trans.c:104
+#, c-format
+msgid "removed %s (%s)"
msgstr ""
-#: ../sync.c:725
+#: ../trans.c:111
#, c-format
-msgid "archive %s is corrupted\n"
+msgid "upgrading %s... "
msgstr ""
-#: ../sync.c:727
+#: ../trans.c:118
#, c-format
-msgid "could not get checksum for package %s (%s)\n"
+msgid "upgraded %s (%s -> %s)"
msgstr ""
-#: ../trans.c:51
-msgid "checking dependencies... "
+#: ../trans.c:125
+msgid "checking package integrity... "
msgstr ""
-#: ../trans.c:54
-msgid "checking for file conflicts... "
+#: ../trans.c:139
+msgid " done.\n"
msgstr ""
-#: ../trans.c:57
-msgid "resolving dependencies... "
+#: ../trans.c:141
+msgid " failed.\n"
msgstr ""
-#: ../trans.c:60
-msgid "looking for inter-conflicts... "
+#: ../trans.c:148
+#, c-format
+msgid ""
+"\n"
+":: Retrieving packages from %s...\n"
msgstr ""
-#: ../trans.c:69
-#, c-format
-msgid "installing %s... "
+#: ../trans.c:158
+msgid "] 100% LOCAL "
msgstr ""
-#: ../trans.c:73
+#: ../trans.c:176
#, c-format
-msgid "installed %s (%s)"
+msgid ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] "
msgstr ""
-#: ../trans.c:79
+#: ../trans.c:190
#, c-format
-msgid "removing %s... "
+msgid ":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "
msgstr ""
-#: ../trans.c:83
+#: ../trans.c:203
#, c-format
-msgid "removed %s (%s)"
+msgid ":: Replace %s with %s/%s? [Y/n] "
msgstr ""
-#: ../trans.c:89
+#: ../trans.c:218
#, c-format
-msgid "upgrading %s... "
+msgid ":: %s conflicts with %s. Remove %s? [Y/n] "
msgstr ""
-#: ../trans.c:93
+#: ../trans.c:234
#, c-format
-msgid "upgraded %s (%s -> %s)"
+msgid ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "
msgstr ""
-#: ../trans.c:108
+#: ../trans.c:252
#, c-format
-msgid ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] "
+msgid ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "
msgstr ""
-#: ../trans.c:114
+#: ../trans.c:270
#, c-format
-msgid ":: Replace %s with %s/%s? [Y/n] "
+msgid ":: Archive %s is corrupted. Do you want to delete it? [Y/n] "
msgstr ""
-#: ../trans.c:121
-#, c-format
-msgid ":: %s conflicts with %s. Remove %s? [Y/n] "
+#: ../trans.c:286
+msgid "installing"
msgstr ""
-#: ../trans.c:129
-#, c-format
-msgid ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "
+#: ../trans.c:287
+msgid "upgrading"
msgstr ""
-#: ../trans.c:139
-#, c-format
-msgid ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "
+#: ../trans.c:288
+msgid "removing"
msgstr ""
-#: ../util.c:172
+#: ../util.c:178
#, c-format
msgid "failed to allocated %d bytes\n"
msgstr ""
-#: ../util.c:226
+#: ../util.c:232
#, c-format
msgid "%s is not a valid regular expression.\n"
msgstr ""
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 233e61e7..54828072 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -30,7 +30,6 @@
/* pacman */
#include "list.h"
#include "package.h"
-#include "db.h"
#include "query.h"
#include "log.h"
#include "conf.h"
@@ -95,14 +94,28 @@ int pacman_query(list_t *targets)
PM_PKG *info = NULL;
list_t *targ;
list_t *i;
- PM_LIST *j;
+ PM_LIST *j, *ret;
char *package = NULL;
int done = 0;
if(config->op_q_search) {
- if(db_search(db_local, "local", targets)) {
+ for(i = targets; i; i = i->next) {
+ alpm_set_option(PM_OPT_NEEDLES, (long)i->data);
+ }
+ ret = alpm_db_search(db_local);
+ if(ret == NULL) {
return(1);
}
+ for(j = ret; j; j = alpm_list_next(j)) {
+ PM_PKG *pkg = alpm_list_getdata(j);
+
+ printf("local/%s/%s %s\n ",
+ (char*)alpm_list_getdata(alpm_pkg_getinfo(pkg, PM_PKG_GROUPS)),
+ (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME),
+ (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
+ indentprint((char *)alpm_pkg_getinfo(pkg, PM_PKG_DESC), 4);
+ printf("\n");
+ }
return(0);
}
@@ -111,16 +124,6 @@ int pacman_query(list_t *targets)
ERR(NL, _("no usable package repositories configured.\n"));
return(1);
}
-
- /* open the database(s) */
- for(i = pmc_syncs; i; i = i->next) {
- sync_t *sync = i->data;
- sync->db = alpm_db_register(sync->treename);
- if(sync->db == NULL) {
- ERR(NL, "%s\n", alpm_strerror(pm_errno));
- return(1);
- }
- }
}
for(targ = targets; !done; targ = (targ ? targ->next : NULL)) {
@@ -221,10 +224,8 @@ int pacman_query(list_t *targets)
char *haystack;
char *needle;
haystack = strdup(alpm_pkg_getinfo(pkg, PM_PKG_NAME));
- strtoupper(haystack);
needle = strdup(alpm_pkg_getinfo(info, PM_PKG_NAME));
- strtoupper(needle);
- if(strstr(haystack, needle)) {
+ if(!strcmp(haystack, needle)) {
match = 1;
}
FREE(haystack);
@@ -240,7 +241,7 @@ int pacman_query(list_t *targets)
}
if(config->op_q_orphans) {
if(alpm_pkg_getinfo(info, PM_PKG_REQUIREDBY) == NULL
- && (int)alpm_pkg_getinfo(info, PM_PKG_REASON) == PM_PKG_REASON_EXPLICIT) {
+ && (long)alpm_pkg_getinfo(info, PM_PKG_REASON) == PM_PKG_REASON_DEPEND) {
MSG(NL, "%s %s\n", pkgname, pkgver);
}
}
@@ -249,7 +250,7 @@ int pacman_query(list_t *targets)
}
}
} else {
- char *pkgname, *pkgver;
+ char *pkgname, *pkgver, changelog[PATH_MAX];
info = alpm_db_readpkg(db_local, package);
if(info == NULL) {
@@ -258,7 +259,17 @@ int pacman_query(list_t *targets)
}
/* find a target */
- if(config->op_q_info || config->op_q_list) {
+ if(config->op_q_changelog || config->op_q_info || config->op_q_list) {
+ if(config->op_q_changelog) {
+ char *dbpath;
+ alpm_get_option(PM_OPT_DBPATH, (long *)&dbpath);
+ snprintf(changelog, PATH_MAX, "%s%s/%s/%s-%s/changelog",
+ config->root, dbpath,
+ (char*)alpm_db_getinfo(db_local, PM_DB_TREENAME),
+ (char*)alpm_pkg_getinfo(info, PM_PKG_NAME),
+ (char*)alpm_pkg_getinfo(info, PM_PKG_VERSION));
+ dump_pkg_changelog(changelog, (char*)alpm_pkg_getinfo(info, PM_PKG_NAME));
+ }
if(config->op_q_info) {
dump_pkg_full(info, config->op_q_info);
}
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 2092ccf0..475df393 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -77,24 +77,17 @@ int pacman_remove(list_t *targets)
/* 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, cb_trans_progress) == -1) {
ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
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%s\n"), config->root, PM_LOCK);
}
FREELIST(finaltargs);
return(1);
}
/* and add targets to it */
for(i = finaltargs; i; i = i->next) {
- /* check if the package is in the HoldPkg list. If so, ask
- * confirmation first */
- if(list_is_strin(i->data, config->holdpkg)) {
- if(!yesno(_(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "), i->data)) {
- return(1);
- }
- }
if(alpm_trans_addtarget(i->data) == -1) {
ERR(NL, _("failed to add target '%s' (%s)\n"), (char *)i->data, alpm_strerror(pm_errno));
retval = 1;
@@ -155,7 +148,6 @@ int pacman_remove(list_t *targets)
*/
cleanup:
FREELIST(finaltargs);
-
if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index c25ef17f..d06ed278 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -19,6 +19,11 @@
* USA.
*/
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#include <sys/stat.h>
+#endif
+
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
@@ -38,7 +43,6 @@
#include "download.h"
#include "list.h"
#include "package.h"
-#include "db.h"
#include "trans.h"
#include "sync.h"
#include "conf.h"
@@ -65,6 +69,8 @@ static int sync_cleancache(int level)
list_t *clean = NULL;
list_t *i, *j;
+ if(!yesno(_("Do you want to remove old packages from cache? [Y/n] ")))
+ return(0);
MSG(NL, _("removing old packages from cache... "));
dir = opendir(dirpath);
if(dir == NULL) {
@@ -128,6 +134,8 @@ static int sync_cleancache(int level)
FREELIST(clean);
} else {
/* full cleanup */
+ if(!yesno(_("Do you want to remove all packages from cache? [Y/n] ")))
+ return(0);
MSG(NL, _("removing all packages from cache... "));
if(rmrf(dirpath)) {
@@ -147,52 +155,22 @@ static int sync_cleancache(int level)
static int sync_synctree(int level, list_t *syncs)
{
- char *root, *dbpath;
- char path[PATH_MAX];
list_t *i;
int success = 0, ret;
- alpm_get_option(PM_OPT_ROOT, (long *)&root);
- alpm_get_option(PM_OPT_DBPATH, (long *)&dbpath);
-
for(i = syncs; i; i = i->next) {
- list_t *files = NULL;
- char newmtime[16] = "";
- char lastupdate[16] = "";
sync_t *sync = (sync_t *)i->data;
- if(level < 2) {
- /* get the lastupdate time */
- db_getlastupdate(sync->db, lastupdate);
- if(strlen(lastupdate) == 0) {
- vprint(_("failed to get lastupdate time for %s (no big deal)\n"), sync->treename);
- }
- }
-
- /* build a one-element list */
- snprintf(path, PATH_MAX, "%s" PM_EXT_DB, sync->treename);
- files = list_add(files, strdup(path));
-
- snprintf(path, PATH_MAX, "%s%s", root, dbpath);
-
- ret = downloadfiles_forreal(sync->servers, path, files, lastupdate, newmtime);
- FREELIST(files);
+ ret = alpm_db_update(level, sync->db);
if(ret > 0) {
- ERR(NL, _("failed to synchronize %s\n"), sync->treename);
+ if(pm_errno == PM_ERR_DB_SYNC) {
+ ERR(NL, _("failed to synchronize %s\n"), sync->treename);
+ } else {
+ ERR(NL, _("failed to update %s (%s)\n"), sync->treename, alpm_strerror(pm_errno));
+ }
success--;
} else if(ret < 0) {
MSG(NL, _(" %s is up to date\n"), sync->treename);
- } else {
- if(strlen(newmtime)) {
- vprint(_("sync: new mtime for %s: %s\n"), sync->treename, newmtime);
- db_setlastupdate(sync->db, newmtime);
- }
- snprintf(path, PATH_MAX, "%s%s/%s" PM_EXT_DB, root, dbpath, sync->treename);
- if(alpm_db_update(sync->db, path) == -1) {
- ERR(NL, _("failed to update %s (%s)\n"), sync->treename, alpm_strerror(pm_errno));
- }
- /* remove the .tar.gz */
- unlink(path);
}
}
@@ -202,12 +180,29 @@ static int sync_synctree(int level, list_t *syncs)
static int sync_search(list_t *syncs, list_t *targets)
{
list_t *i;
+ PM_LIST *ret;
+ for(i = targets; i; i = i->next) {
+ alpm_set_option(PM_OPT_NEEDLES, (long)i->data);
+ }
for(i = syncs; i; i = i->next) {
sync_t *sync = i->data;
if(targets) {
- if(db_search(sync->db, sync->treename, targets)) {
- return(1);
+ PM_LIST *lp;
+ ret = alpm_db_search(sync->db);
+ if(ret == NULL) {
+ continue;
+ }
+ for(lp = ret; lp; lp = alpm_list_next(lp)) {
+ PM_PKG *pkg = alpm_list_getdata(lp);
+
+ char *group = (char *)alpm_list_getdata(alpm_pkg_getinfo(pkg,PM_PKG_GROUPS));
+ printf("%s/%s%s%s %s\n ", (char *)alpm_db_getinfo(sync->db, PM_DB_TREENAME),
+ (char *)alpm_pkg_getinfo(pkg, PM_PKG_NAME),
+ (char *)alpm_pkg_getinfo(pkg, PM_PKG_VERSION));
+ (group ? " (" : ""), (group ? group : ""), (group ? ") " : ""),
+ indentprint((char *)alpm_pkg_getinfo(pkg, PM_PKG_DESC), 4);
+ printf("\n");
}
} else {
PM_LIST *lp;
@@ -215,7 +210,7 @@ static int sync_search(list_t *syncs, list_t *targets)
for(lp = alpm_db_getpkgcache(sync->db); lp; lp = alpm_list_next(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);
MSG(NL, "\n");
}
@@ -228,7 +223,7 @@ static int sync_search(list_t *syncs, list_t *targets)
static int sync_group(int level, list_t *syncs, list_t *targets)
{
list_t *i, *j;
-
+
if(targets) {
for(i = targets; i; i = i->next) {
for(j = syncs; j; j = j->next) {
@@ -236,7 +231,7 @@ static int sync_group(int level, list_t *syncs, list_t *targets)
PM_GRP *grp = alpm_db_readgrp(sync->db, i->data);
if(grp) {
- MSG(NL, "%s/%s\n", sync->treename, (char *)alpm_grp_getinfo(grp, PM_GRP_NAME));
+ MSG(NL, "%s\n", (char *)alpm_grp_getinfo(grp, PM_GRP_NAME));
PM_LIST_display(" ", alpm_grp_getinfo(grp, PM_GRP_PKGNAMES));
}
}
@@ -249,8 +244,8 @@ static int sync_group(int level, list_t *syncs, list_t *targets)
for(lp = alpm_db_getgrpcache(sync->db); lp; lp = alpm_list_next(lp)) {
PM_GRP *grp = alpm_list_getdata(lp);
- MSG(NL, "%s/%s\n", sync->treename, (char *)alpm_grp_getinfo(grp, PM_GRP_NAME));
- if(level > 1) {
+ MSG(NL, "%s\n", (char *)alpm_grp_getinfo(grp, PM_GRP_NAME));
+ if(grp && level > 1) {
PM_LIST_display(" ", alpm_grp_getinfo(grp, PM_GRP_PKGNAMES));
}
}
@@ -356,10 +351,6 @@ int pacman_sync(list_t *targets)
int retval = 0;
list_t *i;
PM_LIST *packages, *data, *lp;
- char *root, *cachedir;
- char ldir[PATH_MAX];
- int varcache = 1;
- list_t *files = NULL;
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
ERR(NL, _("no usable package repositories configured.\n"));
@@ -370,16 +361,6 @@ int pacman_sync(list_t *targets)
return(sync_cleancache(config->op_s_clean));
}
- /* open the database(s) */
- for(i = pmc_syncs; i; i = i->next) {
- sync_t *sync = i->data;
- sync->db = alpm_db_register(sync->treename);
- if(sync->db == NULL) {
- ERR(NL, "%s\n", alpm_strerror(pm_errno));
- return(1);
- }
- }
-
if(config->op_s_sync) {
/* grab a fresh package list */
MSG(NL, _(":: Synchronizing package databases...\n"));
@@ -407,11 +388,11 @@ int pacman_sync(list_t *targets)
/* 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, cb_trans_progress) == -1) {
ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
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%s\n"), config->root, PM_LOCK);
}
return(1);
}
@@ -439,18 +420,18 @@ int pacman_sync(list_t *targets)
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, _(":: 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(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval = 1;
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, cb_trans_progress) == -1) {
ERR(NL, _("failed to init transaction (%s)\n"), alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
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%s\n"), config->root, PM_LOCK);
}
return(1);
}
@@ -470,6 +451,7 @@ int pacman_sync(list_t *targets)
if(alpm_trans_addtarget(targ) == -1) {
PM_GRP *grp = NULL;
list_t *j;
+ int found=0;
if(pm_errno == PM_ERR_TRANS_DUP_TARGET) {
/* just ignore duplicate targets */
continue;
@@ -480,12 +462,13 @@ int pacman_sync(list_t *targets)
goto cleanup;
}
/* target not found: check if it's a group */
- for(j = pmc_syncs; j && !grp; j = j->next) {
+ for(j = pmc_syncs; j; j = j->next) {
sync_t *sync = j->data;
grp = alpm_db_readgrp(sync->db, targ);
if(grp) {
PM_LIST *pmpkgs;
list_t *k, *pkgs;
+ found++;
MSG(NL, _(":: group %s:\n"), targ);
pmpkgs = alpm_grp_getinfo(grp, PM_GRP_PKGNAMES);
/* remove dupe entries in case a package exists in multiple repos */
@@ -507,10 +490,25 @@ int pacman_sync(list_t *targets)
FREELIST(pkgs);
}
}
- if(grp == NULL) {
- ERR(NL, "could not add target '%s': not found in sync db\n", targ);
- retval = 1;
- goto cleanup;
+ if(!found) {
+ /* targ not found in sync db, searching for providers... */
+ PM_LIST *k = NULL;
+ PM_PKG *pkg;
+ char *pname;
+ for(j = pmc_syncs; j && !k; j = j->next) {
+ sync_t *sync = j->data;
+ k = alpm_db_whatprovides(sync->db, targ);
+ pkg = (PM_PKG*)alpm_list_getdata(alpm_list_first(k));
+ pname = (char*)alpm_pkg_getinfo(pkg, PM_PKG_NAME);
+ }
+ if(pname != NULL) {
+ /* targ is provided by pname */
+ targets = list_add(targets, strdup(pname));
+ } else {
+ ERR(NL, _("could not add target '%s': not found in sync db\n"), targ);
+ retval = 1;
+ goto cleanup;
+ }
}
}
}
@@ -519,15 +517,16 @@ int pacman_sync(list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags
*/
if(alpm_trans_prepare(&data) == -1) {
+ long long *pkgsize, *freespace;
ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
- 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"),
+ MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
+ (long)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
+ switch((long)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_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -539,11 +538,21 @@ int pacman_sync(list_t *targets)
case PM_ERR_CONFLICTING_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
- MSG(NL, ":: %s: conflicts with %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
- alpm_dep_getinfo(miss, PM_DEP_NAME));
+
+ MSG(NL, _(":: %s: conflicts with %s"),
+ alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
}
alpm_list_free(data);
break;
+ case PM_ERR_DISK_FULL:
+ lp = alpm_list_first(data);
+ pkgsize = alpm_list_getdata(lp);
+ lp = alpm_list_next(lp);
+ freespace = alpm_list_getdata(lp);
+ MSG(NL, _(":: %.1f MB required, have %.1f MB"),
+ (double)(*pkgsize / 1048576.0), (double)(*freespace / 1048576.0));
+ alpm_list_free(data);
+ break;
default:
break;
}
@@ -558,19 +567,20 @@ int pacman_sync(list_t *targets)
}
/* list targets and get confirmation */
- if(!config->op_s_printuris) {
+ if(!((unsigned long)alpm_trans_getinfo(PM_TRANS_FLAGS) & PM_TRANS_FLAG_PRINTURIS)) {
list_t *list_install = NULL;
list_t *list_remove = NULL;
char *str;
unsigned long totalsize = 0;
- double mb;
+ unsigned long totalusize = 0;
+ double mb, umb;
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
PM_SYNCPKG *sync = alpm_list_getdata(lp);
PM_PKG *pkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
char *pkgname, *pkgver;
- if((int)alpm_sync_getinfo(sync, PM_SYNC_TYPE) == PM_SYNC_TYPE_REPLACE) {
+ if((long)alpm_sync_getinfo(sync, PM_SYNC_TYPE) == PM_SYNC_TYPE_REPLACE) {
PM_LIST *j, *data;
data = alpm_sync_getinfo(sync, PM_SYNC_DATA);
for(j = alpm_list_first(data); j; j = alpm_list_next(j)) {
@@ -584,7 +594,8 @@ int pacman_sync(list_t *targets)
pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
- totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
+ totalsize += (long)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);
+ totalusize += (long)alpm_pkg_getinfo(pkg, PM_PKG_USIZE);
asprintf(&str, "%s-%s", pkgname, pkgver);
list_install = list_add(list_install, str);
@@ -598,14 +609,19 @@ int pacman_sync(list_t *targets)
FREE(str);
}
mb = (double)(totalsize / 1048576.0);
+ umb = (double)(totalusize / 1048576.0);
/* round up to 0.1 */
if(mb < 0.1) {
mb = 0.1;
}
+ if(umb < 0.1) {
+ umb = 0.1;
+ }
MSG(NL, _("\nTargets: "));
str = buildstring(list_install);
indentprint(str, 9);
MSG(NL, _("\nTotal Package Size: %.1f MB\n"), mb);
+ MSG(NL, _("\nTotal Uncompressed Package Size: %.1f MB\n"), umb);
FREELIST(list_install);
FREE(str);
@@ -636,109 +652,6 @@ int pacman_sync(list_t *targets)
}
}
- /* group sync records by repository and download */
- alpm_get_option(PM_OPT_ROOT, (long *)&root);
- alpm_get_option(PM_OPT_CACHEDIR, (long *)&cachedir);
- snprintf(ldir, PATH_MAX, "%s%s", root, cachedir);
-
- for(i = pmc_syncs; i; i = i->next) {
- sync_t *current = i->data;
-
- for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
- PM_SYNCPKG *sync = alpm_list_getdata(lp);
- PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
- PM_DB *dbs = alpm_pkg_getinfo(spkg, PM_PKG_DATA);
-
- if(current->db == dbs) {
- char path[PATH_MAX];
- char *pkgname, *pkgver;
-
- pkgname = alpm_pkg_getinfo(spkg, PM_PKG_NAME);
- pkgver = alpm_pkg_getinfo(spkg, PM_PKG_VERSION);
-
- if(config->op_s_printuris) {
- server_t *server = (server_t*)current->servers->data;
- snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver);
- if(!strcmp(server->protocol, "file")) {
- MSG(NL, "%s://%s%s\n", server->protocol, server->path, path);
- } else {
- MSG(NL, "%s://%s%s%s\n", server->protocol,
- server->server, server->path, path);
- }
- } else {
- struct stat buf;
- snprintf(path, PATH_MAX, "%s/%s-%s" PM_EXT_PKG, ldir, pkgname, pkgver);
- if(stat(path, &buf)) {
- /* file is not in the cache dir, so add it to the list */
- snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver);
- files = list_add(files, strdup(path));
- } else {
- vprint(_(" %s-%s" PM_EXT_PKG " is already in the cache\n"), pkgname, pkgver);
- }
- }
- }
- }
-
- if(files) {
- struct stat buf;
- MSG(NL, _("\n:: Retrieving packages from %s...\n"), current->treename);
- fflush(stdout);
- if(stat(ldir, &buf)) {
- /* no cache directory.... try creating it */
- WARN(NL, _("no %s cache exists. creating...\n"), ldir);
- alpm_logaction(_("warning: no %s cache exists. creating..."), ldir);
- if(makepath(ldir)) {
- /* couldn't mkdir the cache directory, so fall back to /tmp and unlink
- * the package afterwards.
- */
- WARN(NL, _("couldn't create package cache, using /tmp instead"));
- alpm_logaction(_("warning: couldn't create package cache, using /tmp instead"));
- snprintf(ldir, PATH_MAX, "/tmp");
- if(alpm_set_option(PM_OPT_CACHEDIR, (long)ldir) == -1) {
- ERR(NL, _("failed to set option CACHEDIR (%s)\n"), alpm_strerror(pm_errno));
- goto cleanup;
- }
- varcache = 0;
- }
- }
- if(downloadfiles(current->servers, ldir, files)) {
- ERR(NL, _("failed to retrieve some files from %s\n"), current->treename);
- retval = 1;
- goto cleanup;
- }
- FREELIST(files);
- }
- }
- if(config->op_s_printuris) {
- goto cleanup;
- }
- MSG(NL, "\n");
-
- /* Check integrity of files */
- MSG(NL, _("checking package integrity... "));
-
- for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
- PM_SYNCPKG *sync = alpm_list_getdata(lp);
- PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
- if(alpm_pkg_checkmd5sum(spkg) == -1) {
- if(pm_errno == PM_ERR_PKG_INVALID) {
- ERR(NL, _("archive %s is corrupted\n"), alpm_pkg_getinfo(spkg, PM_PKG_NAME));
- } else {
- ERR(NL, _("could not get checksum for package %s (%s)\n"),
- alpm_pkg_getinfo(spkg, PM_PKG_NAME), alpm_strerror(pm_errno));
- }
- retval = 1;
- }
- }
- if(retval) {
- goto cleanup;
- }
- MSG(CL, _("done.\n"));
-
- if(config->op_s_downloadonly) {
- goto cleanup;
- }
-
/* Step 3: actually perform the installation
*/
if(alpm_trans_commit(&data) == -1) {
@@ -747,16 +660,18 @@ int pacman_sync(list_t *targets)
case PM_ERR_FILE_CONFLICTS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_CONFLICT *conflict = alpm_list_getdata(lp);
- switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
+ switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET:
- MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
+ MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
+ config->root,
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break;
case PM_CONFLICT_TYPE_FILE:
- MSG(NL, _("%s: %s exists in filesystem"),
+ MSG(NL, _("%s: %s%s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
+ config->root,
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break;
}
@@ -764,6 +679,13 @@ int pacman_sync(list_t *targets)
alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
+ case PM_ERR_PKG_CORRUPTED:
+ for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
+ MSG(NL, "%s", (char*)alpm_list_getdata(lp));
+ }
+ alpm_list_free(data);
+ MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
+ break;
default:
break;
}
@@ -771,13 +693,6 @@ int pacman_sync(list_t *targets)
goto cleanup;
}
- if(!varcache && !config->op_s_downloadonly) {
- /* delete packages */
- for(i = files; i; i = i->next) {
- unlink(i->data);
- }
- }
-
/* Step 4: release transaction resources
*/
cleanup:
diff --git a/src/pacman/sync.h b/src/pacman/sync.h
index aab56665..0452f1c2 100644
--- a/src/pacman/sync.h
+++ b/src/pacman/sync.h
@@ -25,7 +25,6 @@
typedef struct __sync_t {
char *treename;
PM_DB *db;
- list_t *servers; /* List of server_t */
} sync_t;
int pacman_sync(list_t *targets);
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index 279d431a..2f770cf0 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
+#include <math.h>
#include <libintl.h>
#include <alpm.h>
@@ -39,63 +40,123 @@
#define LOG_STR_LEN 256
extern config_t *config;
+extern unsigned int maxcols;
+
+int prevpercent=0; /* for less progressbar output */
/* Callback to handle transaction events
*/
void cb_trans_evt(unsigned char event, void *data1, void *data2)
{
char str[LOG_STR_LEN] = "";
+ char out[PATH_MAX];
+ int i;
switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START:
- MSG(NL, _("checking dependencies... "));
+ pm_fprintf(stderr, NL, _("checking dependencies... "));
break;
case PM_TRANS_EVT_FILECONFLICTS_START:
- MSG(NL, _("checking for file conflicts... "));
+ pm_fprintf(stderr, NL, _("checking for file conflicts... "));
break;
case PM_TRANS_EVT_RESOLVEDEPS_START:
- MSG(NL, _("resolving dependencies... "));
+ pm_fprintf(stderr, NL, _("resolving dependencies... "));
break;
case PM_TRANS_EVT_INTERCONFLICTS_START:
- MSG(NL, _("looking for inter-conflicts... "));
+ pm_fprintf(stderr, NL, _("looking for inter-conflicts... "));
break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
case PM_TRANS_EVT_FILECONFLICTS_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE:
case PM_TRANS_EVT_INTERCONFLICTS_DONE:
- MSG(CL, _("done.\n"));
+ pm_fprintf(stderr, CL, _("done.\n"));
+ break;
+ case PM_TRANS_EVT_EXTRACT_DONE:
+ if(!config->noprogressbar) {
+ MSG(NL, "");
+ }
break;
case PM_TRANS_EVT_ADD_START:
- MSG(NL, _("installing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ if(config->noprogressbar) {
+ MSG(NL, _("installing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ }
break;
case PM_TRANS_EVT_ADD_DONE:
- MSG(CL, _("done.\n"));
+ if(config->noprogressbar) {
+ MSG(CL, _("done.\n"));
+ }
snprintf(str, LOG_STR_LEN, _("installed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str);
break;
case PM_TRANS_EVT_REMOVE_START:
+ if(config->noprogressbar) {
MSG(NL, _("removing %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ }
break;
case PM_TRANS_EVT_REMOVE_DONE:
- MSG(CL, _("done.\n"));
+ if(config->noprogressbar) {
+ MSG(CL, _("done.\n"));
+ } else {
+ MSG(NL, "");
+ }
snprintf(str, LOG_STR_LEN, _("removed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str);
break;
case PM_TRANS_EVT_UPGRADE_START:
- MSG(NL, _("upgrading %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ if(config->noprogressbar) {
+ MSG(NL, _("upgrading %s... "), (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ }
break;
case PM_TRANS_EVT_UPGRADE_DONE:
- MSG(CL, _("done.\n"));
+ if(config->noprogressbar) {
+ MSG(CL, _("done.\n"));
+ }
snprintf(str, LOG_STR_LEN, _("upgraded %s (%s -> %s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(data2, PM_PKG_VERSION),
(char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION));
alpm_logaction(str);
break;
+ case PM_TRANS_EVT_INTEGRITY_START:
+ MSG(NL, _("checking package integrity... "));
+ break;
+ case PM_TRANS_EVT_INTEGRITY_DONE:
+ MSG(CL, _("done.\n"));
+ break;
+ case PM_TRANS_EVT_SCRIPTLET_INFO:
+ MSG(NL, "%s\n", (char*)data1);
+ break;
+ case PM_TRANS_EVT_SCRIPTLET_START:
+ MSG(NL, (char*)data1);
+ MSG(CL, "...");
+ break;
+ case PM_TRANS_EVT_SCRIPTLET_DONE:
+ if(!(long)data1) {
+ MSG(CL, _(" done.\n"));
+ } else {
+ MSG(CL, _(" failed.\n"));
+ }
+ break;
+ case PM_TRANS_EVT_PRINTURI:
+ MSG(NL, "%s%s\n", (char*)data1, (char*)data2);
+ break;
+ case PM_TRANS_EVT_RETRIEVE_START:
+ MSG(NL, _("\n:: Retrieving packages from %s...\n"), (char*)data1);
+ fflush(stdout);
+ break;
+ case PM_TRANS_EVT_RETRIEVE_LOCAL:
+ MSG(NL, " %s [", (char*)data1);
+ STRNCPY(out, (char*)data2, maxcols-42);
+ MSG(CL, "%s", out);
+ for(i = strlen(out); i < maxcols-43; i++) {
+ MSG(CL, " ");
+ }
+ fputs(_("] 100% LOCAL "), stdout);
+ break;
}
}
@@ -105,46 +166,176 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
switch(event) {
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
- 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(data2, PM_PKG_NAME));
- *response = yesno(str);
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_INSTALL_IGNOREPKG) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
+ } else {
+ 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(data2, PM_PKG_NAME));
+ *response = yesno(str);
+ }
+ break;
+ case PM_TRANS_CONV_REMOVE_HOLDPKG:
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_REMOVE_HOLDPKG) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
+ } else {
+ snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
+ (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME));
+ *response = yesno(str);
+ }
break;
case PM_TRANS_CONV_REPLACE_PKG:
- snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
- (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
- (char *)data3,
- (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
- *response = yesno(str);
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_REPLACE_PKG) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
+ } else {
+ snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
+ (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
+ (char *)data3,
+ (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME));
+ *response = yesno(str);
+ }
break;
case PM_TRANS_CONV_CONFLICT_PKG:
- snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
- (char *)data1,
- (char *)data2,
- (char *)data2);
- *response = yesno(str);
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_CONFLICT_PKG) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
+ } else {
+ snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
+ (char *)data1,
+ (char *)data2,
+ (char *)data2);
+ *response = yesno(str);
+ }
break;
case PM_TRANS_CONV_LOCAL_NEWER:
- if(!config->op_s_downloadonly) {
- snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_LOCAL_NEWER) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
+ } else {
+ if(!config->op_s_downloadonly) {
+ 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_VERSION));
- *response = yesno(str);
- } else {
- *response = 1;
+ *response = yesno(str);
+ } else {
+ *response = 1;
+ }
}
break;
case PM_TRANS_CONV_LOCAL_UPTODATE:
- if(!config->op_s_downloadonly) {
- snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_LOCAL_UPTODATE) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
+ } else {
+ if(!config->op_s_downloadonly) {
+ 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_VERSION));
- *response = yesno(str);
+ *response = yesno(str);
+ } else {
+ *response = 1;
+ }
+ }
+ break;
+ case PM_TRANS_CONV_CORRUPTED_PKG:
+ if(config->noask) {
+ if(config->ask & PM_TRANS_CONV_CORRUPTED_PKG) {
+ *response = 1;
+ } else {
+ *response = 0;
+ }
} else {
- *response = 1;
+ if(!config->noconfirm) {
+ snprintf(str, LOG_STR_LEN, _(":: Archive %s is corrupted. Do you want to delete it? [Y/n] "),
+ (char *)data1);
+ *response = yesno(str);
+ } else {
+ *response = 1;
+ }
}
break;
}
}
+void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain)
+{
+ int i, hash;
+ unsigned int maxpkglen, progresslen = maxcols - 57;
+ char *addstr, *upgstr, *removestr, *ptr;
+ addstr = strdup(_("installing"));
+ upgstr = strdup(_("upgrading"));
+ removestr = strdup(_("removing"));
+
+ if(config->noprogressbar) {
+ return;
+ }
+
+ if (!pkgname)
+ return;
+ if (percent > 100)
+ return;
+ if(percent == prevpercent)
+ return;
+
+ prevpercent=percent;
+ switch (event) {
+ case PM_TRANS_PROGRESS_ADD_START:
+ ptr = addstr;
+ break;
+
+ case PM_TRANS_PROGRESS_UPGRADE_START:
+ ptr = upgstr;
+ break;
+ case PM_TRANS_PROGRESS_REMOVE_START:
+ ptr = removestr;
+ break;
+ }
+ hash=percent*progresslen/100;
+
+ // if the package name is too long, then slice the ending
+ maxpkglen=46-strlen(ptr)-(3+2*(int)log10(howmany));
+ if(strlen(pkgname)>maxpkglen)
+ pkgname[maxpkglen]='\0';
+
+ putchar('(');
+ for(i=0;i<(int)log10(howmany)-(int)log10(remain);i++)
+ putchar(' ');
+ printf("%d/%d) %s %s ", remain, howmany, ptr, pkgname);
+ if (strlen(pkgname)<maxpkglen)
+ for (i=maxpkglen-strlen(pkgname)-1; i>0; i--)
+ putchar(' ');
+ printf("[");
+ for (i = progresslen; i > 0; i--) {
+ if (i >= progresslen - hash)
+ printf("#");
+ else
+ printf("-");
+ }
+ MSG(CL, "] %3d%%\r", percent);
+ FREE(addstr);
+ FREE(upgstr);
+ FREE(removestr);
+}
+
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/trans.h b/src/pacman/trans.h
index e27d4322..baed0d1e 100644
--- a/src/pacman/trans.h
+++ b/src/pacman/trans.h
@@ -27,6 +27,8 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2);
/* callback to handle questions from pacman transactions (yes/no) */
void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, int *response);
+void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain);
+
#endif /* _PM_TRANS_H */
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/util.c b/src/pacman/util.c
index aefdea9b..8dd0f11d 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -19,6 +19,11 @@
* USA.
*/
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#include <sys/stat.h>
+#endif
+
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
@@ -29,7 +34,6 @@
#include <ctype.h>
#include <dirent.h>
#include <unistd.h>
-#include <regex.h>
#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
@@ -43,6 +47,7 @@
extern int maxcols;
extern config_t *config;
+extern int neednl;
/* does the same thing as 'mkdir -p' */
int makepath(char *path)
@@ -216,19 +221,4 @@ char *strtrim(char *str)
return str;
}
-/* match a string against a regular expression */
-int reg_match(char *string, char *pattern)
-{
- int result;
- regex_t reg;
-
- if(regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) {
- ERR(NL, _("%s is not a valid regular expression.\n"), pattern);
- return(-1);
- }
- result = regexec(&reg, string, 0, 0, 0);
- regfree(&reg);
- return(!(result));
-}
-
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/util.h b/src/pacman/util.h
index 51e05fd3..2eab6c79 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -27,7 +27,7 @@
if((b) > 0) { \
p = malloc(b); \
if (!(p)) { \
- fprintf(stderr, "malloc failure: could not allocate %d bytes\n", b); \
+ fprintf(stderr, "malloc failure: could not allocate %d bytes\n", (int)b); \
exit(1); \
} \
} else { \