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 E90FA1382C5 for ; Tue, 1 Jun 2021 19:43:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E3949E07A5; Tue, 1 Jun 2021 19:43:06 +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 C822EE07A5 for ; Tue, 1 Jun 2021 19:43:06 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 F1A9B340FAA for ; Tue, 1 Jun 2021 19:43:04 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 206FB791 for ; Tue, 1 Jun 2021 19:43:03 +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: <1622576332.4fd296d65c76ceb98f69ff392c2ae0f31bd18d54.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/tree.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 4fd296d65c76ceb98f69ff392c2ae0f31bd18d54 X-VCS-Branch: master Date: Tue, 1 Jun 2021 19:43:03 +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: 112e0fa1-4370-4a1e-b7e4-86206b075179 X-Archives-Hash: 95bd3ee46640c2462091e49b6661f702 commit: 4fd296d65c76ceb98f69ff392c2ae0f31bd18d54 Author: Fabian Groffen gentoo org> AuthorDate: Tue Jun 1 19:38:52 2021 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Tue Jun 1 19:38:52 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4fd296d6 libq/tree: fix empty cat_ctx and path when using binpkgs - ensure cat_ctx is set for each pkg coming from Packages file - set path in each tree match Signed-off-by: Fabian Groffen gentoo.org> libq/tree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libq/tree.c b/libq/tree.c index c00f251..358b1f2 100644 --- a/libq/tree.c +++ b/libq/tree.c @@ -1380,7 +1380,6 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb callback, void *priv) * generate a dummy cat */ cat = tree_open_cat(ctx, "."); } - pkg.cat_ctx = cat; cat->pkg_ctxs = (tree_pkg_ctx **)atom; /* for name */ } pkgnamelen = snprintf(pkgname, sizeof(pkgname), @@ -1390,6 +1389,7 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb callback, void *priv) pkg.slot = meta.Q_SLOT == NULL ? (char *)"0" : meta.Q_SLOT; pkg.repo = ctx->repo; pkg.atom = atom; + pkg.cat_ctx = cat; pkg.fd = 0; /* intentional, meta has already been read */ /* do call callback with pkg_atom (populate cat and pkg) */ @@ -1650,6 +1650,8 @@ tree_match_atom_packages_cb(tree_pkg_ctx *ctx, void *priv) n = xzalloc(sizeof(tree_match_ctx)); n->free_atom = true; n->atom = atom_clone(a); + snprintf(n->path, sizeof(n->path), "%s/%s/%s.tbz2", + (char *)ctx->cat_ctx->ctx->path, ctx->cat_ctx->name, ctx->name); if (rctx->flags & TREE_MATCH_METADATA) { n->meta = xmalloc(sizeof(*n->meta)); /* for Packages, all pointers to meta here are to the in memory @@ -1686,6 +1688,8 @@ tree_match_atom_binpkg_cb(tree_pkg_ctx *ctx, void *priv) n = xzalloc(sizeof(tree_match_ctx)); n->free_atom = true; n->atom = atom_clone(a); + snprintf(n->path, sizeof(n->path), "%s/%s/%s.tbz2", + (char *)ctx->cat_ctx->ctx->path, ctx->cat_ctx->name, ctx->name); if (rctx->flags & TREE_MATCH_METADATA) n->meta = tree_pkg_read(ctx);