commit: 717aa306c7138580d2aa4e3946049b121b7b2b4c Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Tue Apr 17 20:12:11 2018 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Tue Apr 17 20:12:11 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=717aa306
qcache: use metadata/md5-cache iso /var/cache/edb/ main.c | 14 +++++++++----- qcache.c | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index bf85786..9103dc4 100644 --- a/main.c +++ b/main.c @@ -1037,7 +1037,7 @@ initialize_flat(const char *overlay, int cache_type, bool force) return cache_file; } - warn("Updating ebuild %scache in %s ... ", + warn("Updating ebuild %scache for %s ... ", cache_type == CACHE_EBUILD ? "" : "meta", overlay); count = frac = secs = 0; @@ -1048,7 +1048,8 @@ initialize_flat(const char *overlay, int cache_type, bool force) if (cache_type == CACHE_METADATA) { subdir_fd = openat(overlay_fd, portcachedir_md5, O_RDONLY|O_CLOEXEC); if (subdir_fd == -1) { - subdir_fd = openat(overlay_fd, portcachedir_pms, O_RDONLY|O_CLOEXEC); + subdir_fd = openat(overlay_fd, portcachedir_pms, + O_RDONLY|O_CLOEXEC); if (subdir_fd == -1) { warnp("could not read md5 or pms cache dirs in %s", overlay); goto ret; @@ -1084,13 +1085,15 @@ initialize_flat(const char *overlay, int cache_type, bool force) continue; int c, pkg_cnt; - pkg_cnt = scandirat(subdir_fd, category[i]->d_name, &pn, q_vdb_filter_pkg, alphasort); + pkg_cnt = scandirat(subdir_fd, category[i]->d_name, &pn, + q_vdb_filter_pkg, alphasort); if (pkg_cnt < 0) continue; for (c = 0; c < pkg_cnt; c++) { char de[_Q_PATH_MAX]; - snprintf(de, sizeof(de), "%s/%s", category[i]->d_name, pn[c]->d_name); + snprintf(de, sizeof(de), "%s/%s", + category[i]->d_name, pn[c]->d_name); if (fstatat(subdir_fd, de, &st, 0) < 0) continue; @@ -1107,7 +1110,8 @@ initialize_flat(const char *overlay, int cache_type, bool force) } int e, ebuild_cnt; - ebuild_cnt = scandirat(subdir_fd, de, &eb, filter_hidden, alphasort); + ebuild_cnt = scandirat(subdir_fd, de, &eb, + filter_hidden, alphasort); if (ebuild_cnt < 0) continue; for (e = 0; e < ebuild_cnt; ++e) { diff --git a/qcache.c b/qcache.c index 545f336..03bcd05 100644 --- a/qcache.c +++ b/qcache.c @@ -407,9 +407,11 @@ qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay) int i, j, k, len, num_cat, num_pkg, num_ebuild; struct dirent **categories, **packages, **ebuilds; - xasprintf(&catpath, "%s/dep/%s", portedb, overlay); + xasprintf(&catpath, "%s/metadata/md5-cache", overlay); - if (-1 == (num_cat = scandir(catpath, &categories, qcache_file_select, alphasort))) { + if (-1 == (num_cat = scandir(catpath, &categories, + qcache_file_select, alphasort))) + { errp("%s", catpath); free(catpath); } @@ -421,7 +423,9 @@ qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay) for (i = 0; i < num_cat; i++) { xasprintf(&pkgpath, "%s/%s", overlay, categories[i]->d_name); - if (-1 == (num_pkg = scandir(pkgpath, &packages, qcache_file_select, alphasort))) { + if (-1 == (num_pkg = scandir(pkgpath, &packages, + qcache_file_select, alphasort))) + { if (errno != ENOENT) warnp("Found a cache dir, but unable to process %s", pkgpath); free(categories[i]); @@ -440,9 +444,12 @@ qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay) /* traverse packages */ for (j = 0; j < num_pkg; j++) { - xasprintf(&ebuildpath, "%s/%s/%s", overlay, categories[i]->d_name, packages[j]->d_name); + xasprintf(&ebuildpath, "%s/%s/%s", + overlay, categories[i]->d_name, packages[j]->d_name); - if (-1 == (num_ebuild = scandir(ebuildpath, &ebuilds, qcache_ebuild_select, qcache_vercmp))) { + if (-1 == (num_ebuild = scandir(ebuildpath, &ebuilds, + qcache_ebuild_select, qcache_vercmp))) + { /* Do not complain about spurious files */ if (errno != ENOTDIR) warnp("%s", ebuildpath); @@ -465,7 +472,8 @@ qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay) /* traverse ebuilds */ data.num = num_ebuild; for (k = 0; k < num_ebuild; k++) { - len = xasprintf(&cachepath, "%s/%s/%s", catpath, categories[i]->d_name, ebuilds[k]->d_name); + len = xasprintf(&cachepath, "%s/%s/%s", + catpath, categories[i]->d_name, ebuilds[k]->d_name); cachepath[len - 7] = '\0'; /* remove ".ebuild" */ data.category = categories[i]->d_name; @@ -484,7 +492,7 @@ qcache_traverse_overlay(void (*func)(qcache_data*), const char *overlay) if (!warned) { warned = true; warnp("unable to read cache '%s'\n" - "\tperhaps you need to `egencache -j 4` ?", cachepath); + "\tperhaps you need to `egencache`?", cachepath); } }