FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-06-2011, 12:41 PM
Allan McRae
 
Default Remove incorrect output when downloading only

When only downloading a package, pacman can produce some incorrect
output. This is compounded when the package is in IgnorePkg. e.g.

> pacman -Sddw nvidia-utils
:: nvidia-utils is in IgnorePkg/IgnoreGroup. Install anyway? [Y/n] y
warning: nvidia-utils-270.41.19-1 is up to date -- reinstalling

These two lines are now silenced when using -Sw.

Signed-off-by: Allan McRae <allan@archlinux.org>
---
lib/libalpm/add.c | 6 ++++--
lib/libalpm/deps.c | 17 +++++++++++++----
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ee56e87..ceafb3e 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -87,8 +87,10 @@ int SYMEXPORT alpm_add_pkg(pmpkg_t *pkg)
localpkgname, localpkgver);
return 0;
} else {
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling
"),
- localpkgname, localpkgver);
+ if(!(trans->flags & PM_TRANS_FLAG_DOWNLOADONLY)) {
+ _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling
"),
+ localpkgname, localpkgver);
+ }
}
} else if(cmp < 0) {
/* local version is newer */
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index c5fb92e..b03cd48 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -570,8 +570,12 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
if(_alpm_pkg_should_ignore(pkg)) {
int install = 0;
if(prompt) {
- QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
- NULL, NULL, &install);
+ if(handle->trans->flags & PM_TRANS_FLAG_DOWNLOADONLY) {
+ install = 1;
+ } else {
+ QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
+ NULL, NULL, &install);
+ }
} else {
_alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
}
@@ -592,8 +596,13 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
if(_alpm_pkg_should_ignore(pkg)) {
int install = 0;
if(prompt) {
- QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
- pkg, NULL, NULL, &install);
+
+ if(handle->trans->flags & PM_TRANS_FLAG_DOWNLOADONLY) {
+ install = 1;
+ } else {
+ QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
+ NULL, NULL, &install);
+ }
} else {
_alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
}
--
1.7.5.4
 
Old 06-06-2011, 01:45 PM
Xavier
 
Default Remove incorrect output when downloading only

Allan McRae wrote:
> diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
> index c5fb92e..b03cd48 100644
> --- a/lib/libalpm/deps.c
> +++ b/lib/libalpm/deps.c
> @@ -570,8 +570,12 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
> if(_alpm_pkg_should_ignore(pkg)) {
> int install = 0;
> if(prompt) {
> - QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
> - NULL, NULL, &install);
> + if(handle->trans->flags & PM_TRANS_FLAG_DOWNLOADONLY) {
> + install = 1;
> + } else {
> + QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
> + NULL, NULL, &install);
> + }
> } else {
> _alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
> }
> @@ -592,8 +596,13 @@ static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
> if(_alpm_pkg_should_ignore(pkg)) {
> int install = 0;
> if(prompt) {
> - QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
> - pkg, NULL, NULL, &install);
> +
> + if(handle->trans->flags & PM_TRANS_FLAG_DOWNLOADONLY) {
> + install = 1;
> + } else {
> + QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
> + NULL, NULL, &install);
> + }
> } else {
> _alpm_log(PM_LOG_WARNING, _("ignoring package %s-%s
"), pkg->name, pkg->version);
> }
> --
> 1.7.5.4
>
>

Patch looks fine to me but some minor comments :

1) just a matter of taste, I would reduce the number of levels with
if (prompt && download)
install = 1
else if prompt
...
else
...

2) can we have downloadonly and prompt=0 ? do we want to print the warning in
that case ?

3) that patch highlights that these 2 blocks are completely identical and could
maybe be factored like that :
if (install_ignorepkg(pkg))
install = 1
else
ignored = 1
continue
 

Thread Tools




All times are GMT. The time now is 01:56 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org