Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/
Date: Sat, 11 May 2019 07:14:53
Message-Id: 1557557502.4c61b246302353878ea28a90b5b0f4fe5e1e7ca3.grobian@gentoo
1 commit: 4c61b246302353878ea28a90b5b0f4fe5e1e7ca3
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 11 06:51:42 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sat May 11 06:51:42 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4c61b246
7
8 libq/tree: allow reconstruction of atom in tree_get_atom
9
10 if SLOT or REPO got unset in the atom or slot or repo were somehow set
11 elsewhere, reuse those values to populate the atom with
12
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 libq/tree.c | 24 ++++++++++++++----------
16 1 file changed, 14 insertions(+), 10 deletions(-)
17
18 diff --git a/libq/tree.c b/libq/tree.c
19 index 86dd18f..8384458 100644
20 --- a/libq/tree.c
21 +++ b/libq/tree.c
22 @@ -993,24 +993,28 @@ tree_get_atom(tree_pkg_ctx *pkg_ctx, bool complete)
23 tree_ctx *ctx = pkg_ctx->cat_ctx->ctx;
24 if (ctx->cachetype == CACHE_VDB) {
25 if (pkg_ctx->atom->SLOT == NULL) {
26 - tree_pkg_vdb_eat(pkg_ctx, "SLOT",
27 - &pkg_ctx->slot, &pkg_ctx->slot_len);
28 + if (pkg_ctx->slot == NULL)
29 + tree_pkg_vdb_eat(pkg_ctx, "SLOT",
30 + &pkg_ctx->slot, &pkg_ctx->slot_len);
31 pkg_ctx->atom->SLOT = pkg_ctx->slot;
32 }
33 if (pkg_ctx->atom->REPO == NULL) {
34 - tree_pkg_vdb_eat(pkg_ctx, "repository",
35 - &pkg_ctx->repo, &pkg_ctx->repo_len);
36 + if (pkg_ctx->repo == NULL)
37 + tree_pkg_vdb_eat(pkg_ctx, "repository",
38 + &pkg_ctx->repo, &pkg_ctx->repo_len);
39 pkg_ctx->atom->REPO = pkg_ctx->repo;
40 }
41 } else { /* metadata or ebuild */
42 if (pkg_ctx->atom->SLOT == NULL) {
43 - tree_pkg_meta *meta = tree_pkg_read(pkg_ctx);
44 - if (meta != NULL) {
45 - pkg_ctx->slot = xstrdup(meta->SLOT);
46 - pkg_ctx->slot_len = strlen(pkg_ctx->slot);
47 - pkg_ctx->atom->SLOT = pkg_ctx->slot;
48 - tree_close_meta(meta);
49 + if (pkg_ctx->slot == NULL) {
50 + tree_pkg_meta *meta = tree_pkg_read(pkg_ctx);
51 + if (meta != NULL) {
52 + pkg_ctx->slot = xstrdup(meta->SLOT);
53 + pkg_ctx->slot_len = strlen(pkg_ctx->slot);
54 + tree_close_meta(meta);
55 + }
56 }
57 + pkg_ctx->atom->SLOT = pkg_ctx->slot;
58 }
59 /* repo is set from the tree, when found */
60 if (pkg_ctx->atom->REPO == NULL)