commit: 28d0df0c3be0042006fbf39ff83d4d0342832caa
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue May 19 16:04:57 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue May 19 16:04:57 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=28d0df0c
qgrep/qpkg: use the cache file given
The qgrep code needs a rework to avoid chdir assumptions, but that's
much larger than fixing the cache file name, so punt for later.
qgrep.c | 4 ++--
qpkg.c | 14 +-------------
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/qgrep.c b/qgrep.c
index 982672d..de018ea 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -371,9 +371,9 @@ int qgrep_main(int argc, char **argv)
/* go look either in ebuilds or eclasses or VDB */
if (!do_eclass && !do_installed) {
- initialize_ebuild_flat(); /* sets our pwd to $PORTDIR */
- if ((fp = fopen(CACHE_EBUILD_FILE, "r")) == NULL)
+ if ((fp = fopen(initialize_ebuild_flat(), "r")) == NULL)
return 1;
+ xchdir(portdir);
} else if (do_eclass) {
xchdir(portdir);
if ((eclass_dir = opendir("eclass")) == NULL)
diff --git a/qpkg.c b/qpkg.c
index 5b63ec2..50d79f6 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -122,19 +122,7 @@ int qpkg_clean(char *dirp)
}
if (eclean) {
- char fname[_Q_PATH_MAX] = "";
- const char *ecache;
-
- /* CACHE_EBUILD_FILE is a macro so don't put it in the .bss */
- ecache = CACHE_EBUILD_FILE;
-
- if (ecache) {
- if (*ecache != '/')
- snprintf(fname, sizeof(fname), "%s/%s",
portdir, ecache);
- else
- strncpy(fname, ecache, sizeof(fname));
- }
- if ((fp = fopen(fname, "r")) != NULL) {
+ if ((fp = fopen(initialize_ebuild_flat(), "r")) != NULL) {
size_t buflen;
char *buf;