[pacman-dev] [PATCH] src/pacman/sync.c : cleanup of pacman_sync
From 4cc1e73f8fcc5920fd2880b8d6fcb8ce6f9841cb Mon Sep 17 00:00:00 2001 From: Xavier Chantry
Date: Wed, 28 May 2008 22:55:03 +0200 Subject: [PATCH] src/pacman/sync.c : cleanup of pacman_sync
By putting the search / group / info / list operations just after the -Sy
op, we can simplify several checks :
1) the check for "missing targets". Since we took care of the above
operations, we now have less cases to consider :
* -Sy : we can end now (this is actually a bugfix)
* -Su : we can proceed
* -S : this op requires targets, so exit with an error
2) the check to see if a transaction is needed. If we arrive at the end of
the function, it is either because we have -Su or -S <targets> so we already
know a transaction is needed there.
Signed-off-by: Xavier Chantry
@@ -861,7 +823,43 @@ int pacman_sync(alpm_list_t *targets) return(sync_list(sync_dbs, targets)); }
- return(0); + if(targets == NULL) { + if(config->op_s_sync) { + return(0);
I may overlook something, but won't this break -Syu?
+ } else if(config->op_s_upgrade) { + /* proceed */ + } else { + /* don't proceed here unless we have an operation that doesn't require a + * target list */ + pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + return(1); + } + }
Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
2008/6/2 Nagy Gabor
@@ -861,7 +823,43 @@ int pacman_sync(alpm_list_t *targets) return(sync_list(sync_dbs, targets)); }
- return(0); + if(targets == NULL) { + if(config->op_s_sync) { + return(0);
I may overlook something, but won't this break -Syu?
Oops, you are right, good catch. I probably got confused because op_s_sync used to get resetted after doing the -y operation, but I removed that part : - config->op_s_sync = 0; So now, I could probably just invert the order of these two checks : do s_upgrade check first, then s_sync. Does that sound alright?
+ } else if(config->op_s_upgrade) { + /* proceed */ + } else { + /* don't proceed here unless we have an operation that doesn't require a + * target list */ + pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + return(1); + } + }
2008/6/2 Nagy Gabor
: @@ -861,7 +823,43 @@ int pacman_sync(alpm_list_t *targets) return(sync_list(sync_dbs, targets)); }
- return(0); + if(targets == NULL) { + if(config->op_s_sync) { + return(0);
I may overlook something, but won't this break -Syu?
Oops, you are right, good catch. I probably got confused because op_s_sync used to get resetted after doing the -y operation, but I removed that part : - config->op_s_sync = 0;
So now, I could probably just invert the order of these two checks : do s_upgrade check first, then s_sync. Does that sound alright?
Yes. Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
participants (2)
-
Nagy Gabor
-
Xavier