commit:     6da11d29b20e7a3efae530992d13e469676ca30b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  1 15:44:59 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 15:44:59 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6da11d29

main: parse BINPKG_FORMAT from portage configuration

BINPKG_FORMAT defaults to gpkg because it's the new and shiny thing, but
the Portage configuration should have it configured, so realistically we
take whatever the user preference is.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 applets.h |  3 ++-
 main.c    | 16 +++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/applets.h b/applets.h
index f650bc0..e8412bf 100644
--- a/applets.h
+++ b/applets.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2024 Gentoo Foundation
+ * Copyright 2005-2026 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2010 Ned Ludd        - <[email protected]>
@@ -177,6 +177,7 @@ extern char *port_tmpdir;
 extern set  *features;
 extern set  *ev_use;
 extern char *install_mask;
+extern char *binpkg_format;
 extern DEFINE_ARRAY(overlays);
 extern DEFINE_ARRAY(overlay_names);
 extern DEFINE_ARRAY(overlay_src);

diff --git a/main.c b/main.c
index c14fe7f..b0f7375 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2025 Gentoo Foundation
+ * Copyright 2005-2026 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2008 Ned Ludd        - <[email protected]>
@@ -45,6 +45,7 @@ char *port_tmpdir;
 set  *features;
 set  *ev_use;
 char *install_mask;
+char *binpkg_format;
 DECLARE_ARRAY(overlays);
 DECLARE_ARRAY(overlay_names);
 DECLARE_ARRAY(overlay_src);
@@ -555,8 +556,8 @@ read_portage_file(const char *file, enum portage_file_type 
type, void *data)
                                                free(abuf);
 
                                                if (!endq)
-                                                       warn("%s:%zu: %s: quote 
mismatch",
-                                                                       file, 
line, vars[i].name);
+                                                       warn("%s%s:%zu: %s: 
quote mismatch",
+                                                                       
portroot, file, line, vars[i].name);
 
                                                s = buf + vars[i].name_len + 2;
                                        } else {
@@ -569,8 +570,8 @@ read_portage_file(const char *file, enum portage_file_type 
type, void *data)
                                        s[off] = '\0';
                                }
 
-                               snprintf(npath, sizeof(npath), "%s:%zu:%zu-%zu",
-                                               file, curline, cbeg, cend);
+                               snprintf(npath, sizeof(npath), 
"%s%s:%zu:%zu-%zu",
+                                               portroot, file, curline, cbeg, 
cend);
                                set_portage_env_var(&vars[i], s, npath);
                        }
                } else if (type == PMASK_FILE) {
@@ -583,8 +584,8 @@ read_portage_file(const char *file, enum portage_file_type 
type, void *data)
                                        free(p);
                        } else {
                                void *e;
-                               snprintf(npath, sizeof(npath), "%s:%zu:%zu-%zu",
-                                               file, line, cbeg, cend);
+                               snprintf(npath, sizeof(npath), 
"%s%s:%zu:%zu-%zu",
+                                               portroot, file, line, cbeg, 
cend);
                                /* if not necessary, but do it for static code 
analysers
                                 * which take into accound that add_set_value 
might
                                 * allocate a new set when masks would be NULL 
-- a case
@@ -796,6 +797,7 @@ env_vars vars_to_read[] = {
        _Q_EVS(STR,  PORTAGE_BINHOST,     binhost,             
DEFAULT_PORTAGE_BINHOST)
        _Q_EVS(STR,  PORTAGE_TMPDIR,      port_tmpdir,         CONFIG_EPREFIX 
"var/tmp/portage/")
        _Q_EVS(STR,  PKGDIR,              pkgdir,              CONFIG_EPREFIX 
"var/cache/binpkgs/")
+       _Q_EVS(STR,  BINPKG_FORMAT,       binpkg_format,       "gpkg")
        _Q_EVS(STR,  Q_VDB,               portvdb,             CONFIG_EPREFIX 
"var/db/pkg")
        _Q_EVS(STR,  Q_EDB,               portedb,             CONFIG_EPREFIX 
"var/cache/edb")
        { NULL, 0, _Q_BOOL, { NULL }, 0, NULL, NULL, }

Reply via email to