From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8A07C138334 for ; Sun, 14 Jul 2019 13:09:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AEF61E0893; Sun, 14 Jul 2019 13:09:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8C539E0893 for ; Sun, 14 Jul 2019 13:09:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 72185346C61 for ; Sun, 14 Jul 2019 13:09:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0E9F7603 for ; Sun, 14 Jul 2019 13:09:44 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1563100712.d2bbdf1064d9f718da68a9784ad8dab320edb431.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qpkg.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: d2bbdf1064d9f718da68a9784ad8dab320edb431 X-VCS-Branch: master Date: Sun, 14 Jul 2019 13:09:44 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: cbf19c0f-c248-4caf-9e49-dfefd4480695 X-Archives-Hash: 4fba1fcc769bba5b7abf4badf5c1081c commit: d2bbdf1064d9f718da68a9784ad8dab320edb431 Author: Fabian Groffen gentoo org> AuthorDate: Sun Jul 14 10:38:32 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sun Jul 14 10:38:32 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d2bbdf10 qpkg: use atom_format and tree_get_atom where possible Signed-off-by: Fabian Groffen gentoo.org> qpkg.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/qpkg.c b/qpkg.c index 2c5a6c3..29265f2 100644 --- a/qpkg.c +++ b/qpkg.c @@ -231,8 +231,8 @@ qpkg_make(depend_atom *atom) struct stat st; if (pretend) { - printf(" %s-%s %s/%s:\n", - GREEN, NORM, atom->CATEGORY, atom_to_pvr(atom)); + printf(" %s-%s %s:\n", + GREEN, NORM, atom_format("%[CATEGORY]%[PF]", atom)); return 0; } @@ -286,7 +286,8 @@ qpkg_make(depend_atom *atom) fclose(out); fclose(fp); - printf(" %s-%s %s/%s: ", GREEN, NORM, atom->CATEGORY, atom_to_pvr(atom)); + printf(" %s-%s %s: ", GREEN, NORM, + atom_format("%[CATEGORY]%[PF]", atom)); fflush(stdout); snprintf(tbz2, sizeof(tbz2), "%s/bin.tbz2", tmpdir); @@ -416,17 +417,9 @@ retry_mkdir: /* scan all the categories */ while ((cat_ctx = tree_next_cat(ctx))) { /* scan all the packages in this category */ - const char *catname = cat_ctx->name; while ((pkg_ctx = tree_next_pkg(cat_ctx))) { - const char *pkgname = pkg_ctx->name; - /* see if user wants any of these packages */ - snprintf(buf, sizeof(buf), "%s/%s", catname, pkgname); - atom = atom_explode(buf); - if (!atom) { - warn("could not explode '%s'", buf); - goto next_pkg; - } + atom = tree_get_atom(pkg_ctx, false); snprintf(buf, sizeof(buf), "%s/%s", atom->CATEGORY, atom->PN); for (i = optind; i < argc; ++i) { if (!argv[i]) continue; @@ -438,9 +431,6 @@ retry_mkdir: if (!qpkg_make(atom)) ++pkgs_made; } - atom_implode(atom); - - next_pkg: tree_close_pkg(pkg_ctx); } }