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: Fri, 10 May 2019 15:33:05
Message-Id: 1557489704.5725e66ffa06bff4edf349e4afb834e66f671b69.grobian@gentoo
1 commit: 5725e66ffa06bff4edf349e4afb834e66f671b69
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 10 12:01:44 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Fri May 10 12:01:44 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5725e66f
7
8 libq/tree: use tree_get_atom in tree_pkg_metadata
9
10 apart from that it is simpler, it also allows for reuse
11
12 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
13
14 libq/tree.c | 8 ++------
15 1 file changed, 2 insertions(+), 6 deletions(-)
16
17 diff --git a/libq/tree.c b/libq/tree.c
18 index bb7eefa..c8b4b5e 100644
19 --- a/libq/tree.c
20 +++ b/libq/tree.c
21 @@ -821,7 +821,6 @@ tree_pkg_metadata(tree_pkg_ctx *pkg_ctx)
22 size_t len;
23 tree_metadata_xml *ret = NULL;
24 struct elist *emailw = NULL;
25 - char buf[_Q_PATH_MAX];
26
27 /* lame @$$ XML parsing, I don't want to pull in a real parser
28 * library because we only retrieve one element for now: email
29 @@ -832,13 +831,10 @@ tree_pkg_metadata(tree_pkg_ctx *pkg_ctx)
30 if (ctx->cachetype == CACHE_EBUILD) {
31 fd = openat(pkg_ctx->cat_ctx->fd, "metadata", O_RDONLY | O_CLOEXEC);
32 } else {
33 - depend_atom *atom;
34 - snprintf(buf, sizeof(buf), "%s/%s",
35 - pkg_ctx->cat_ctx->name, pkg_ctx->name);
36 - atom = atom_explode(buf);
37 + char buf[_Q_PATH_MAX];
38 + depend_atom *atom = tree_get_atom(pkg_ctx, false);
39 snprintf(buf, sizeof(buf), "../../%s/%s/metadata.xml",
40 atom->CATEGORY, atom->PN);
41 - atom_implode(atom);
42 fd = openat(ctx->tree_fd, buf, O_RDONLY | O_CLOEXEC);
43 }