commit:     6fb1a62b59ceb6273d46dba794200661c73d87a9
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 31 13:09:06 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Dec 31 13:09:06 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6fb1a62b

qmerge: retrieve proper file also in case of gpkg format

Use the PATH from Packages for it contains the proper extension,
whatever it may be.

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

 qmerge.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/qmerge.c b/qmerge.c
index 1e52704..e77c7fa 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -311,7 +311,7 @@ best_version(const depend_atom *atom, int mode)
        int             r;
 
        if (mode & BV_EBUILD) {
-               warn("BV_EBUILD not yet supported");
+               warn("installing from ebuild not yet supported");
                return NULL;
        }
        if (mode == 0) {
@@ -2004,7 +2004,6 @@ static void
 pkg_fetch(int level, const depend_atom *qatom, const tree_match_ctx *mpkg)
 {
        int  verifyret;
-       char buf[_Q_PATH_MAX];
 
        /* qmerge -pv patch */
        if (pretend) {
@@ -2030,20 +2029,28 @@ pkg_fetch(int level, const depend_atom *qatom, const 
tree_match_ctx *mpkg)
        }
 
        if (access(mpkg->path, R_OK) != 0) {
+               char *p;
+
                if (verbose)
                        printf("Fetching %s\n", atom_to_string(mpkg->atom));
 
                /* fetch the package */
-               snprintf(buf, sizeof(buf), "%s/%s.tbz2",
-                               mpkg->atom->CATEGORY, mpkg->atom->PF);
-               fetch(mpkg->pkg->cat_ctx->ctx->path, buf);
+               p = strrchr(mpkg->path, '/');
+               if (p != NULL)
+                       p = strrchr(p, '/');
+               if (p != NULL) {
+                       p++;
+                       fetch(mpkg->pkg->cat_ctx->ctx->path, p);
+               } else {
+                       warn("invalid path: %s, skipping", mpkg->path);
+               }
 
                /* verify the pkg exists now. unlink if zero bytes */
                unlink_empty(mpkg->path);
        }
 
        if (access(mpkg->path, R_OK) != 0) {
-               warn("Failed to fetch %s.tbz2 from %s", mpkg->atom->PF, 
binhost);
+               warn("Failed to fetch %s from %s", mpkg->atom->PF, binhost);
                fflush(stderr);
                return;
        }

Reply via email to