1 |
commit: e5dfd95c6425ff55b59803eeb13dbcad3af140fb |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 31 19:12:05 2021 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 31 19:12:05 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e5dfd95c |
7 |
|
8 |
qmerge: some silencing |
9 |
|
10 |
- create root/vdb if it doesn't exist (instead of barking up random trees) |
11 |
- avoid some duplicate slashes |
12 |
|
13 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
14 |
|
15 |
qmerge.c | 27 ++++++++++++++++++--------- |
16 |
1 file changed, 18 insertions(+), 9 deletions(-) |
17 |
|
18 |
diff --git a/qmerge.c b/qmerge.c |
19 |
index 08ce812..8f1ca3d 100644 |
20 |
--- a/qmerge.c |
21 |
+++ b/qmerge.c |
22 |
@@ -684,9 +684,9 @@ pkg_run_func_at(int dirfd, const char *vdb_path, const char *phases, const char |
23 |
"FILESDIR=/.does/not/exist/anywhere\n" |
24 |
"MERGE_TYPE=binary\n" |
25 |
"ROOT='%4$s'\n" |
26 |
- "EROOT=\"/${ROOT#/}/${EPREFIX%%/}/\"\n" |
27 |
+ "EROOT=\"${ROOT%%/}${EPREFIX%%/}/\"\n" |
28 |
"D=\"%5$s\"\n" |
29 |
- "ED=\"${D%%/}/${EPREFIX%%/}/\"\n" |
30 |
+ "ED=\"${D%%/}${EPREFIX%%/}/\"\n" |
31 |
"T=\"%6$s\"\n" |
32 |
/* we do not support preserve-libs yet, so force |
33 |
* preserve_old_lib instead */ |
34 |
@@ -1092,8 +1092,17 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) |
35 |
|
36 |
/* Get a handle on the main vdb repo */ |
37 |
vdb = tree_open_vdb(portroot, portvdb); |
38 |
- if (!vdb) |
39 |
- return; |
40 |
+ if (vdb == NULL) { |
41 |
+ if (pretend) |
42 |
+ return; |
43 |
+ /* try to create a vdb if none exists yet */ |
44 |
+ xasprintf(&p, "%s/%s", portroot, portvdb); |
45 |
+ mkdir_p(p, 0755); |
46 |
+ free(p); |
47 |
+ vdb = tree_open_vdb(portroot, portvdb); |
48 |
+ } |
49 |
+ if (vdb == NULL) |
50 |
+ errf("need access to root, check permissions to access %s", portroot); |
51 |
cat_ctx = tree_open_cat(vdb, pkg->CATEGORY); |
52 |
if (!cat_ctx) { |
53 |
if (errno != ENOENT) { |
54 |
@@ -1347,11 +1356,10 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) |
55 |
makeargv(config_protect, &cp_argc, &cp_argv); |
56 |
makeargv(config_protect_mask, &cpm_argc, &cpm_argv); |
57 |
|
58 |
- if ((contents = fopen("vdb/CONTENTS", "w")) == NULL) |
59 |
- errf("come on wtf?"); |
60 |
- |
61 |
objs = NULL; |
62 |
- { |
63 |
+ if ((contents = fopen("vdb/CONTENTS", "w")) == NULL) { |
64 |
+ errf("could not open vdb/CONTENTS for writing"); |
65 |
+ } else { |
66 |
char *cpath; |
67 |
int ret; |
68 |
|
69 |
@@ -1365,8 +1373,9 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) |
70 |
|
71 |
if (ret != 0) |
72 |
errp("failed to merge to %s", portroot); |
73 |
+ |
74 |
+ fclose(contents); |
75 |
} |
76 |
- fclose(contents); |
77 |
|
78 |
/* run postinst */ |
79 |
if (!pretend) |