From fd8969f67875ad6854725165b9530f4be26c5d96 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Tue, 8 Jul 2008 10:07:05 +0200 Subject: sync_addtarget rework Now '-S provision' handling is done in the back-end. In case of multiple providers, the first one is selected (behavior change: deleted provision002.py). The old processing order was: literal, group, provision; the new one: literal, provision, group. This is more rational, but "pacman -S group" will be slower now. "pacman -S repo/provision" also works. Provision was generalized to dependencies, so you can resolve deps by hand: "pacman -S 'bash>2.0'" or "pacman -S 'core/bash>2.0'" etc. This can be useful in makepkg dependency resolving. The changes were documented in pacman manual. alpm_find_pkg_satisfiers and _alpm_find_dep_satisfiers functions were removed, since they are no longer needed. I added some verbosity to "select provider instead of literal" and "fallback to group". Signed-off-by: Nagy Gabor Signed-off-by: Dan McGee --- src/pacman/sync.c | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 47ab4ebb..1e2af45f 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -583,7 +583,7 @@ static int sync_trans(alpm_list_t *targets) goto cleanup; } /* target not found: check if it's a group */ - + printf(_("%s package not found, searching for group...\n"), targ); for(j = sync_dbs; j; j = alpm_list_next(j)) { pmdb_t *db = alpm_list_getdata(j); grp = alpm_db_readgrp(db, targ); @@ -617,41 +617,9 @@ static int sync_trans(alpm_list_t *targets) } } if(!found) { - /* targ not found in sync db, searching for providers... */ - alpm_list_t *prov = NULL; - for(j = sync_dbs; j; j = alpm_list_next(j)) { - pmdb_t *db = alpm_list_getdata(j); - alpm_list_t *dblist = alpm_db_getpkgcache(db); - alpm_list_t *satisfiers = alpm_find_pkg_satisfiers(dblist, targ); - prov = alpm_list_join(prov, satisfiers); - } - if(prov != NULL) { - if(alpm_list_count(prov) == 1) { - const char *pname = NULL; - pmpkg_t *pkg = alpm_list_getdata(prov); - pname = alpm_pkg_get_name(pkg); - alpm_list_free(prov); - printf(_("Warning: %s provides %s\n"), pname, targ); - targets = alpm_list_add(targets, strdup(pname)); - } else { - alpm_list_t *k; - pm_fprintf(stderr, PM_LOG_ERROR, - _("several packages provide %s, please specify one :\n"), targ); - for(k = prov; k; k = alpm_list_next(k)) { - pmpkg_t *pkg = alpm_list_getdata(k); - printf("%s ", alpm_pkg_get_name(pkg)); - } - printf("\n"); - alpm_list_free(prov); - retval = 1; - goto cleanup; - } - } else { - pm_fprintf(stderr, PM_LOG_ERROR, - _("'%s': not found in sync db\n"), targ); - retval = 1; - goto cleanup; - } + pm_fprintf(stderr, PM_LOG_ERROR, _("'%s': not found in sync db\n"), targ); + retval = 1; + goto cleanup; } } } -- cgit v1.2.3-70-g09d2