[pacman-dev] [PATCH] Corrected return codes for Sg flag
awhetter.2011 at my.bristol.ac.uk
awhetter.2011 at my.bristol.ac.uk
Fri Jul 12 11:56:32 EDT 2013
From: Ashley Whetter <awhetter.2011 at my.bristol.ac.uk>
Non-zero is now returned if a group is searched for that doesn't exist
Signed-off-by: Ashley Whetter <awhetter.2011 at my.bristol.ac.uk>
---
src/pacman/sync.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index fc1314b..35a5c59 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -367,6 +367,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
{
alpm_list_t *i, *j, *k, *s = NULL;
+ int found_group = 0, found_all = 1;
if(targets) {
for(i = targets; i; i = alpm_list_next(i)) {
@@ -376,6 +377,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
alpm_group_t *grp = alpm_db_get_group(db, grpname);
if(grp) {
+ found_group++;
/* get names of packages in group */
for(k = grp->packages; k; k = alpm_list_next(k)) {
if(!config->quiet) {
@@ -387,6 +389,11 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
}
}
}
+
+ if (!found_group) {
+ found_all = 0;
+ }
+ found_group = 0;
}
} else {
for(i = syncs; i; i = alpm_list_next(i)) {
@@ -394,6 +401,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) {
alpm_group_t *grp = j->data;
+ found_all = 1;
if(level > 1) {
for(k = grp->packages; k; k = alpm_list_next(k)) {
@@ -412,7 +420,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
alpm_list_free(s);
}
- return 0;
+ return !found_all;
}
static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
--
1.8.3.2
More information about the pacman-dev
mailing list