From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 32D141382C5 for ; Mon, 31 May 2021 19:14:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 788E5E0844; Mon, 31 May 2021 19:14:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5BAC8E0844 for ; Mon, 31 May 2021 19:14:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 13707340D82 for ; Mon, 31 May 2021 19:14:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C01A978B for ; Mon, 31 May 2021 19:14:23 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1622488325.e5dfd95c6425ff55b59803eeb13dbcad3af140fb.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: e5dfd95c6425ff55b59803eeb13dbcad3af140fb X-VCS-Branch: master Date: Mon, 31 May 2021 19:14:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c37e172a-dd6c-409b-b835-cab810823200 X-Archives-Hash: 312b2215c4d2a2e92aa68fd3d26f1208 commit: e5dfd95c6425ff55b59803eeb13dbcad3af140fb Author: Fabian Groffen gentoo org> AuthorDate: Mon May 31 19:12:05 2021 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Mon May 31 19:12:05 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e5dfd95c qmerge: some silencing - create root/vdb if it doesn't exist (instead of barking up random trees) - avoid some duplicate slashes Signed-off-by: Fabian Groffen gentoo.org> qmerge.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/qmerge.c b/qmerge.c index 08ce812..8f1ca3d 100644 --- a/qmerge.c +++ b/qmerge.c @@ -684,9 +684,9 @@ pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char "FILESDIR=/.does/not/exist/anywhere\n" "MERGE_TYPE=binary\n" "ROOT='%4$s'\n" - "EROOT=\"/${ROOT#/}/${EPREFIX%%/}/\"\n" + "EROOT=\"${ROOT%%/}${EPREFIX%%/}/\"\n" "D=\"%5$s\"\n" - "ED=\"${D%%/}/${EPREFIX%%/}/\"\n" + "ED=\"${D%%/}${EPREFIX%%/}/\"\n" "T=\"%6$s\"\n" /* we do not support preserve-libs yet, so force * preserve_old_lib instead */ @@ -1092,8 +1092,17 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) /* Get a handle on the main vdb repo */ vdb = tree_open_vdb(portroot, portvdb); - if (!vdb) - return; + if (vdb == NULL) { + if (pretend) + return; + /* try to create a vdb if none exists yet */ + xasprintf(&p, "%s/%s", portroot, portvdb); + mkdir_p(p, 0755); + free(p); + vdb = tree_open_vdb(portroot, portvdb); + } + if (vdb == NULL) + errf("need access to root, check permissions to access %s", portroot); cat_ctx = tree_open_cat(vdb, pkg->CATEGORY); if (!cat_ctx) { if (errno != ENOENT) { @@ -1347,11 +1356,10 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) makeargv(config_protect, &cp_argc, &cp_argv); makeargv(config_protect_mask, &cpm_argc, &cpm_argv); - if ((contents = fopen("vdb/CONTENTS", "w")) == NULL) - errf("come on wtf?"); - objs = NULL; - { + if ((contents = fopen("vdb/CONTENTS", "w")) == NULL) { + errf("could not open vdb/CONTENTS for writing"); + } else { char *cpath; int ret; @@ -1365,8 +1373,9 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) if (ret != 0) errp("failed to merge to %s", portroot); + + fclose(contents); } - fclose(contents); /* run postinst */ if (!pretend)