From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 58B48138A87 for ; Tue, 24 Feb 2015 01:26:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AFF94E08DD; Tue, 24 Feb 2015 01:26:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CDAF3E08DD for ; Tue, 24 Feb 2015 01:26:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2CC1134096D for ; Tue, 24 Feb 2015 01:26:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4AA5B126BF for ; Tue, 24 Feb 2015 01:26:05 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1424738023.f61120de1a713ae221e9a5b869bb75c74301f6bd.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: f61120de1a713ae221e9a5b869bb75c74301f6bd X-VCS-Branch: master Date: Tue, 24 Feb 2015 01:26:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bdb30c6b-1554-4a48-8b2f-196f37765581 X-Archives-Hash: 967bb5a97c7caad0e6ff8ffa56ea44d9 commit: f61120de1a713ae221e9a5b869bb75c74301f6bd Author: Mike Frysinger gentoo org> AuthorDate: Tue Feb 24 00:33:43 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Feb 24 00:33:43 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=f61120de qmerge: use atom_compare to figure out matches This brings proper version/slot/etc... matching when installing packages: qmerge nano:0 qmerge '>python-3.1' --- qmerge.c | 74 ++++++++++++++++------------------------------------------------ 1 file changed, 18 insertions(+), 56 deletions(-) diff --git a/qmerge.c b/qmerge.c index 1bd860d..9df9384 100644 --- a/qmerge.c +++ b/qmerge.c @@ -1210,31 +1210,6 @@ _q_static int unlink_empty(const char *buf) return -1; } -_q_static int match_pkg(const queue *ll, const depend_atom *atom, const struct pkg_t *pkg) -{ - char buf[255]; - int match = 0; - - snprintf(buf, sizeof(buf), "%s/%s", pkg->CATEGORY, pkg->PF); - - /* verify this is the requested package */ - if (strcmp(ll->name, buf) == 0) - match = 1; - - if (strcmp(ll->name, pkg->PF) == 0) - match = 2; - - snprintf(buf, sizeof(buf), "%s/%s", atom->CATEGORY, atom->PN); - - if (strcmp(ll->name, buf) == 0) - match = 3; - - if (strcmp(ll->name, atom->PN) == 0) - match = 4; - - return match; -} - _q_static int pkg_verify_checksums(char *fname, const struct pkg_t *pkg, const depend_atom *atom, int strict, int display) @@ -1277,22 +1252,6 @@ pkg_verify_checksums(char *fname, const struct pkg_t *pkg, const depend_atom *at return ret; } -_q_static -void pkg_process(const queue *todo, const depend_atom *atom, const struct pkg_t *pkg) -{ - const queue *ll; - - ll = todo; - while (ll) { - if (ll->name[0] != '-' && match_pkg(ll, atom, pkg)) { - /* fetch all requested packages */ - pkg_fetch(0, atom, pkg); - } - - ll = ll->next; - } -} - _q_static void pkg_fetch(int level, const depend_atom *atom, const struct pkg_t *pkg) { @@ -1712,23 +1671,26 @@ parse_packages(queue *todo) while (getline(&buf, &buflen, fp) != -1) { if (*buf == '\n') { if (pkg_atom) { - struct pkg_t *pkg = xmalloc(sizeof(*pkg)); - *pkg = Pkg; - - if (search_pkgs) { - if (todo) { - queue *ll = todo; - while (ll) { - if ((match_pkg(ll, pkg_atom, pkg) > 0) || (strcmp(ll->name, pkg->CATEGORY) == 0)) - print_Pkg(verbose, pkg_atom, pkg); - ll = ll->next; + if (search_pkgs && !todo) { + print_Pkg(verbose, pkg_atom, &Pkg); + } else { + const queue *ll = todo; + depend_atom *todo_atom; + while (ll) { + todo_atom = atom_explode(ll->name); + pkg_atom->REPO = todo_atom->REPO ? Pkg.REPO : NULL; + pkg_atom->SLOT = todo_atom->SLOT ? Pkg.SLOT : NULL; + if (atom_compare(todo_atom, pkg_atom) == EQUAL) { + if (search_pkgs) + print_Pkg(verbose, pkg_atom, &Pkg); + else + pkg_fetch(0, pkg_atom, &Pkg); } - } else - print_Pkg(verbose, pkg_atom, pkg); - } else - pkg_process(todo, pkg_atom, pkg); + atom_implode(todo_atom); + ll = ll->next; + } + } - free(pkg); atom_implode(pkg_atom); pkg_atom = NULL; }