Merge branch 'maint'

Conflicts:
	src/pacman/callback.c
This commit is contained in:
Dan McGee 2011-06-02 17:33:56 -05:00
commit 9d73b261cf
6 changed files with 32 additions and 23 deletions

7
NEWS
View File

@ -1,5 +1,12 @@
VERSION DESCRIPTION
-----------------------------------------------------------------------------
3.5.3 - segfault when creating lock in non-existent dir (FS#24292)
- segfault when uninstalling broken backed-up symlink (FS#24230)
- --print should not enable --noconfirm (FS#24287)
- fix default path substitution in documentation
- makepkg: quote variables that may contain spaces (FS#24002)
- repo-add: include dotfiles in filelists (FS#24534)
- minor translation updates: de, fi, sk
3.5.2 - ensure we show correct missing dependency info (FS#23424)
- pacman usage/--help updates (FS#23433, FS#23369)
- ensure stdout/stderr are flushed before prompts (FS#23492)

View File

@ -42,12 +42,12 @@ AC_PREREQ(2.62)
# pacman_version_micro += 1
m4_define([lib_current], [6])
m4_define([lib_revision], [2])
m4_define([lib_revision], [3])
m4_define([lib_age], [0])
m4_define([pacman_version_major], [3])
m4_define([pacman_version_minor], [5])
m4_define([pacman_version_micro], [2])
m4_define([pacman_version_micro], [3])
m4_define([pacman_version],
[pacman_version_major.pacman_version_minor.pacman_version_micro])

View File

@ -361,7 +361,7 @@ db_write_entry()
msg2 "$(gettext "Creating '%s' db entry...")" 'files'
local files_path="$tmpdir/$pkgname-$pkgver/files"
echo "%FILES%" >$files_path
bsdtar --exclude='.*' -tf "$pkgfile" >>$files_path
bsdtar --exclude='^.*' -tf "$pkgfile" >>$files_path
fi
# create a delta file

View File

@ -351,7 +351,9 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
int len, wclen, wcwid, padwid;
wchar_t *wcstr;
if(config->noprogressbar) {
const int cols = getcols(0);
if(config->noprogressbar || cols == 0) {
return;
}
@ -397,7 +399,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
return;
}
infolen = getcols() * 6 / 10;
infolen = cols * 6 / 10;
if(infolen < 50) {
infolen = 50;
}
@ -454,7 +456,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
free(wcstr);
/* call refactored fill progress function */
fill_progress(percent, percent, getcols() - infolen);
fill_progress(percent, percent, cols - infolen);
if(percent == 100) {
alpm_list_t *i = NULL;
@ -498,7 +500,9 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
const char *rate_label, *xfered_label;
int file_percent = 0, total_percent = 0;
if(config->noprogressbar || file_total == -1) {
const int cols = getcols(0);
if(config->noprogressbar || cols == 0 || file_total == -1) {
if(file_xfered == 0) {
printf(_("downloading %s...\n"), filename);
fflush(stdout);
@ -506,7 +510,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
return;
}
infolen = getcols() * 6 / 10;
infolen = cols * 6 / 10;
if(infolen < 50) {
infolen = 50;
}
@ -639,9 +643,9 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
free(wcfname);
if(totaldownload) {
fill_progress(file_percent, total_percent, getcols() - infolen);
fill_progress(file_percent, total_percent, cols - infolen);
} else {
fill_progress(file_percent, file_percent, getcols() - infolen);
fill_progress(file_percent, file_percent, cols - infolen);
}
return;
}

View File

@ -115,7 +115,7 @@ static int flush_term_input(void) {
}
/* gets the current screen column width */
int getcols(void)
int getcols(int def)
{
#ifdef TIOCGSIZE
struct ttysize win;
@ -128,7 +128,7 @@ int getcols(void)
return win.ws_col;
}
#endif
return 0;
return def;
}
/* does the same thing as 'rm -rf' */
@ -223,14 +223,13 @@ void indentprint(const char *str, int indent)
{
wchar_t *wcstr;
const wchar_t *p;
int len, cidx, cols;
int len, cidx;
const int cols = getcols(0);
if(!str) {
return;
}
cols = getcols();
/* if we're not a tty, print without indenting */
if(cols == 0) {
printf("%s", str);
@ -439,8 +438,6 @@ static int string_length(const char *s)
void string_display(const char *title, const char *string)
{
int len = 0;
if(title) {
printf("%s ", title);
}
@ -448,7 +445,7 @@ void string_display(const char *title, const char *string)
printf(_("None"));
} else {
/* compute the length of title + a space */
len = string_length(title) + 1;
int len = string_length(title) + 1;
indentprint(string, len);
}
printf("\n");
@ -516,7 +513,7 @@ static alpm_list_t *table_create_format(const alpm_list_t *header,
alpm_list_free(longest_strs);
/* return NULL if terminal is not wide enough */
if(totalwidth > getcols()) {
if(totalwidth > getcols(80)) {
fprintf(stderr, _("insufficient columns available for table display\n"));
FREELIST(formats);
return(NULL);
@ -568,7 +565,7 @@ int table_display(const char *title, const alpm_list_t *header,
void list_display(const char *title, const alpm_list_t *list)
{
const alpm_list_t *i;
int cols, len = 0;
int len = 0;
if(title) {
len = string_length(title) + 1;
@ -578,11 +575,12 @@ void list_display(const char *title, const alpm_list_t *list)
if(!list) {
printf("%s\n", _("None"));
} else {
int cols;
const int maxcols = getcols(80);
for(i = list, cols = len; i; i = alpm_list_next(i)) {
char *str = alpm_list_getdata(i);
int s = string_length(str);
int maxcols = getcols();
if(maxcols > 0 && (cols + s + 2) >= maxcols) {
if(cols + s + 2 >= maxcols) {
int j;
cols = len;
printf("\n");

View File

@ -42,7 +42,7 @@
int trans_init(pmtransflag_t flags);
int trans_release(void);
int needs_root(void);
int getcols(void);
int getcols(int def);
int rmrf(const char *path);
const char *mbasename(const char *path);
char *mdirname(const char *path);