[pacman-dev] [PATCH v3] pacman: don't error when a group exists but all packages are ignored
morganamilo
morganamilo at gmail.com
Sat Oct 20 13:58:52 UTC 2018
Currently when attempting to sync a group where all packages are
ignored, either by ignorepkg, ignoregroup or --needed, pacman
will error with "target not found".
Instead, if a group has no packages check if the group exists
before throwing an error.
Signed-off-by: morganamilo <morganamilo at gmail.com>
---
v2: Move to frontend + fix formatting.
v3: Strip alpm_ prefix
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index ef8faedf..57677a42 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -535,6 +535,20 @@ static int process_pkg(alpm_pkg_t *pkg)
return 0;
}
+static int group_exists(alpm_list_t *dbs, const char *name)
+{
+ alpm_list_t *i;
+ for(i = dbs; i; i = i->next) {
+ alpm_db_t *db = i->data;
+
+ if(alpm_db_get_group(db, name)) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static int process_group(alpm_list_t *dbs, const char *group, int error)
{
int ret = 0;
@@ -543,6 +557,10 @@ static int process_group(alpm_list_t *dbs, const char *group, int error)
int count = alpm_list_count(pkgs);
if(!count) {
+ if(group_exists(dbs, group)) {
+ return 0;
+ }
+
pm_printf(ALPM_LOG_ERROR, _("target not found: %s\n"), group);
return 1;
}
--
2.19.1
More information about the pacman-dev
mailing list