aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2022-05-20 19:02:56 +0200
committerFabian Groffen <grobian@gentoo.org>2022-05-20 19:02:56 +0200
commitb868d22a6c731449ccfec344508458cf9f7a5abf (patch)
tree8665f5d90ba47351318ab3eb523ab595fcc7b4e5
parentqlist: print BUILD_ID for binpkgs (if any) (diff)
downloadportage-utils-b868d22a.tar.gz
portage-utils-b868d22a.tar.bz2
portage-utils-b868d22a.zip
libq/tree: support FEATURES=binpkg-multi-instance Packages file
Based on the work of genbtc in GitHub PR #16 Add BUILD_ID to atom when parsing and use PATH to get the appropriate location. Closes: https://github.com/gentoo/portage-utils/pull/16 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--libq/tree.c23
-rw-r--r--libq/tree.h4
2 files changed, 21 insertions, 6 deletions
diff --git a/libq/tree.c b/libq/tree.c
index d71ee74..2a457ce 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1440,6 +1440,8 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb callback, void *priv)
}
cat->pkg_ctxs = (tree_pkg_ctx **)atom; /* for name */
}
+ if (meta.Q_BUILDID != NULL)
+ atom->BUILDID = atoi(meta.Q_BUILDID);
pkgnamelen = snprintf(pkgname, sizeof(pkgname),
"%s.tbz2", atom->PF);
pkgname[pkgnamelen - (sizeof(".tbz2") - 1)] = '\0';
@@ -1510,6 +1512,9 @@ tree_foreach_packages(tree_ctx *ctx, tree_pkg_cb callback, void *priv)
match_key(PDEPEND);
match_key2(REPO, repository);
match_key(SIZE);
+ match_key(BDEPEND);
+ match_key(PATH);
+ match_key2(BUILD_ID, BUILDID);
#undef match_key
#undef match_key2
}
@@ -1812,11 +1817,19 @@ tree_match_atom(tree_ctx *ctx, const depend_atom *query, int flags)
n = xzalloc(sizeof(tree_match_ctx)); \
n->atom = atom; \
n->pkg = pkg_ctx; \
- snprintf(n->path, sizeof(n->path), "%s/%s/%s%s", \
- (char *)C->ctx->path, C->name, pkg_ctx->name, \
- C->ctx->cachetype == CACHE_EBUILD ? ".ebuild" : \
- C->ctx->cachetype == CACHE_BINPKGS ? ".tbz2" : \
- C->ctx->cachetype == CACHE_PACKAGES ? ".tbz2" : ""); \
+ if (C->ctx->cachetype == CACHE_PACKAGES && \
+ pkg_ctx->meta->Q_PATH != NULL) \
+ { \
+ /* binpkg-multi-instance has a PATH ready for us */ \
+ snprintf(n->path, sizeof(n->path), "%s/%s", \
+ (char *)C->ctx->path, pkg_ctx->meta->Q_PATH); \
+ } else { \
+ snprintf(n->path, sizeof(n->path), "%s/%s/%s%s", \
+ (char *)C->ctx->path, C->name, pkg_ctx->name, \
+ C->ctx->cachetype == CACHE_EBUILD ? ".ebuild" : \
+ C->ctx->cachetype == CACHE_BINPKGS ? ".tbz2" : \
+ C->ctx->cachetype == CACHE_PACKAGES ? ".tbz2" : ""); \
+ } \
if (flags & TREE_MATCH_METADATA) \
n->meta = tree_pkg_read(pkg_ctx); \
if (C->ctx->cachetype == CACHE_BINPKGS || \
diff --git a/libq/tree.h b/libq/tree.h
index 8279281..2f2c81f 100644
--- a/libq/tree.h
+++ b/libq/tree.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2021 Gentoo Foundation
+ * Copyright 2005-2022 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
*/
@@ -104,6 +104,8 @@ struct tree_pkg_meta {
char *Q_CONTENTS;
char *Q_USE;
char *Q_EPREFIX;
+ char *Q_PATH; /* binpkg-multi-instance */
+ char *Q_BUILDID; /* binpkg-multi-instance */
char *Q_repository;
char *Q_MD5;
char *Q_SHA1;