[pacman-dev] [PATCH 5/5] pacman/sync.c : remove duplicated fallback on providers.
The fallback on providers when a target is not found was already made in the backend : libalpm/sync.c , _alpm_sync_addtarget . So I removed it from the frontend. The sync500 pactest proves this fallback still works correctly. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- src/pacman/sync.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 6f3c5d5..bb48cf9 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -524,26 +524,9 @@ int sync_trans(alpm_list_t *targets, int sync_only) } } if(!found) { - /* targ not found in sync db, searching for providers... */ - const char *pname = NULL; - for(j = sync_dbs; j; j = alpm_list_next(j)) { - pmdb_t *db = alpm_list_getdata(j); - alpm_list_t *prov = alpm_db_whatprovides(db, targ); - if(prov) { - pmpkg_t *pkg = alpm_list_getdata(prov); - pname = alpm_pkg_get_name(pkg); - alpm_list_free(prov); - break; - } - } - if(pname != NULL) { - /* targ is provided by pname */ - targets = alpm_list_add(targets, strdup(pname)); - } else { - fprintf(stderr, _("error: '%s': not found in sync db\n"), targ); - retval = 1; - goto cleanup; - } + fprintf(stderr, _("error: '%s': not found in sync db\n"), targ); + retval = 1; + goto cleanup; } } } -- 1.5.3.5
Idézés Chantry Xavier <shiningxc@gmail.com>:
The fallback on providers when a target is not found was already made in the backend : libalpm/sync.c , _alpm_sync_addtarget . So I removed it from the frontend.
The sync500 pactest proves this fallback still works correctly.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- src/pacman/sync.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-)
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 6f3c5d5..bb48cf9 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -524,26 +524,9 @@ int sync_trans(alpm_list_t *targets, int sync_only) } } if(!found) { - /* targ not found in sync db, searching for providers... */ - const char *pname = NULL; - for(j = sync_dbs; j; j = alpm_list_next(j)) { - pmdb_t *db = alpm_list_getdata(j); - alpm_list_t *prov = alpm_db_whatprovides(db, targ); - if(prov) { - pmpkg_t *pkg = alpm_list_getdata(prov); - pname = alpm_pkg_get_name(pkg); - alpm_list_free(prov); - break; - } - } - if(pname != NULL) { - /* targ is provided by pname */ - targets = alpm_list_add(targets, strdup(pname)); - } else { - fprintf(stderr, _("error: '%s': not found in sync db\n"), targ); - retval = 1; - goto cleanup; - } + fprintf(stderr, _("error: '%s': not found in sync db\n"), targ); + retval = 1; + goto cleanup; } } } -- 1.5.3.5
Hmm. Good catch. However, personally I would clean-up libalpm instead of the front-end. The front-end should know what he wants. In the future we may add -Sg -S'provision' options and so on. In other words, the backend should be as much flexible as possible. Thus I'd prefer the following: method 1.: add sync_addtargetpkg, sync_addtargetgrp and so on to libalpm method 2.: keep the current method, but give an option to front-end (through trans flags) to tell libalpm what he wants. Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
On Sat, Nov 17, 2007 at 03:04:04PM +0100, Nagy Gabor wrote:
Hmm. Good catch. However, personally I would clean-up libalpm instead of the front-end. The front-end should know what he wants. In the future we may add -Sg -S'provision' options and so on. In other words, the backend should be as much flexible as possible. Thus I'd prefer the following: method 1.: add sync_addtargetpkg, sync_addtargetgrp and so on to libalpm method 2.: keep the current method, but give an option to front-end (through trans flags) to tell libalpm what he wants. Bye
Hmm ok, I'll hold this one then. It's indeed related to the Sg patch I started to write. But I couldn't find anything that satisfied me. Maybe considering to change the backend will help.
On Nov 17, 2007 9:45 AM, Xavier <shiningxc@gmail.com> wrote:
On Sat, Nov 17, 2007 at 03:04:04PM +0100, Nagy Gabor wrote:
Hmm. Good catch. However, personally I would clean-up libalpm instead of the front-end. The front-end should know what he wants. In the future we may add -Sg -S'provision' options and so on. In other words, the backend should be as much flexible as possible. Thus I'd prefer the following: method 1.: add sync_addtargetpkg, sync_addtargetgrp and so on to libalpm method 2.: keep the current method, but give an option to front-end (through trans flags) to tell libalpm what he wants. Bye
Hmm ok, I'll hold this one then. It's indeed related to the Sg patch I started to write. But I couldn't find anything that satisfied me. Maybe considering to change the backend will help.
Because this removes currently dead code, I'm going to merge it for now. I do agree with Nagy's sentiment that in the future we should ensure the frontend does have flexibility to do what they wish to do. Of course, I hate trans flags as well... -Dan
On Sat, Nov 17, 2007 at 09:56:42AM -0600, Dan McGee wrote:
Because this removes currently dead code, I'm going to merge it for now. I do agree with Nagy's sentiment that in the future we should ensure the frontend does have flexibility to do what they wish to do. Of course, I hate trans flags as well...
Hm, I just removed it from my git tree :) But fair enough. I don't think this should harm in any way a future clean-up.
participants (4)
-
Chantry Xavier
-
Dan McGee
-
Nagy Gabor
-
Xavier