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 8B198138335 for ; Sat, 11 May 2019 07:14:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 46501E0875; Sat, 11 May 2019 07:14:52 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 2ED61E0875 for ; Sat, 11 May 2019 07:14:52 +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 97D3534401D for ; Sat, 11 May 2019 07:14:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 136B15E3 for ; Sat, 11 May 2019 07:14:49 +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: <1557557502.4c61b246302353878ea28a90b5b0f4fe5e1e7ca3.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: 4c61b246302353878ea28a90b5b0f4fe5e1e7ca3 X-VCS-Branch: master Date: Sat, 11 May 2019 07:14:49 +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: 4b08f211-bd77-4935-ae84-85db58c8d166 X-Archives-Hash: 16b12f14220aba43b4bc662c0dfb11cd commit: 4c61b246302353878ea28a90b5b0f4fe5e1e7ca3 Author: Fabian Groffen gentoo org> AuthorDate: Sat May 11 06:51:42 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat May 11 06:51:42 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4c61b246 libq/tree: allow reconstruction of atom in tree_get_atom if SLOT or REPO got unset in the atom or slot or repo were somehow set elsewhere, reuse those values to populate the atom with Signed-off-by: Fabian Groffen gentoo.org> libq/tree.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libq/tree.c b/libq/tree.c index 86dd18f..8384458 100644 --- a/libq/tree.c +++ b/libq/tree.c @@ -993,24 +993,28 @@ tree_get_atom(tree_pkg_ctx *pkg_ctx, bool complete) tree_ctx *ctx = pkg_ctx->cat_ctx->ctx; if (ctx->cachetype == CACHE_VDB) { if (pkg_ctx->atom->SLOT == NULL) { - tree_pkg_vdb_eat(pkg_ctx, "SLOT", - &pkg_ctx->slot, &pkg_ctx->slot_len); + if (pkg_ctx->slot == NULL) + tree_pkg_vdb_eat(pkg_ctx, "SLOT", + &pkg_ctx->slot, &pkg_ctx->slot_len); pkg_ctx->atom->SLOT = pkg_ctx->slot; } if (pkg_ctx->atom->REPO == NULL) { - tree_pkg_vdb_eat(pkg_ctx, "repository", - &pkg_ctx->repo, &pkg_ctx->repo_len); + if (pkg_ctx->repo == NULL) + tree_pkg_vdb_eat(pkg_ctx, "repository", + &pkg_ctx->repo, &pkg_ctx->repo_len); pkg_ctx->atom->REPO = pkg_ctx->repo; } } else { /* metadata or ebuild */ if (pkg_ctx->atom->SLOT == NULL) { - tree_pkg_meta *meta = tree_pkg_read(pkg_ctx); - if (meta != NULL) { - pkg_ctx->slot = xstrdup(meta->SLOT); - pkg_ctx->slot_len = strlen(pkg_ctx->slot); - pkg_ctx->atom->SLOT = pkg_ctx->slot; - tree_close_meta(meta); + if (pkg_ctx->slot == NULL) { + tree_pkg_meta *meta = tree_pkg_read(pkg_ctx); + if (meta != NULL) { + pkg_ctx->slot = xstrdup(meta->SLOT); + pkg_ctx->slot_len = strlen(pkg_ctx->slot); + tree_close_meta(meta); + } } + pkg_ctx->atom->SLOT = pkg_ctx->slot; } /* repo is set from the tree, when found */ if (pkg_ctx->atom->REPO == NULL)