commit:     b0c1c48bafb8db09126d951adc6aca61b1838d79
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 31 13:39:19 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Dec 31 13:39:19 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b0c1c48b

*: use proper guards for gtree/gpkg

ensure all code for gtree and/or gpkg is disabled when configured so

Bug: https://bugs.gentoo.org/968226
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 2 ++
 q.c         | 6 +++++-
 qmerge.c    | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libq/tree.c b/libq/tree.c
index e1978c7..3b5791d 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -79,7 +79,9 @@ tree_open_int(const char *sroot, const char *tdir, bool quiet)
 
 static const char portcachedir_pms[] = "metadata/cache";
 static const char portcachedir_md5[] = "metadata/md5-cache";
+#ifdef ENABLE_GTREE
 static const char portcachedir_gt1[] = "metadata/repo.gtree.tar";
+#endif
 static const char portrepo_name[]    = "profiles/repo_name";
 tree_ctx *
 tree_open(const char *sroot, const char *portdir)

diff --git a/q.c b/q.c
index 91ac5ef..963b742 100644
--- a/q.c
+++ b/q.c
@@ -110,7 +110,7 @@ int lookup_applet_idx(const char *applet)
        return 0;
 }
 
-#ifdef ENABLE_GPKG
+#ifdef ENABLE_GTREE
 struct q_cache_ctx {
        struct archive *archive;
        time_t          buildtime;
@@ -795,6 +795,7 @@ int q_main(int argc, char **argv)
        }
 
        if (build_cache) {
+#ifdef ENABLE_GTREE
                /* traverse all overlays, create a cache for each
                 * the cache basically is one giant tar with:
                 * - gtree-1  (mandatory, first file ident)
@@ -990,6 +991,9 @@ int q_main(int argc, char **argv)
                free(qcctx.cbuf);
 
                return 0;
+#else
+               err("gtree support not compiled in");
+#endif
        }
 
        if (run_jobserver) {

diff --git a/qmerge.c b/qmerge.c
index e77c7fa..12614ac 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -1230,7 +1230,7 @@ pkg_merge(int level, const depend_atom *qatom, const 
tree_match_ctx *mpkg)
        mkdir("image", 0755);
 
        if (mpkg->pkg->binpkg_isgpkg) {
-#ifdef HAVE_LIBARCHIVE
+#ifdef ENABLE_GPKG
                /* unpack the whole thing to temp, dropping the pkg name dir, so
                 * we end up with generic files in temp */
                struct archive       *a;

Reply via email to