[pacman-dev] [PATCH] Treat -Sc like an option
From 2ffe8c06f1fdadfa2f9ccd38a706568f261f3f6c Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Sat, 8 Mar 2008 17:58:15 +0100 Subject: [PATCH] Treat -Sc like an option From now on 'pacman -Sc target' will first clean the cache, then install target... Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> --- src/pacman/sync.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 130d356..1355cd8 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -773,7 +773,9 @@ int pacman_sync(alpm_list_t *targets) ret++; } - return(ret); + if(ret) { + return(ret); + } } /* ensure we have at least one valid sync db set up */ -- 1.5.3.8
On Sat, Mar 8, 2008 at 11:59 AM, Nagy Gabor <ngaba@bibl.u-szeged.hu> wrote:
From 2ffe8c06f1fdadfa2f9ccd38a706568f261f3f6c Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Sat, 8 Mar 2008 17:58:15 +0100 Subject: [PATCH] Treat -Sc like an option
From now on 'pacman -Sc target' will first clean the cache, then install target...
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> --- src/pacman/sync.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 130d356..1355cd8 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -773,7 +773,9 @@ int pacman_sync(alpm_list_t *targets) ret++; }
- return(ret); + if(ret) { + return(ret); + } }
/* ensure we have at least one valid sync db set up */
This seems sane, I'm just not sure how useful (or expected) this behavior would be. Can you give a use case? -Dan
On Mon, Mar 10, 2008 at 6:29 PM, Dan McGee <dpmcgee@gmail.com> wrote:
From now on 'pacman -Sc target' will first clean the cache, then install target...
This seems sane, I'm just not sure how useful (or expected) this behavior would be. Can you give a use case?
I actually think this could cause confusion. A user could very well think that pacman is going to clean only the target package. Scott
On Mon, Mar 10, 2008 at 6:29 PM, Dan McGee <dpmcgee@gmail.com> wrote:
From now on 'pacman -Sc target' will first clean the cache, then install target...
This seems sane, I'm just not sure how useful (or expected) this behavior would be. Can you give a use case?
I actually think this could cause confusion. A user could very well think that pacman is going to clean only the target package.
Scott
To be honest, the main reason for this patch was to clean needs_transaction() and needs_root() check. See: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011382.html However, this wasn't just selfish: * the current code also can be fooled easily: -Sc needs root and clean cache -Scg DOESN'T need root and [tries to] clean cache only * We have no clear definition what will happen on pacman -Syucg foo (*)[this is a syntactically correct command-line now], so imho this patch doesn't hurt anything: users still should use 'pacman -Sc' "alone", but power-users can use it in combination with -Su to clean-up cache (to get some disk space) and THEN do a sysupgrade. * answer to your fear: this won't be mentioned in manual and see (*): these command-lines are already allowed with undefined result. Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
On Tue, Mar 11, 2008 at 01:41:45PM +0100, Nagy Gabor wrote:
imho this patch doesn't hurt anything: users still should use 'pacman -Sc' "alone", but power-users can use it in combination with -Su to clean-up cache (to get some disk space) and THEN do a sysupgrade. * answer to your fear: this won't be mentioned in manual and see (*): these command-lines are already allowed with undefined result.
That is more or less what I said to Dan yesterday, so I am fine with this patch for these reasons.
2008/3/11 Nagy Gabor <ngaba@bibl.u-szeged.hu>:
On Mon, Mar 10, 2008 at 6:29 PM, Dan McGee <dpmcgee@gmail.com> wrote:
From now on 'pacman -Sc target' will first clean the cache, then install target...
This seems sane, I'm just not sure how useful (or expected) this behavior would be. Can you give a use case?
I actually think this could cause confusion. A user could very well think that pacman is going to clean only the target package.
Scott
To be honest, the main reason for this patch was to clean needs_transaction() and needs_root() check. See: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011382.html However, this wasn't just selfish: * the current code also can be fooled easily: -Sc needs root and clean cache -Scg DOESN'T need root and [tries to] clean cache only * We have no clear definition what will happen on pacman -Syucg foo (*)[this is a syntactically correct command-line now], so imho this patch doesn't hurt anything: users still should use 'pacman -Sc' "alone", but power-users can use it in combination with -Su to clean-up cache (to get some disk space) and THEN do a sysupgrade. * answer to your fear: this won't be mentioned in manual and see (*): these command-lines are already allowed with undefined result.
Well perhaps we should address the real problem then and find a better way to allow/disallow options in combination with each other? It scares me more to say "oh, the behavior is weird, so we aren't going to even put it in the manpage". -Dan
Well perhaps we should address the real problem then and find a better way to allow/disallow options in combination with each other?
It scares me more to say "oh, the behavior is weird, so we aren't going to even put it in the manpage".
Well, imho much less weird, than the current behavior. Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
On Mon, Mar 10, 2008 at 9:28 PM, Scott Horowitz <stonecrest@gmail.com> wrote:
I actually think this could cause confusion. A user could very well think that pacman is going to clean only the target package.
I agree with Scott here. If someone were to tell me that "pacman -Sc foobar" worked, I would assume it'd clean up old versions of foobar, not clean the cache and sync foobar.
On Mon, Mar 10, 2008 at 9:28 PM, Scott Horowitz <stonecrest@gmail.com> wrote:
I actually think this could cause confusion. A user could very well think that pacman is going to clean only the target package.
I agree with Scott here. If someone were to tell me that "pacman -Sc foobar" worked, I would assume it'd clean up old versions of foobar, not clean the cache and sync foobar.
I just repeat myself: Currently this works, and cleans the whole cache and stops. Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
2008/3/12 Nagy Gabor <ngaba@bibl.u-szeged.hu>:
On Mon, Mar 10, 2008 at 9:28 PM, Scott Horowitz <stonecrest@gmail.com> wrote:
I actually think this could cause confusion. A user could very well think that pacman is going to clean only the target package.
I agree with Scott here. If someone were to tell me that "pacman -Sc foobar" worked, I would assume it'd clean up old versions of foobar, not clean the cache and sync foobar.
I just repeat myself: Currently this works, and cleans the whole cache and stops.
Well then I'll repeat myself- we should fix the options parsing. -Dan
participants (5)
-
Aaron Griffin
-
Dan McGee
-
Nagy Gabor
-
Scott Horowitz
-
Xavier