Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 107120 Details for
Bug 154405
app-portage/portage-utils: add overlays support
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
portage2paludis.patch
portage2paludis.patch (text/plain), 45.42 KB, created by
samLT
on 2007-01-15 20:42:57 UTC
(
hide
)
Description:
portage2paludis.patch
Filename:
MIME Type:
Creator:
samLT
Created:
2007-01-15 20:42:57 UTC
Size:
45.42 KB
patch
obsolete
>diff -Narup portage-utils-20070115.new/applet-list portage-utils-20070115.NEW/applet-list >--- portage-utils-20070115.new/applet-list 2007-01-15 19:21:05.018065247 +0100 >+++ portage-utils-20070115.NEW/applet-list 2007-01-15 19:23:12.275651305 +0100 >@@ -1,15 +1,11 @@ > qatom >-qcache > qcheck > qdepends > qfile >-qglsa > qgrep > qlist > qlop >-qmerge > qpkg >-qpy > qsearch > qsize > qtbz2 >diff -Narup portage-utils-20070115.new/applets.h portage-utils-20070115.NEW/applets.h >--- portage-utils-20070115.new/applets.h 2007-01-15 19:21:05.009066620 +0100 >+++ portage-utils-20070115.NEW/applets.h 2007-01-15 19:23:12.284649932 +0100 >@@ -29,9 +29,9 @@ DECLARE_APPLET(qxpak) > DECLARE_APPLET(qpkg) > DECLARE_APPLET(qgrep) > DECLARE_APPLET(qatom) >-DECLARE_APPLET(qmerge) >-DECLARE_APPLET(qcache) >-DECLARE_APPLET(qpy) >+DECLARE_APPLET(qmerge) /* disable */ >+DECLARE_APPLET(qcache) /* disable */ >+DECLARE_APPLET(qpy) /* disable */ > DECLARE_APPLET(qglsa) /* disable */ > #undef DECLARE_APPLET > >@@ -49,22 +49,22 @@ struct applet_t { > /* q must always be the first applet */ > {"q", q_main, "<applet> <args>", "virtual applet"}, > {"qatom", qatom_main, "<pkg>", "split atom strings"}, >- {"qcache", qcache_main, "<action> <args>", "search the metadata cache"}, > {"qcheck", qcheck_main, "<pkgname>", "verify mtimes/digests"}, > {"qdepends", qdepends_main, "<pkgname>", "show dependency info"}, > {"qfile", qfile_main, "<filename>", "list all pkgs owning files"}, >- {"qglsa", qglsa_main, "<action> <list>", "check GLSAs against system"}, > {"qgrep", qgrep_main, "<misc args>", "grep in ebuilds"}, > {"qlist", qlist_main, "<pkgname>", "list files owned by pkgname"}, > {"qlop", qlop_main, "<pkgname>", "emerge log analyzer"}, >- {"qmerge", qmerge_main, "<pkgnames>", "fetch and merge binary package"}, > {"qpkg", qpkg_main, "<misc args>", "manipulate Gentoo binpkgs"}, >- {"qpy", qpy_main, "<misc args>", "python interface"}, > {"qsearch", qsearch_main, "<regex>", "search pkgname/desc"}, > {"qsize", qsize_main, "<pkgname>", "calculate size usage"}, > {"qtbz2", qtbz2_main, "<misc args>", "manipulate tbz2 packages"}, > {"quse", quse_main, "<useflag>", "find pkgs using useflags"}, > {"qxpak", qxpak_main, "<misc args>", "manipulate xpak archives"}, >+ {"qcache", qcache_main, "<action> <args>", NULL}, /* "search the metadata cache" */ >+ {"qglsa", qglsa_main, "<action> <list>", NULL}, /* "check GLSAs against system" */ >+ {"qmerge", qmerge_main, "<pkgnames>", NULL}, /* "fetch and merge binary package" */ >+ {"qpy", qpy_main, "<misc args>", NULL}, /* "python interface" */ > > > /* aliases for equery capatability */ >diff -Narup portage-utils-20070115.new/main.c portage-utils-20070115.NEW/main.c >--- portage-utils-20070115.new/main.c 2007-01-15 19:21:58.257943170 +0100 >+++ portage-utils-20070115.NEW/main.c 2007-01-15 19:23:12.293648559 +0100 >@@ -71,9 +71,8 @@ int rematch(const char *, const char *, > static char *rmspace(char *); > > void initialize_portage_env(void); >-void initialize_overlays (char portdir_overlay[]); >-void initialize_ebuild_flat(void); >-void reinitialize_ebuild_flat(void); >+void initialize_overlays(void); >+void reinitialize_ebuild_flat(short force); > void reinitialize_as_needed(void); > void cleanup(void); > int lookup_applet_idx(const char *); >@@ -86,11 +85,13 @@ static int quiet = 0; > static char pretend = 0; > static char reinitialize = 0; > static char reinitialize_metacache = 0; >-static char portarch[20] = ""; >-static char portvdb[_Q_PATH_MAX] = "var/db/pkg"; >-static char portcachedir[] = "metadata/cache"; >-static char portroot[_Q_PATH_MAX] = "/"; >-static char config_protect[_Q_PATH_MAX] = "/etc/"; >+/* static char portarch[20] = ""; */ >+static char portvdb[_Q_PATH_MAX] = ""; >+static char cache_file_dir[_Q_PATH_MAX]="var/cache/paludis"; >+static char metacache_file_dir[_Q_PATH_MAX]="var/cache/paludis/metadata"; >+static char repocachedir[] = "metadata/cache"; >+static char portroot[_Q_PATH_MAX] = ""; >+/* static char config_protect[_Q_PATH_MAX] = "/etc/"; */ > > typedef struct overlay_t overlay_t; > struct overlay_t { >@@ -101,11 +102,10 @@ struct overlay_t { > }; > > static overlay_t *first_overlay = NULL; >-/* temporary workaround ? */ > static overlay_t *overlay_gentoo = NULL; > >-char pkgdir[512] = "/usr/portage/packages/"; >-char port_tmpdir[512] = "/var/tmp/portage/"; >+char pkgdir[512] = "/var/paludis/repositories/gentoo/packages/"; >+char port_tmpdir[512] = "/var/tmp/paludis/"; > > char binhost[512] = PORTAGE_BINHOST; > char features[512] = "noman noinfo nodoc"; >@@ -227,7 +227,8 @@ static void version_barf(const char *Id) > # define VERSION "cvs" > #endif > printf("portage-utils-%s: compiled on %s\n%s\n" >- "%s written for Gentoo by <solar and vapier @ gentoo.org>\n", >+ "%s written for Gentoo by <solar and vapier @ gentoo.org>\n" >+ "modified for overlay and paludis compatibility by samuelethiec @ hotmail.com\n", > VERSION, __DATE__, Id, argv0); > exit(EXIT_SUCCESS); > } >@@ -479,74 +480,196 @@ char *strincr_var(const char *name, char > return (char *) value; > } > >-void initialize_overlays (char portdir_overlay[]) >+void initialize_overlays(void) > { >- short merror = 0; >- char buf[BUFSIZE], file[_Q_PATH_MAX], *s, *p, *t; >- overlay_t *cur_overlay; >- FILE *repo_nameFP; >- s = portdir_overlay; >+ short merror = 0, first = 1; >+ int i,j; >+ char *s, *p, *t; >+ char buf[BUFSIZE], conffile[_Q_PATH_MAX], confdir[_Q_PATH_MAX], path[_Q_PATH_MAX]; >+ char location[_Q_PATH_MAX], write_cache[_Q_PATH_MAX], cache[_Q_PATH_MAX], format[32]; >+ FILE *CONFFILE, *REPO_NAME; >+ DIR *CONFDIR; >+ struct dirent *f; >+ struct stat statcache; >+ overlay_t *cur_overlay; >+ >+ struct { >+ const char *name; >+ const size_t name_len; >+ char *value; >+ const size_t value_len; >+ } vars_to_read[] = { >+ /* order is important */ >+ {"ROOT", 4, portroot, sizeof(portroot)}, >+ {"location", 8, location, sizeof(location)}, >+ {"write_cache", 11, write_cache, sizeof(write_cache)}, >+ {"cache", 5, cache, sizeof(cache)}, >+ {"format", 6, format, sizeof(format)} >+ }; > > first_overlay = xmalloc(sizeof(*first_overlay)); >- cur_overlay = first_overlay; >+ cur_overlay = first_overlay; > >- while (*s) { >- /* except on the first loop */ >- if (s!=portdir_overlay) { >- cur_overlay->next = xmalloc (sizeof (*cur_overlay->next)); >- cur_overlay = cur_overlay->next; >+ snprintf(confdir, sizeof(confdir), "%s/etc/paludis/repositories", portroot); >+ >+ if (NULL == (CONFDIR = opendir(confdir))) >+ err("%s : could not open directory", confdir); >+ >+ while ((f = readdir(CONFDIR))) { >+ location[0] = 0; >+ cache[0] = 0; >+ write_cache[0] = 0; >+ format[0] = 0; >+ >+ if (f->d_name[0] == '.') >+ continue; >+ >+ snprintf(conffile, sizeof(conffile), "%s/%s", confdir, f->d_name); >+ >+ if (NULL == (CONFFILE = fopen(conffile, "r"))) >+ continue; >+ merror = 0; >+ >+ while (fgets(buf, sizeof(buf), CONFFILE )) { >+ rmspace(buf); >+ if (*buf == '#' || *buf == '\0') >+ continue; >+ for (i=1; i<ARR_SIZE(vars_to_read); ++i) { >+ if (buf[vars_to_read[i].name_len] != '=' && buf[vars_to_read[i].name_len] != ' ') >+ continue; >+ if (strncmp(buf, vars_to_read[i].name, vars_to_read[i].name_len)) >+ continue; >+ >+ /* make sure we handle spaces between the varname, the =, and the value: >+ * VAR=val VAR = val VAR="val" >+ */ >+ s = buf + vars_to_read[i].name_len; >+ if ((p = strchr(s, '=')) != NULL) >+ s = p + 1; >+ while (isspace(*s)) >+ ++s; >+ if (*s == '"' || *s == '\'') { >+ ++s; >+ s[strlen(s)-1] = '\0'; >+ } >+ >+ strncpy(vars_to_read[i].value, s, vars_to_read[i].value_len); >+ } >+ } >+ fclose(CONFFILE); >+ >+ if (!format[0]) >+ continue; >+ >+ /* delete trailing '/' */ >+ for (i=0; i<ARR_SIZE(vars_to_read); ++i) { >+ if ((p = strrchr(vars_to_read[i].value, '/')) && (p+1) && *(p+1)==0) >+ *p = 0; > } >- cur_overlay->next = NULL; > >- if ((p=strchr(s,' '))) >- *p = 0; >+ if (strncmp(format, "ebuild", sizeof(format)) && strncmp(format, "vdb", sizeof(format))) >+ continue; > >- snprintf(cur_overlay->path, sizeof(cur_overlay->path), "%s%s", (strcmp(portroot, "/") ? portroot : ""), s); >+ /* if the path begins with a variable such as ${ROOT}, $ROOT, or $location and so on >+ * we try to replace it with its value */ >+ for (i=1; i<ARR_SIZE(vars_to_read); ++i) { >+ path[0] = 0; >+ if (vars_to_read[i].value[0] == '$') { >+ p = strchr(vars_to_read[i].value, '/'); >+ *p = 0; >+ >+ if (vars_to_read[i].value[1]=='{' && *(p-1)=='}') { >+ *(p-1) = 0; >+ s = &vars_to_read[i].value[2]; >+ } else >+ s = &vars_to_read[i].value[1]; >+ >+ for (j=0; j<ARR_SIZE(vars_to_read); ++j) >+ if (!strcmp(s, vars_to_read[j].name)) { >+ strcpy(path, vars_to_read[j].value); >+ break; >+ } > >- /* find the name for the overlay */ >- snprintf(file, sizeof(file), "%s/profiles/repo_name", cur_overlay->path); >+ /* put the slash back */ >+ *p = '/'; >+ strncat(path, p, sizeof(path)); >+ strcpy(vars_to_read[i].value, path); >+ } >+ } > >- if ((repo_nameFP = fopen(file, "r"))) { >- if (!(fgets(buf, sizeof(buf),repo_nameFP))) >- merror++; >- rmspace(buf); >- if ((t = strchr(buf,'\n'))) >- *t = 0; >- strncpy(cur_overlay->name, buf, sizeof(cur_overlay->name)); >+ /* vdb location defined in etc/paludis/repositories/installed.conf */ >+ if (!strcmp("installed.conf", f->d_name) && !strcmp("vdb", format)) { >+ strncpy(portvdb, location, sizeof(portvdb)); >+ continue; >+ } > >- fclose(repo_nameFP); >- } else >- merror++; >- >- if (merror) { >- /* delete trailing '/' */ >- t = cur_overlay->path + strlen(cur_overlay->path) - 1; >- if (*t == '/') >- *t = 0; >- strncpy(file, cur_overlay->path, sizeof(file)); >- strncpy(cur_overlay->name, basename(file), sizeof(cur_overlay->name)); >- merror=0; >+ if (!first) { >+ cur_overlay->next = xmalloc(sizeof(*(cur_overlay->next))); >+ cur_overlay = cur_overlay->next; > } >+ cur_overlay->next = NULL; >+ cur_overlay->cache[0] = 0; > >- if (!strncmp(cur_overlay->name, "gentoo", sizeof(cur_overlay->name))) { >- snprintf(cur_overlay->cache, sizeof(cur_overlay->cache), "%s/%s", cur_overlay->path, portcachedir); >+ /* time to search for the overlay->name */ >+ snprintf(conffile, sizeof(conffile), "%s/profiles/repo_name", location); >+ if (NULL != (REPO_NAME = fopen(conffile, "r"))) { >+ if (!(fgets(buf, sizeof(buf),REPO_NAME))) >+ merror++; >+ rmspace(buf); >+ if ((t = strchr(buf,'\n'))) >+ *t = 0; >+ >+ strncpy(cur_overlay->name, buf, sizeof(cur_overlay->name)); >+ fclose(REPO_NAME); >+ } else { >+ strcpy(cur_overlay->name, "x-"); >+ /* there is no trailing '/' */ >+ if ((p=strrchr(location,'/'))) >+ p = p+1; >+ else >+ p = location; >+ strncat(cur_overlay->name, p, sizeof(cur_overlay->name)); >+ } >+ >+ if (!strcmp(cur_overlay->name, "gentoo")) > overlay_gentoo = cur_overlay; >- } else >+ >+ strncpy(cur_overlay->path, location, sizeof(cur_overlay->path)); >+ >+ if (!cache[0]) >+ snprintf(cache, sizeof(cache), "%s/%s", location, repocachedir); >+ >+ /* now we fill cur_overlay->cache */ >+ if (!strstr(cache, "/var/empty")) { >+ if (stat(cache, &statcache) != -1 && S_ISDIR(statcache.st_mode)) >+ strcpy(cur_overlay->cache, cache); >+ else { >+ if (*write_cache) { >+ snprintf(cache, sizeof(cache), "%s/%s", write_cache, cur_overlay->name); >+ if (stat(cache, &statcache) != -1 && S_ISDIR(statcache.st_mode)) >+ strncpy(cur_overlay->cache, cache, sizeof(cur_overlay->cache)); >+ else >+ strncpy(cur_overlay->cache, "/var/empty", sizeof(cur_overlay->cache)); >+ } else >+ strncpy(cur_overlay->cache, "/var/empty", sizeof(cur_overlay->cache)); >+ } >+ } else > strcpy(cur_overlay->cache, "/var/empty"); > >- if (p) >- s = p+1; /* because portdir_overlay has no trailing space */ >- else >- break; >+ /* once we get there we have at least done with the first overlay */ >+ if (first) >+ first = 0; > } >- >+ closedir(CONFDIR); > } > >- > void initialize_portage_env(void) > { > char nocolor = 0; >- int i, f; >+ int i; >+ char *s; >+ char tmp[_Q_PATH_MAX]; >+/* > struct stat st; > FILE *fp; > char tmp_portdir[_Q_PATH_MAX]; >@@ -556,6 +679,7 @@ void initialize_portage_env(void) > char portdir_overlay[BUFSIZE] = ""; > > const char *files[] = {portage_file, "/etc/make.globals", "/etc/make.conf"}; >+*/ > typedef enum { _Q_BOOL, _Q_STR, _Q_ISTR } var_types; > > struct { >@@ -565,7 +689,7 @@ void initialize_portage_env(void) > char *value; > const size_t value_len; > } vars_to_read[] = { >- {"ACCEPT_LICENSE", 14, _Q_STR, accept_license, sizeof(accept_license)}, >+/* {"ACCEPT_LICENSE", 14, _Q_STR, accept_license, sizeof(accept_license)}, > {"INSTALL_MASK", 12, _Q_ISTR, install_mask, sizeof(install_mask)}, > {"ARCH", 4, _Q_STR, portarch, sizeof(portarch)}, > {"CONFIG_PROTECT", 14, _Q_STR, config_protect, sizeof(config_protect)}, >@@ -576,13 +700,11 @@ void initialize_portage_env(void) > {"PORTAGE_BINHOST", 15, _Q_STR, binhost, sizeof(binhost)}, > {"PORTAGE_TMPDIR", 14, _Q_STR, port_tmpdir, sizeof(port_tmpdir)}, > {"PKGDIR", 6, _Q_STR, pkgdir, sizeof(pkgdir)}, >+*/ > {"ROOT", 4, _Q_STR, portroot, sizeof(portroot)} > }; > >- if ((p = strchr(portroot, '/')) != NULL) >- if (strlen(p) != 1) >- strncat(portroot, "/", sizeof(portroot)); >- >+#if 0 > f = 0; > if (readlink("/etc/make.profile", profile, sizeof(profile)) == -1) > strcpy(profile, "/etc/make.profile"); >@@ -643,6 +765,7 @@ void initialize_portage_env(void) > f = 1; > } > } while (1); >+#endif > > /* finally, check the env */ > for (i=0; i<ARR_SIZE(vars_to_read); ++i) { >@@ -671,12 +794,12 @@ void initialize_portage_env(void) > else > color_remap(); > >- snprintf(tmp_portdir, sizeof(tmp_portdir), "%s/%s", (strcmp(portroot, "/") ? portroot : ""), portvdb); >- strncpy(portvdb, tmp_portdir, sizeof(portvdb)); >- strincr_var("PORTDIR_OVERLAY", tmp_portdir, portdir_overlay, sizeof(portdir_overlay)); >- >+ snprintf(tmp,sizeof(tmp),"%s/%s", portroot, cache_file_dir); >+ strcpy(cache_file_dir, tmp); >+ snprintf(tmp,sizeof(tmp),"%s/%s", portroot, metacache_file_dir); >+ strcpy(metacache_file_dir, tmp); > /* now we initiliase the overlay chained list */ >- initialize_overlays(portdir_overlay); >+ initialize_overlays(); > > } > >@@ -694,9 +817,9 @@ int filter_hidden(const struct dirent *d > } > > #define CACHE_EBUILD_FILE (getenv("CACHE_EBUILD_FILE") ? getenv("CACHE_EBUILD_FILE") : ".ebuild.x") >-#define CACHE_METADATA_FILE ".metadata.x" >-const char *initialize_flat(int cache_type); >-const char *initialize_flat(int cache_type) >+#define CACHE_METADATA_FILE (getenv("CACHE_METADATA_FILE") ? getenv("CACHE_METADATA_FILE") : ".metadata.x") >+const char *initialize_flat(int cache_type, short force); >+const char *initialize_flat(int cache_type, short force) > { > struct dirent **category, **pn, **eb; > struct stat st; >@@ -714,39 +837,37 @@ const char *initialize_flat(int cache_ty > > cache_file = (cache_type == CACHE_EBUILD ? CACHE_EBUILD_FILE : CACHE_METADATA_FILE); > >- /* SAM review without gentoo! */ >- if (cache_type == CACHE_METADATA) { >- if (chdir(overlay_gentoo->cache) != 0) { >- warnp("chdir to portage cache '%s' failed", overlay_gentoo->cache); >- goto ret; >- } >- } else { >- if (chdir(overlay_gentoo->path) != 0) { >- warnp("chdir to PORTDIR '%s' failed", overlay_gentoo->path); >- goto ret; >- } >+ if (cache_type == CACHE_METADATA) { >+ if (chdir(metacache_file_dir) != 0) { >+ warnp("chdir to cache '%s' failed", metacache_file_dir); >+ goto ret; >+ } >+ } else { >+ if (chdir(cache_file_dir) != 0) { >+ warnp("chdir to '%s' failed", cache_file_dir); >+ goto ret; >+ } > } > >- if ((stat(cache_file, &st)) != (-1)) >- if (st.st_size == 0) >+ if ((stat(cache_file, &st)) != (-1)) { >+ if (force || st.st_size == 0) > unlink(cache_file); >+ else >+ goto ret; >+ } > >- /* assuming --sync is used with --delete this will get recreated after every merge */ >- if (access(cache_file, R_OK) == 0) >- goto ret; > if (!quiet) > warn("Updating ebuild %scache ... ", cache_type == CACHE_EBUILD ? "" : "meta"); > > unlink(cache_file); > if (errno != ENOENT) { >- /* SAM review without gentoo! */ >- warnfp("unlinking '%s/%s' failed", overlay_gentoo->path, cache_file); >+ warnfp("unlinking '%s/%s' failed", (cache_type == CACHE_EBUILD ? cache_file_dir : metacache_file_dir), cache_file); >+ warn("define CACHE_METADATA_FILE and/or CACHE_EBUILD_FILE to use different cache file"); > goto ret; > } > >- /* SAM review without gentoo! */ > if ((fp = fopen(cache_file, "w")) == NULL) { >- warnfp("opening '%s/%s' failed", (cache_type == CACHE_EBUILD ? overlay_gentoo->path : overlay_gentoo->cache), cache_file); >+ warnfp("opening '%s/%s' failed", (cache_type == CACHE_EBUILD ? cache_file_dir : metacache_file_dir), cache_file); > goto ret; > } > >@@ -799,6 +920,7 @@ const char *initialize_flat(int cache_ty > break; > case CACHE_METADATA: > if (S_ISREG(st.st_mode)) >+ count++; > fprintf(fp, "%s::%s\n", de, cur_overlay->name); > continue; > break; >@@ -842,25 +964,25 @@ const char *initialize_flat(int cache_ty > ret: > return cache_file; > } >-#define initialize_ebuild_flat() initialize_flat(CACHE_EBUILD) >-#define initialize_metadata_flat() initialize_flat(CACHE_METADATA) >+#define initialize_ebuild_flat(force) initialize_flat(CACHE_EBUILD, force) >+#define initialize_metadata_flat(force) initialize_flat(CACHE_METADATA, force) > >-void reinitialize_ebuild_flat(void) >+void reinitialize_ebuild_flat(short force) > { > if ((chdir(first_overlay->path)) != 0) { > warnp("chdir to PORTDIR '%s' failed", first_overlay->path); > return; > } > unlink(CACHE_EBUILD_FILE); >- initialize_ebuild_flat(); >+ initialize_ebuild_flat(force); > } > > void reinitialize_as_needed(void) > { > if (reinitialize) >- reinitialize_ebuild_flat(); >+ reinitialize_ebuild_flat(1); > if (reinitialize_metacache) >- initialize_metadata_flat(); >+ initialize_metadata_flat(1); > } > > typedef struct { >@@ -1039,7 +1161,7 @@ char *grab_vdb_item(const char *item, co > char *p; > FILE *fp; > >- snprintf(buf, sizeof(buf), "%s%s/%s/%s/%s", portroot, portvdb, CATEGORY, PF, item); >+ snprintf(buf, sizeof(buf), "%s/%s/%s/%s", portvdb, CATEGORY, PF, item); > if ((fp = fopen(buf, "r")) == NULL) > return NULL; > fgets(buf, sizeof(buf), fp); >@@ -1070,9 +1192,6 @@ queue *get_vdb_atoms(void) > > assert(chdir(savecwd) == 0); > >- if (chdir(portroot) != 0) >- goto fuckit; >- > if (chdir(portvdb) != 0) > goto fuckit; > >@@ -1167,3 +1286,5 @@ int main(int argc, char **argv) > } > > #include "include_applets.h" >+/* vim: set noet sts=8 sw=8 : */ >+ >diff -Narup portage-utils-20070115.new/man/qlop.1 portage-utils-20070115.NEW/man/qlop.1 >--- portage-utils-20070115.new/man/qlop.1 2007-01-15 19:21:05.013066011 +0100 >+++ portage-utils-20070115.NEW/man/qlop.1 2007-01-15 19:23:12.301647339 +0100 >@@ -5,7 +5,7 @@ qlop \- emerge log analyzer > .B qlop > \fI<pkgname>\fR > .SH DESCRIPTION >-Options: \fB\-[gtluscf:F:HvqChV]\fR >+Options: \fB\-[gtluso:cf\fR:F:HvqChV] > .TP > \fB\-g\fR, \fB\-\-gauge\fR > * Gauge number of times a package has been merged >@@ -25,6 +25,11 @@ Options: \fB\-[gtluscf:F:HvqChV]\fR > \fB\-s\fR, \fB\-\-sync\fR > * Show sync history > .TP >+\fB\-o\fR, \fB\-\-overlay\fR >+<arg> >+.BR >+* Only consider the <arg> overlay >+.TP > \fB\-c\fR, \fB\-\-current\fR > * Show current emerging packages > .TP >diff -Narup portage-utils-20070115.new/q.c portage-utils-20070115.NEW/q.c >--- portage-utils-20070115.new/q.c 2007-01-15 19:21:58.309935238 +0100 >+++ portage-utils-20070115.NEW/q.c 2007-01-15 19:23:12.309646119 +0100 >@@ -145,3 +145,5 @@ int q_main(int argc, char **argv) > > return (func)(argc - 1, ++argv); > } >+/* vim: set noet sts=8 sw=8 : */ >+ >diff -Narup portage-utils-20070115.new/qfile.c portage-utils-20070115.NEW/qfile.c >--- portage-utils-20070115.new/qfile.c 2007-01-15 19:21:58.336931120 +0100 >+++ portage-utils-20070115.NEW/qfile.c 2007-01-15 19:23:12.318644746 +0100 >@@ -543,11 +543,6 @@ int qfile_main(int argc, char **argv) > if ((args_file == NULL) && (max_args != QFILE_DEFAULT_MAX_ARGS)) > warn("--max-args is only used when reading arguments from a file (with -f)"); > >- if (chdir(portroot)) { >- warnp("could not chdir(%s) for ROOT", portroot); >- goto exit; >- } >- > if (chdir(portvdb) != 0) { > warnp("could not chdir(ROOT/%s) for installed packages database", portvdb); > goto exit; >diff -Narup portage-utils-20070115.new/qfile.c.orig portage-utils-20070115.NEW/qfile.c.orig >--- portage-utils-20070115.new/qfile.c.orig 2007-01-15 19:21:05.010066468 +0100 >+++ portage-utils-20070115.NEW/qfile.c.orig 2007-01-15 19:23:02.708110894 +0100 >@@ -600,16 +600,14 @@ int qfile_main(int argc, char **argv) > if (nb_of_queries < 0) > goto exit; > >- if (chdir(portroot) >- || chdir(portvdb) != 0 >- || (dir = opendir(".")) == NULL) { >- warnp("could not chdir(ROOT/%s) for installed packages database", portvdb); >+ if (chdir(portvdb) != 0 || (dir = opendir(".")) == NULL) { >+ warnp("could not chdir(%s) for installed packages database", portvdb); > goto exit; > } > > /* Iteration over VDB categories */ > while (nb_of_queries && (dentry = q_vdb_get_next_dir(dir))) { >- snprintf(path, _Q_PATH_MAX, "%s/%s/%s", qfile_args->real_root, portvdb, dentry->d_name); >+ snprintf(path, _Q_PATH_MAX, "%s/%s", portvdb, dentry->d_name); > qfile(path, (assume_root_prefix ? root_prefix : NULL), qfile_args); > } > >diff -Narup portage-utils-20070115.new/qgrep.c portage-utils-20070115.NEW/qgrep.c >--- portage-utils-20070115.new/qgrep.c 2007-01-15 19:21:58.343930052 +0100 >+++ portage-utils-20070115.NEW/qgrep.c 2007-01-15 19:23:12.326643526 +0100 >@@ -90,7 +90,7 @@ int qgrep_main(int argc, char **argv) > if (argc == optind) > qgrep_usage(EXIT_FAILURE); > >- initialize_ebuild_flat(); /* sets our pwd to $PORTDIR */ >+ initialize_ebuild_flat(0); /* sets our pwd to $PORTDIR */ > > if ((fp = fopen(CACHE_EBUILD_FILE, "r")) == NULL) > return 1; >@@ -191,3 +191,5 @@ int qgrep_main(int argc, char **argv) > #else > DEFINE_APPLET_STUB(qgrep) > #endif >+/* vim: set noet sts=8 sw=8 : */ >+ >diff -Narup portage-utils-20070115.new/qlist.c portage-utils-20070115.NEW/qlist.c >--- portage-utils-20070115.new/qlist.c 2007-01-15 19:21:05.010066468 +0100 >+++ portage-utils-20070115.NEW/qlist.c 2007-01-15 19:23:12.335642152 +0100 >@@ -137,6 +137,7 @@ int qlist_main(int argc, char **argv) > char qlist_all = 0, just_pkgname = 0, dups_only = 0; > char show_dir, show_obj, show_sym, show_slots, show_umap; > struct dirent **de, **cat; >+ char overlay[64]; > char buf[_Q_PATH_MAX]; > char swap[_Q_PATH_MAX]; > queue *sets = NULL; >@@ -146,6 +147,7 @@ int qlist_main(int argc, char **argv) > argc, argv[0], argc > 1 ? argv[1] : "NULL?"); > > show_dir = show_obj = show_sym = show_slots = show_umap = 0; >+ overlay[0] = 0; > > while ((i = GETOPT_LONG(QLIST, qlist, "")) != -1) { > switch (i) { >@@ -168,12 +170,8 @@ int qlist_main(int argc, char **argv) > if ((argc == optind) && (!just_pkgname)) > qlist_usage(EXIT_FAILURE); > >- if (chdir(portroot)) >- errp("could not chdir(%s) for ROOT", portroot); >- > if (chdir(portvdb) != 0) >- return EXIT_FAILURE; >- >+ errp("could not chdir(%s) for VDB", portvdb); > > if ((dfd = scandir(".", &cat, filter_hidden, alphasort)) < 0) > return EXIT_FAILURE; >@@ -223,6 +221,9 @@ int qlist_main(int argc, char **argv) > if ((i == argc) && (argc != optind)) > continue; > >+ if (verbose>1) >+ snprintf(overlay, sizeof(overlay), "::%s",grab_vdb_item("REPOSITORY", cat[j]->d_name, de[x]->d_name)); >+ > if (just_pkgname) { > if (dups_only) { > pkgname = atom_explode(de[x]->d_name); >@@ -241,9 +242,10 @@ int qlist_main(int argc, char **argv) > slot = grab_vdb_item("SLOT", cat[j]->d_name, de[x]->d_name); > > /* display it */ >- printf("%s%s/%s%s%s%s%s%s%s", BOLD, cat[j]->d_name, BLUE, >+ printf("%s%s/%s%s%s%s%s%s%s%s%s", BOLD, cat[j]->d_name, BLUE, > (pkgname ? pkgname->PN : de[x]->d_name), NORM, >- YELLOW, slot ? " ": "", slot ? slot : "", NORM); >+ YELLOW, overlay, >+ RED, slot ? " ": "", slot ? slot : "", NORM); > puts(umapstr(show_umap, cat[j]->d_name, de[x]->d_name)); > } > if (pkgname) >@@ -253,7 +255,7 @@ int qlist_main(int argc, char **argv) > continue; > } > >- snprintf(buf, sizeof(buf), "%s%s/%s/%s/CONTENTS", portroot, portvdb, >+ snprintf(buf, sizeof(buf), "%s/%s/%s/CONTENTS", portvdb, > cat[j]->d_name, de[x]->d_name); > > if (verbose > 1) >@@ -311,9 +313,10 @@ int qlist_main(int argc, char **argv) > char *slot = NULL; > if (show_slots) > slot = (char *) grab_vdb_item("SLOT", (const char *) atom->CATEGORY, (const char *) atom->P); >- printf("%s%s/%s%s%s%s%s%s%s", BOLD, atom->CATEGORY, BLUE, >+ printf("%s%s/%s%s%s%s%s%s%s%s%s", BOLD, atom->CATEGORY, BLUE, > (verbose ? atom->P : atom->PN), NORM, >- YELLOW, slot ? " " : "", slot ? slot : "", NORM); >+ YELLOW, overlay, >+ RED, slot ? " " : "", slot ? slot : "", NORM); > puts(umapstr(show_umap, atom->CATEGORY, atom->P)); > } > atom_implode(atom); >diff -Narup portage-utils-20070115.new/qlop.c portage-utils-20070115.NEW/qlop.c >--- portage-utils-20070115.new/qlop.c 2007-01-15 19:21:05.011066315 +0100 >+++ portage-utils-20070115.NEW/qlop.c 2007-01-15 19:23:12.345640627 +0100 >@@ -21,11 +21,11 @@ > # include <sys/time.h> > #endif > >-#define QLOP_DEFAULT_LOGFILE "/var/log/emerge.log" >+#define QLOP_DEFAULT_LOGFILE "/var/log/paludis.log" > > > >-#define QLOP_FLAGS "gtluscf:F:H" COMMON_FLAGS >+#define QLOP_FLAGS "gtluso:cf:F:H" COMMON_FLAGS > static struct option const qlop_long_opts[] = { > {"gauge", no_argument, NULL, 'g'}, > {"time", no_argument, NULL, 't'}, >@@ -33,6 +33,7 @@ static struct option const qlop_long_opt > {"list", no_argument, NULL, 'l'}, > {"unlist", no_argument, NULL, 'u'}, > {"sync", no_argument, NULL, 's'}, >+ {"overlay", a_argument, NULL, 'o'}, > {"current", no_argument, NULL, 'c'}, > {"logfile", a_argument, NULL, 'f'}, > COMMON_LONG_OPTS >@@ -44,6 +45,7 @@ static const char *qlop_opts_help[] = { > "Show merge history", > "Show unmerge history", > "Show sync history", >+ "Do only consider the <arg> repository", > "Show current emerging packages", > "Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE, > COMMON_OPTS_HELP >@@ -79,30 +81,29 @@ static const char *chop_ctime(time_t t) > return ctime_out; > } > >-unsigned long show_merge_times(char *package, const char *logfile, int average, char human_readable); >-unsigned long show_merge_times(char *package, const char *logfile, int average, char human_readable) >+unsigned long show_merge_times(char *package, const short repo, const char repo_search[], const char *logfile, int average, char human_readable); >+unsigned long show_merge_times(char *package, const short repo, const char repo_search[], const char *logfile, int average, char human_readable) > { > FILE *fp; >- char cat[126], buf[2][BUFSIZ]; >- char *pkg, *p; >+ char catPN[BUFSIZ], buf[2][BUFSIZ], matched; >+ char *p, *q; > unsigned long count, merge_time; > time_t t[2]; >- depend_atom *atom; >+ depend_atom *atom,*search; >+ int l; >+ long pos; > > t[0] = t[1] = 0UL; > count = merge_time = 0; >- cat[0] = 0; >+ matched = 0; >+ pos = 0; > >- if ((p = strchr(package, '/')) != NULL) { >- pkg = p + 1; >- strncpy(cat, package, sizeof(cat)); >- if ((p = strchr(cat, '/')) != NULL) >- *p = 0; >- } else { >- pkg = package; >- } >+ if ((search = atom_explode(package)) == NULL ) >+ err("%s is not a valid atom", package); >+ if (!search->CATEGORY && !search->PN && !search->OVERLAY) >+ err("You need to specify at least an overlay, a category, or a package name"); > >- DBG("Searching for %s in %s\n", pkg, logfile); >+ DBG("Searching for %s in %s\n", package, logfile); > > if ((fp = fopen(logfile, "r")) == NULL) { > warnp("Could not open logfile '%s'", logfile); >@@ -110,7 +111,18 @@ unsigned long show_merge_times(char *pac > } > > while ((fgets(buf[0], sizeof(buf[0]), fp)) != NULL) { >- if (strstr(buf[0], pkg) == NULL) >+ if (matched) { >+ matched = 0; >+ continue; >+ } >+ /* len( time:{starting,finished} install of package ) = 41 */ >+ if (search->CATEGORY && !strstr(&buf[0][40], search->CATEGORY)) >+ continue; >+ >+ if (search->PN && !strstr(&buf[0][40], search->PN)) >+ continue; >+ >+ if (search->OVERLAY && !strstr(&buf[0][40], search->OVERLAY)) > continue; > > if ((p = strchr(buf[0], '\n')) != NULL) >@@ -121,80 +133,137 @@ unsigned long show_merge_times(char *pac > t[0] = atol(buf[0]); > strcpy(buf[1], p + 1); > rmspace(buf[1]); >- if ((strncmp(buf[1], ">>> emerge (", 12)) == 0) { >- char matched = 0; >- if ((p = strchr(buf[1], ')')) == NULL) >+ if ((strncmp(buf[1], "starting install of package", 26)) == 0) { >+ p = &buf[1][28]; >+ if (repo && !strstr(p, repo_search)) > continue; >- *p = 0; >- strcpy(buf[0], p + 1); >- rmspace(buf[0]); >- if ((p = strchr(buf[0], ' ')) == NULL) >+ >+ if ((q = strchr(p, ' ')) == NULL) > continue; >- *p = 0; >+ *q = 0; >+ >+ strcpy(buf[0], p); >+ rmspace(buf[0]); > if ((atom = atom_explode(buf[0])) == NULL) > continue; > >- if (*cat) { >- if ((strcmp(cat, atom->CATEGORY) == 0) && (strcmp(pkg, atom->PN) == 0)) >- matched = 1; >- } else if (strcmp(pkg, atom->PN) == 0) >- matched = 1; >+ if (search->CATEGORY && strcmp(atom->CATEGORY, search->CATEGORY)) { >+ atom_implode(atom); >+ continue; >+ } >+ >+ if (search->PN && *search->PN && strcmp(atom->PN, search->PN)) { >+ atom_implode(atom); >+ continue; >+ } >+ >+ if (search->PV && strcmp(atom->PV, search->PV)) { >+ atom_implode(atom); >+ continue; >+ } >+ >+ if (search->PR_int && atom->PR_int!=search->PR_int) { >+ atom_implode(atom); >+ continue; >+ } >+ >+ if (search->OVERLAY && strcmp(atom->OVERLAY, search->OVERLAY)) { >+ atom_implode(atom); >+ continue; >+ } >+ pos = ftell(fp); >+ matched = 1; > > if (matched) { >- while ((fgets(buf[0], sizeof(buf[0]), fp)) != NULL) { >+ /* In case of simultaneous install, we search the corresponding */ >+ /* "finished install of package" pkg up to 20 lines after the 'starting line' */ >+ l=0; >+ snprintf(catPN, sizeof(catPN), "%s/%s-%s::%s", atom->CATEGORY, atom->PN, (atom->PR_int ? atom->PVR : atom->PV), atom->OVERLAY); >+ while ((fgets(buf[0], sizeof(buf[0]), fp)) != NULL && l++ < 20) { >+ if ((p = strchr(buf[0],':')) == NULL) >+ continue; >+ p = p+2; >+ >+ /* Stop the search in case the package is already being reinstalled even in a different version/revision */ >+ if (!strncmp(p, "starting", 8) && strcmp(p+28, catPN)) >+ break; >+ >+ if (strncmp(p, "finished install of package", 26) != 0) >+ continue; >+ if (!strcmp(p+28, catPN)) >+ continue; >+ > if ((p = strchr(buf[0], '\n')) != NULL) > *p = 0; > if ((p = strchr(buf[0], ':')) == NULL) >- continue; >- *p = 0; >+ *p = 0; > t[1] = atol(buf[0]); > strcpy(buf[1], p + 1); > rmspace(buf[1]); >- if (*buf[1] == '*') >- break; >- if ((strncmp(buf[1], "::: completed emerge (", 22)) == 0) { >- if (!average) { >- strcpy(buf[1], ""); >- if (verbose) { >- if (atom->PR_int) >- snprintf(buf[1], sizeof(buf[1]), "-%s-r%i", atom->PV, atom->PR_int); >- else >- snprintf(buf[1], sizeof(buf[1]), "-%s", atom->PV); >- } >- printf("%s%s%s%s: %s: ", BLUE, atom->PN, buf[1], NORM, chop_ctime(t[0])); >- if (human_readable) >- print_seconds_for_earthlings(t[1] - t[0]); >- else >- printf("%s%lu%s seconds", GREEN, (t[1] - t[0]), NORM); >- puts(""); >- } >- merge_time += (t[1] - t[0]); >- count++; >- break; >+ >+ if (!average) { >+ strcpy(buf[1], ""); >+ if (verbose) >+ snprintf(buf[1], sizeof(buf[1]), "-%s%s::%s ", (atom->PR_int ? atom->PVR : atom->PV), YELLOW, atom->OVERLAY); >+ >+ printf("%s%s/%s%s%s%s: %s: ", GREEN, atom->CATEGORY, BLUE, atom->PN, buf[1], NORM, chop_ctime(t[0])); >+ if (human_readable) >+ print_seconds_for_earthlings(t[1] - t[0]); >+ else >+ printf("%s%lu%s seconds", GREEN, (t[1] - t[0]), NORM); >+ puts(""); > } >+ merge_time += (t[1] - t[0]); >+ count++; >+ break; >+ > } > } > atom_implode(atom); >+ /* time to go back where we were */ >+ fseek(fp, pos, SEEK_SET); > } > } > fclose(fp); > if (count == 0) > return 0; > if (average == 1) { >- printf("%s%s%s: ", BLUE, pkg, NORM); >+ printf("%s%s%s%s%s%s%s%s%s%s%s : ", GREEN, (search->CATEGORY? search->CATEGORY : ""), (search->CATEGORY ? "/": ""), >+ BLUE, search->PN, (search->PV ? "-" : ""), (search->PV ? (search->PR_int ? search->PVR : search->PV) : ""), >+ YELLOW, (search->OVERLAY ? "::" : ""), (search->OVERLAY ? search->OVERLAY : ""), NORM); > if (human_readable) > print_seconds_for_earthlings(merge_time / count); > else >- printf("%s%lu%s seconds average", GREEN, merge_time / count, NORM); >- printf(" for %s%lu%s merges\n", GREEN, count, NORM); >+ printf("%s%lu%s seconds", GREEN, merge_time / count, NORM); >+ printf(" average for %s%lu%s merges%s", GREEN, count, NORM, (verbose ? ", for a total time of " : "")); >+ >+ if (verbose) { >+ if (human_readable) >+ print_seconds_for_earthlings(merge_time); >+ else >+ printf("%s%lu%s seconds", GREEN, merge_time, NORM); >+ } >+ fputc('\n', stdout); > } else { >- printf("%s%s%s: %s%lu%s times\n", BLUE, pkg, NORM, GREEN, count, NORM); >+ printf("%s%s%s%s%s%s%s%s%s%s%s : %s%lu%s times%s", GREEN, (search->CATEGORY ? search->CATEGORY : ""), (search->CATEGORY ? "/": ""), >+ BLUE, (search->PN ? search->PN : ""), (search->PV ? "-" : ""), (search->PV ? (search->PR_int ? search->PVR : search->PV) : ""), >+ YELLOW, (search->OVERLAY ? "::" : ""), (search->OVERLAY ? search->OVERLAY : ""), >+ NORM, GREEN, count, NORM, >+ (verbose ? ", for a total time of " : "")); >+ if (verbose) { >+ if (human_readable) >+ print_seconds_for_earthlings(merge_time); >+ else >+ printf("%s%lu%s seconds", GREEN, merge_time, NORM); >+ } >+ fputc('\n', stdout); > } >+ atom_implode(search); > return 0; > } > >-void show_emerge_history(char listflag, int argc, char **argv, const char *logfile); >-void show_emerge_history(char listflag, int argc, char **argv, const char *logfile) >+void show_emerge_history(char listflag, const short repo, const char repo_search[], int argc, char **argv, const char *logfile); >+void show_emerge_history(char listflag, const short repo, const char repo_search[], int argc, char **argv, const char *logfile) > { > FILE *fp; > char buf[BUFSIZ], merged; >@@ -222,23 +291,30 @@ void show_emerge_history(char listflag, > if ((p = strchr(buf, ':')) == NULL) > continue; > *p = 0; >- q = p + 3; >+ q = p + 2; > > t = (time_t) atol(buf); > >- if ((listflag & QLOP_LIST) && !strncmp(q, "::: completed emerge (", 22)) { >+ if ((listflag & QLOP_LIST) && !strncmp(q, "finished install of package", 25)) { > merged = 1; >- if ((p = strchr(q, ')')) == NULL) >- continue; >- q = p + 2; >+ p = strstr(q, "package"); >+ q = p + 1; > if ((p = strchr(q, ' ')) == NULL) > continue; >- *p = 0; >- } else if ((listflag & QLOP_UNLIST) && !strncmp(q, ">>> unmerge success: ", 21)) { >+ q = p + 1; >+ if (repo) { >+ if ((p = strstr(q, "::")) && strncmp(p+2, repo_search, sizeof(repo_search))) >+ continue; >+ } >+ } else if ((listflag & QLOP_UNLIST) && !strncmp(q, "finished uninstall of package", 29)) { > merged = 0; >- if ((p = strchr(q, ':')) == NULL) >+ p = strstr(q, "package"); >+ q = p + 1; >+ if ((p = strchr(q, ' ')) == NULL) > continue; >- q = p + 2; >+ q = p + 1; >+ if ((p = strchr(p, ':')) != NULL) >+ *p = 0; > } > else > continue; >@@ -258,8 +334,8 @@ void show_emerge_history(char listflag, > fclose(fp); > } > >-void show_sync_history(const char *logfile); >-void show_sync_history(const char *logfile) >+void show_sync_history(const char *logfile, const short repo, char repo_search[]); >+void show_sync_history(const char *logfile, const short repo, char repo_search[]) > { > FILE *fp; > char buf[BUFSIZ]; >@@ -274,7 +350,10 @@ void show_sync_history(const char *logfi > while ((fgets(buf, sizeof(buf), fp)) != NULL) { > if (strlen(buf) < 35) > continue; >- if (strncmp(buf+12, "=== Sync completed with", 23) != 0) >+ if (strncmp(buf+12, "finished sync", 13) != 0) >+ continue; >+ >+ if (repo && strstr(buf, repo_search) == NULL) > continue; > > if ((p = strchr(buf, '\n')) != NULL) >@@ -282,13 +361,13 @@ void show_sync_history(const char *logfi > if ((p = strchr(buf, ':')) == NULL) > continue; > *p = 0; >- q = p+2; >+ q = p+1; > > t = (time_t)atol(buf); > >- if ((p = strstr(q, "with")) == NULL) >+ if ((p = strstr(q, "repository")) == NULL) > continue; >- q = p + 5; >+ q = p + 11; > > printf("%s >>> %s%s%s\n", chop_ctime(t), GREEN, q, NORM); > } >@@ -304,10 +383,11 @@ void show_current_emerge(void) > pid_t pid; > char buf[BUFSIZE], bufstat[300]; > char path[50]; >- char *p, *q; >+ char *p, *q, *cat, *pnv; > unsigned long long start_time = 0; > double uptime_secs; > time_t start_date; >+ overlay_t *overlay_tmp; > > if ((proc = opendir("/proc")) == NULL) { > warnp("Could not open /proc"); >@@ -319,15 +399,43 @@ void show_current_emerge(void) > if ((pid = (pid_t)atol(de->d_name)) == 0) > continue; > >- /* portage renames the cmdline so the package name is first */ > snprintf(path, sizeof(path), "/proc/%i/cmdline", pid); > if (!eat_file(path, buf, sizeof(buf))) > continue; > >- if (buf[0] == '[' && (p = strchr(buf, ']')) != NULL && strstr(buf, "sandbox") != NULL) { >- *p = '\0'; >- p = buf+1; >- q = p + strlen(p) + 1; >+ if (! strncmp(buf, "sandbox", 7)) { >+ /* 0123456789012345678 */ >+ if (!(p = strstr(&buf[8],"paludis/ebuild.bash"))) >+ continue; >+ >+ q = p + 20; >+ if (*q != '/') >+ continue; >+ >+ /* >+ * ex: /var/paludis/repositories/local/category/package_name/package_name_version.ebuild >+ * expected: >+ * q cat 0 pnv >+ */ >+ if (q == (pnv=strrchr(q, '/'))) >+ continue; >+ *pnv = 0; >+ pnv++; >+ if (q == (cat=strrchr(q, '/'))) >+ continue; >+ *cat = 0; >+ if (q == (cat=strrchr(q, '/'))) >+ continue; >+ *cat = 0; >+ cat++; >+ overlay_tmp=first_overlay; >+ do { >+ if (!strcmp(q, overlay_tmp->path)) >+ break; >+ } while ((overlay_tmp=overlay_tmp->next)); >+ >+ if (NULL == overlay_tmp) >+ continue; > > /* open the stat file to figure out how long we have been running */ > snprintf(path, sizeof(path), "/proc/%i/stat", pid); >@@ -356,10 +464,10 @@ void show_current_emerge(void) > /* figure out when this thing started and then show it */ > start_date = time(0) - (uptime_secs - (start_time / HZ)); > printf( >- " %s*%s %s%s%s\n" >+ " %s*%s %s::%s%s%s/%s%s\n" > " started: %s%s%s\n" > " elapsed: ", /*%s%llu%s seconds\n",*/ >- BOLD, NORM, BLUE, p, NORM, >+ BOLD, YELLOW, overlay_tmp->name, NORM, BLUE, cat, pnv, NORM, > GREEN, chop_ctime(start_date), NORM); > print_seconds_for_earthlings(uptime_secs - (start_time / HZ)); > puts(NORM); >@@ -380,6 +488,10 @@ void show_current_emerge(void) > char *p, *q; > time_t start_date = 0; > >+ /* this would need to be written for paludis, but I don't really know *BSD */ >+ warn("You need to adapt the show_current_emerge(void) function for __FreeBSD__\n" >+ "this may be trivial, just do as in the __linux__ one, but as I can't test it, I didn't make it"); >+ > if (! (kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open"))) { > warnp("Could not open kvm: %s", kvm_geterr(kd)); > return; >@@ -433,12 +545,17 @@ int qlop_main(int argc, char **argv) > int i, average = 1; > char do_time, do_list, do_unlist, do_sync, do_current, do_human_readable = 0; > char *opt_logfile; >+ short repo; >+ char repo_search[64]; > const char *logfile = QLOP_DEFAULT_LOGFILE; >+ overlay_t *overlay_tmp; > > DBG("argc=%d argv[0]=%s argv[1]=%s", > argc, argv[0], argc > 1 ? argv[1] : "NULL?"); > > opt_logfile = NULL; >+ repo = 0; >+ repo_search[0] = 0; > do_time = do_list = do_unlist = do_sync = do_current = 0; > > while ((i = GETOPT_LONG(QLOP, qlop, "")) != -1) { >@@ -448,7 +565,14 @@ int qlop_main(int argc, char **argv) > case 't': do_time = 1; break; > case 'l': do_list = 1; break; > case 'u': do_unlist = 1; break; >- case 's': do_sync = 1; break; >+ case 's': >+ if (do_sync) err("Only use -s or -S once"); >+ do_sync = 1; >+ break; >+ case 'o': >+ repo = 1; >+ strncpy(repo_search, optarg, sizeof(repo_search)); >+ break; > case 'c': do_current = 1; break; > case 'g': do_time = 1; average = 0; break; > case 'H': do_human_readable = 1; break; >@@ -458,6 +582,16 @@ int qlop_main(int argc, char **argv) > break; > } > } >+ if (repo) { >+ overlay_tmp = first_overlay; >+ do { >+ if (!strncmp(overlay_tmp->name, repo_search, sizeof(overlay_tmp->name))) >+ break; >+ } while ((overlay_tmp=overlay_tmp->next)); >+ if (NULL == overlay_tmp) >+ err("%s : Unknown overlay, try 'q --ls-overlays'", repo_search); >+ } >+ > if (!do_list && !do_unlist && !do_time && !do_sync && !do_current) > qlop_usage(EXIT_FAILURE); > if (opt_logfile != NULL) >@@ -467,19 +601,19 @@ int qlop_main(int argc, char **argv) > argv += optind; > > if (do_list && do_unlist) >- show_emerge_history(QLOP_LIST | QLOP_UNLIST, argc, argv, logfile); >+ show_emerge_history(QLOP_LIST | QLOP_UNLIST, repo, repo_search,argc, argv, logfile); > else if (do_list) >- show_emerge_history(QLOP_LIST, argc, argv, logfile); >+ show_emerge_history(QLOP_LIST, repo, repo_search, argc, argv, logfile); > else if (do_unlist) >- show_emerge_history(QLOP_UNLIST, argc, argv, logfile); >+ show_emerge_history(QLOP_UNLIST, repo, repo_search, argc, argv, logfile); > if (do_current) > show_current_emerge(); > if (do_sync) >- show_sync_history(logfile); >+ show_sync_history(logfile, repo, repo_search); > > if (do_time) { > for (i = 0; i < argc; ++i) >- show_merge_times(argv[i], logfile, average, do_human_readable); >+ show_merge_times(argv[i], repo, repo_search, logfile, average, do_human_readable); > } > > if (opt_logfile) free(opt_logfile); >@@ -490,3 +624,5 @@ int qlop_main(int argc, char **argv) > #else > DEFINE_APPLET_STUB(qlop) > #endif >+/* vim: set noet sts=8 sw=8 : */ >+ >diff -Narup portage-utils-20070115.new/qsearch.c portage-utils-20070115.NEW/qsearch.c >--- portage-utils-20070115.new/qsearch.c 2007-01-15 19:21:58.353928527 +0100 >+++ portage-utils-20070115.NEW/qsearch.c 2007-01-15 19:23:12.353639407 +0100 >@@ -100,7 +100,7 @@ int qsearch_main(int argc, char **argv) > } > > last[0] = 0; >- fp = fopen(initialize_flat(search_cache), "r"); >+ fp = fopen(initialize_flat(search_cache, 0), "r"); > if (!fp) > return 1; > >@@ -137,7 +137,6 @@ int qsearch_main(int argc, char **argv) > if (chdir(cur_overlay->path) != 0) { > warnp("chdir to '%s' failed", cur_overlay->path); > myerror = 1; >- continue; > } else > bad_overlay = 0; > break; >@@ -145,7 +144,6 @@ int qsearch_main(int argc, char **argv) > if (chdir(cur_overlay->cache) != 0) { > warnp("chdir to '%s' failed, skipping the %s repository", cur_overlay->cache, cur_overlay->name); > myerror = 1; >- continue; > } else > bad_overlay = 0; > break; >@@ -154,7 +152,7 @@ int qsearch_main(int argc, char **argv) > myerror = 1; > strncpy(overlay_name, p+2, sizeof(overlay_name)); > } >- } else >+ } else > myerror++; > > if (myerror) { >@@ -271,3 +269,5 @@ no_cache_ebuild_match: > #else > DEFINE_APPLET_STUB(qsearch) > #endif >+/* vim: set noet sts=8 sw=8 : */ >+ >diff -Narup portage-utils-20070115.new/qsize.c portage-utils-20070115.NEW/qsize.c >--- portage-utils-20070115.new/qsize.c 2007-01-15 19:21:05.012066163 +0100 >+++ portage-utils-20070115.NEW/qsize.c 2007-01-15 19:23:12.362638035 +0100 >@@ -68,10 +68,10 @@ int qsize_main(int argc, char **argv) > if ((argc == optind) && !search_all) > qsize_usage(EXIT_FAILURE); > >- if (chdir(portroot)) >- errp("could not chdir(%s) for ROOT", portroot); >+ if (chdir(portvdb)) >+ errp("could not chdir(%s) for VDB", portvdb); > >- if (chdir(portvdb) != 0 || (dir = opendir(".")) == NULL) >+ if ((dir = opendir(".")) == NULL) > return EXIT_FAILURE; > > num_all_bytes = num_all_files = num_all_nonfiles = 0; >@@ -91,9 +91,9 @@ int qsize_main(int argc, char **argv) > > /* see if this cat/pkg is requested */ > if (!search_all) { >+ snprintf(buf, sizeof(buf), "%s/%s::%s", dentry->d_name, >+ de->d_name, grab_vdb_item("REPOSITORY", dentry->d_name, de->d_name)); > for (i = optind; i < argc; ++i) { >- snprintf(buf, sizeof(buf), "%s/%s", dentry->d_name, >- de->d_name); > if (rematch(argv[i], buf, REG_EXTENDED) == 0) > break; > if (rematch(argv[i], de->d_name, REG_EXTENDED) == 0) >@@ -103,7 +103,7 @@ int qsize_main(int argc, char **argv) > continue; > } > >- snprintf(buf, sizeof(buf), "%s%s/%s/%s/CONTENTS", portroot, portvdb, >+ snprintf(buf, sizeof(buf), "%s/%s/%s/CONTENTS", portvdb, > dentry->d_name, de->d_name); > if ((fp = fopen(buf, "r")) == NULL) > continue; >@@ -128,8 +128,9 @@ int qsize_main(int argc, char **argv) > num_all_files += num_files; > num_all_nonfiles += num_nonfiles; > if (!summary_only) { >- printf("%s%s/%s%s%s: %lu files, %lu non-files, ", BOLD, >- basename(dentry->d_name), BLUE, de->d_name, NORM, >+ printf("%s%s/%s%s%s::%s%s : %lu files, %lu non-files, ", BOLD, >+ basename(dentry->d_name), BLUE, de->d_name, >+ YELLOW, grab_vdb_item("REPOSITORY", dentry->d_name, de->d_name), NORM, > (unsigned long)num_files, > (unsigned long)num_nonfiles); > if (disp_units) >diff -Narup portage-utils-20070115.new/quse.c portage-utils-20070115.NEW/quse.c >--- portage-utils-20070115.new/quse.c 2007-01-15 19:21:58.361927307 +0100 >+++ portage-utils-20070115.NEW/quse.c 2007-01-15 19:23:12.370636815 +0100 >@@ -305,7 +305,7 @@ int quse_main(int argc, char **argv) > if (idx == -1) > return quse_describe_flag(optind, repo, repo_search, argc, argv); > >- initialize_ebuild_flat(); /* sets our pwd to $PORTDIR */ >+ initialize_ebuild_flat(0); /* sets our pwd to $PORTDIR */ > > search_len = strlen(search_vars[idx]); > assert(search_len < sizeof(buf0)); >@@ -523,3 +523,5 @@ int quse_main(int argc, char **argv) > #else > DEFINE_APPLET_STUB(quse) > #endif >+/* vim: set noet sts=8 sw=8 : */ >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 154405
:
101420
|
101495
|
101520
|
101575
|
101690
|
101699
|
101723
|
101730
|
101779
|
101954
|
102433
|
102434
|
104816
|
107119
|
107120
|
107183
|
107184
|
107450