Lines 71-76
int rematch(const char *, const char *,
Link Here
|
71 |
static char *rmspace(char *); |
71 |
static char *rmspace(char *); |
72 |
|
72 |
|
73 |
void initialize_portage_env(void); |
73 |
void initialize_portage_env(void); |
|
|
74 |
void initialize_overlays (char portdir_overlay[]); |
74 |
void initialize_ebuild_flat(void); |
75 |
void initialize_ebuild_flat(void); |
75 |
void reinitialize_ebuild_flat(void); |
76 |
void reinitialize_ebuild_flat(void); |
76 |
void reinitialize_as_needed(void); |
77 |
void reinitialize_as_needed(void); |
Lines 85-97
static int quiet = 0;
Link Here
|
85 |
static char pretend = 0; |
86 |
static char pretend = 0; |
86 |
static char reinitialize = 0; |
87 |
static char reinitialize = 0; |
87 |
static char reinitialize_metacache = 0; |
88 |
static char reinitialize_metacache = 0; |
88 |
static char portdir[_Q_PATH_MAX] = "/usr/portage"; |
|
|
89 |
static char portarch[20] = ""; |
89 |
static char portarch[20] = ""; |
90 |
static char portvdb[] = "var/db/pkg"; |
90 |
static char portvdb[] = "var/db/pkg"; |
91 |
static char portcachedir[] = "metadata/cache"; |
91 |
static char portcachedir[] = "metadata/cache"; |
92 |
static char portroot[_Q_PATH_MAX] = "/"; |
92 |
static char portroot[_Q_PATH_MAX] = "/"; |
93 |
static char config_protect[_Q_PATH_MAX] = "/etc/"; |
93 |
static char config_protect[_Q_PATH_MAX] = "/etc/"; |
94 |
|
94 |
|
|
|
95 |
typedef struct overlay_t overlay_t; |
96 |
struct overlay_t { |
97 |
char name[64]; |
98 |
char path[_Q_PATH_MAX]; |
99 |
struct overlay_t *next; |
100 |
}; |
101 |
|
102 |
static overlay_t *overlay_gentoo = NULL; |
103 |
|
95 |
char pkgdir[512] = "/usr/portage/packages/"; |
104 |
char pkgdir[512] = "/usr/portage/packages/"; |
96 |
char port_tmpdir[512] = "/var/tmp/portage/"; |
105 |
char port_tmpdir[512] = "/var/tmp/portage/"; |
97 |
|
106 |
|
Lines 176-182
void no_colors() {
Link Here
|
176 |
getopt_long(argc, argv, ex A ## _FLAGS, a ## _long_opts, NULL) |
185 |
getopt_long(argc, argv, ex A ## _FLAGS, a ## _long_opts, NULL) |
177 |
/* display usage and exit */ |
186 |
/* display usage and exit */ |
178 |
static void usage(int status, const char *flags, struct option const opts[], |
187 |
static void usage(int status, const char *flags, struct option const opts[], |
179 |
const char *help[], int blabber) |
188 |
const char *help[], int blabber) |
180 |
{ |
189 |
{ |
181 |
unsigned long i; |
190 |
unsigned long i; |
182 |
if (blabber == 0) { |
191 |
if (blabber == 0) { |
Lines 199-208
static void usage(int status, const char
Link Here
|
199 |
for (i = 0; opts[i].name; ++i) { |
208 |
for (i = 0; opts[i].name; ++i) { |
200 |
assert(help[i] != NULL); /* this assert is a life saver when adding new applets. */ |
209 |
assert(help[i] != NULL); /* this assert is a life saver when adding new applets. */ |
201 |
if (opts[i].has_arg == no_argument) |
210 |
if (opts[i].has_arg == no_argument) |
202 |
printf(" -%c, --%-15s%s*%s %s\n", opts[i].val, |
211 |
printf(" -%c, --%-16s%s*%s %s\n", opts[i].val, |
203 |
opts[i].name, RED, NORM, _(help[i])); |
212 |
opts[i].name, RED, NORM, _(help[i])); |
204 |
else |
213 |
else |
205 |
printf(" -%c, --%-8s %s<arg>%s %s*%s %s\n", opts[i].val, |
214 |
printf(" -%c, --%-9s %s<arg>%s %s*%s %s\n", opts[i].val, |
206 |
opts[i].name, DKBLUE, NORM, RED, NORM, _(help[i])); |
215 |
opts[i].name, DKBLUE, NORM, RED, NORM, _(help[i])); |
207 |
} |
216 |
} |
208 |
exit(status); |
217 |
exit(status); |
Lines 213-219
static void version_barf(const char *Id)
Link Here
|
213 |
# define VERSION "cvs" |
222 |
# define VERSION "cvs" |
214 |
#endif |
223 |
#endif |
215 |
printf("portage-utils-%s: compiled on %s\n%s\n" |
224 |
printf("portage-utils-%s: compiled on %s\n%s\n" |
216 |
"%s written for Gentoo by <solar and vapier @ gentoo.org>\n", |
225 |
"%s written for Gentoo by <solar and vapier @ gentoo.org>\n" |
|
|
226 |
"modified for overlay support by samuelethiec @ hotmail.com\n", |
217 |
VERSION, __DATE__, Id, argv0); |
227 |
VERSION, __DATE__, Id, argv0); |
218 |
exit(EXIT_SUCCESS); |
228 |
exit(EXIT_SUCCESS); |
219 |
} |
229 |
} |
Lines 298-336
static char *remove_extra_space(char *st
Link Here
|
298 |
void freeargv(int, char **); |
308 |
void freeargv(int, char **); |
299 |
void freeargv(int argc, char **argv) { |
309 |
void freeargv(int argc, char **argv) { |
300 |
int i; |
310 |
int i; |
301 |
if (argc > 0) { |
311 |
if (argc > 0) { |
302 |
for (i = 0; i < argc; i++) |
312 |
for (i = 0; i < argc; i++) |
303 |
free(argv[i]); |
313 |
free(argv[i]); |
304 |
free(argv); |
314 |
free(argv); |
305 |
} |
315 |
} |
306 |
} |
316 |
} |
307 |
|
317 |
|
308 |
void makeargv(char *string, int *argc, char ***argv); |
318 |
void makeargv(char *string, int *argc, char ***argv); |
309 |
void makeargv(char *string, int *argc, char ***argv) { |
319 |
void makeargv(char *string, int *argc, char ***argv) { |
310 |
int curc = 2; |
320 |
int curc = 2; |
311 |
char *q, *p, *str; |
321 |
char *q, *p, *str; |
312 |
(*argv) = (char **) malloc(sizeof(char **) * curc); |
322 |
(*argv) = (char **) malloc(sizeof(char **) * curc); |
313 |
|
323 |
|
314 |
*argc = 1; |
324 |
*argc = 1; |
315 |
(*argv)[0] = xstrdup(argv0); |
325 |
(*argv)[0] = xstrdup(argv0); |
316 |
q = xstrdup(string); |
326 |
q = xstrdup(string); |
317 |
str = q; |
327 |
str = q; |
318 |
|
328 |
|
319 |
remove_extra_space(str); |
329 |
remove_extra_space(str); |
320 |
rmspace(str); |
330 |
rmspace(str); |
321 |
|
331 |
|
322 |
while (str) { |
332 |
while (str) { |
323 |
if ((p = strchr(str, ' ')) != NULL) |
333 |
if ((p = strchr(str, ' ')) != NULL) |
324 |
*(p++) = '\0'; |
334 |
*(p++) = '\0'; |
325 |
|
335 |
|
326 |
if (*argc == curc) { |
336 |
if (*argc == curc) { |
327 |
curc *= 2; |
337 |
curc *= 2; |
328 |
(*argv) = (char **) realloc(*argv, sizeof(char **) * curc); |
338 |
(*argv) = (char **) realloc(*argv, sizeof(char **) * curc); |
329 |
} |
339 |
} |
330 |
(*argv)[*argc] = xstrdup(str); |
340 |
(*argv)[*argc] = xstrdup(str); |
331 |
(*argc)++; |
341 |
(*argc)++; |
332 |
str = p; |
342 |
str = p; |
333 |
} |
343 |
} |
334 |
free(q); |
344 |
free(q); |
335 |
} |
345 |
} |
336 |
|
346 |
|
Lines 453-469
char *strincr_var(const char *name, char
Link Here
|
453 |
return (char *) value; |
463 |
return (char *) value; |
454 |
} |
464 |
} |
455 |
|
465 |
|
|
|
466 |
void initialize_overlays (char portdir_overlay[]) |
467 |
{ |
468 |
short merror = 0; |
469 |
char buf[BUFSIZE], file[_Q_PATH_MAX], *s, *p, *t; |
470 |
overlay_t *cur_overlay; |
471 |
FILE *repo_nameFP; |
472 |
s = portdir_overlay; |
473 |
cur_overlay = overlay_gentoo; |
474 |
|
475 |
while (*s) { |
476 |
cur_overlay->next = (overlay_t *) xmalloc ( sizeof (*cur_overlay->next)); |
477 |
cur_overlay = cur_overlay->next; |
478 |
cur_overlay->next = NULL; |
479 |
|
480 |
if ( (p=strchr(s,' '))) |
481 |
*p = 0; |
482 |
|
483 |
strncpy(cur_overlay->path, s, sizeof(cur_overlay->path)); |
484 |
|
485 |
/* find the name for the overlay */ |
486 |
strncpy(file, cur_overlay->path, _Q_PATH_MAX); |
487 |
strncat(file, "/profiles/repo_name", _Q_PATH_MAX); |
488 |
if (( repo_nameFP = fopen(file, "r") )) |
489 |
{ |
490 |
if ( ! ( fgets(buf, sizeof(buf),repo_nameFP)) ) |
491 |
merror++; |
492 |
|
493 |
rmspace(buf); |
494 |
if ( (t = strchr(buf,'\n'))) |
495 |
*t = 0; |
496 |
|
497 |
strncpy(cur_overlay->name, buf, sizeof(cur_overlay->name)); |
498 |
|
499 |
fclose(repo_nameFP); |
500 |
|
501 |
} else |
502 |
merror++; |
503 |
|
504 |
if (merror) { |
505 |
/* delete trailing '/' */ |
506 |
t = cur_overlay->path + strlen(cur_overlay->path) - 1; |
507 |
if ( *t == '/' ) |
508 |
*t = 0; |
509 |
|
510 |
strncat(cur_overlay->name, basename(cur_overlay->path), sizeof(cur_overlay->name)); |
511 |
merror=0; |
512 |
} |
513 |
|
514 |
if (p) |
515 |
s = p+1; |
516 |
else |
517 |
break; |
518 |
} |
519 |
|
520 |
} |
521 |
|
522 |
|
456 |
void initialize_portage_env(void) |
523 |
void initialize_portage_env(void) |
457 |
{ |
524 |
{ |
458 |
char nocolor = 0; |
525 |
char nocolor = 0; |
459 |
int i, f; |
526 |
int i, f; |
460 |
struct stat st; |
527 |
struct stat st; |
461 |
FILE *fp; |
528 |
FILE *fp; |
|
|
529 |
char tmp_portdir[_Q_PATH_MAX]; |
530 |
char portdir_overlay[2048] = ""; |
531 |
|
462 |
char buf[BUFSIZE], *s, *p; |
532 |
char buf[BUFSIZE], *s, *p; |
463 |
|
533 |
|
464 |
char profile[_Q_PATH_MAX], portage_file[_Q_PATH_MAX]; |
534 |
char profile[_Q_PATH_MAX], portage_file[_Q_PATH_MAX]; |
|
|
535 |
|
465 |
const char *files[] = {portage_file, "/etc/make.globals", "/etc/make.conf"}; |
536 |
const char *files[] = {portage_file, "/etc/make.globals", "/etc/make.conf"}; |
466 |
typedef enum { _Q_BOOL, _Q_STR, _Q_ISTR } var_types; |
537 |
typedef enum { _Q_BOOL, _Q_STR, _Q_ISTR } var_types; |
|
|
538 |
|
467 |
struct { |
539 |
struct { |
468 |
const char *name; |
540 |
const char *name; |
469 |
const size_t name_len; |
541 |
const size_t name_len; |
Lines 471-489
void initialize_portage_env(void)
Link Here
|
471 |
char *value; |
543 |
char *value; |
472 |
const size_t value_len; |
544 |
const size_t value_len; |
473 |
} vars_to_read[] = { |
545 |
} vars_to_read[] = { |
474 |
{"ACCEPT_LICENSE", 14, _Q_STR, accept_license, sizeof(accept_license)}, |
546 |
{"ACCEPT_LICENSE", 14, _Q_STR, accept_license, sizeof(accept_license) }, |
475 |
{"INSTALL_MASK", 12, _Q_ISTR, install_mask, sizeof(install_mask)}, |
547 |
{"INSTALL_MASK", 12, _Q_ISTR, install_mask, sizeof(install_mask) }, |
476 |
{"ARCH", 4, _Q_STR, portarch, sizeof(portarch)}, |
548 |
{"ARCH", 4, _Q_STR, portarch, sizeof(portarch) }, |
477 |
{"CONFIG_PROTECT", 14, _Q_STR, config_protect, sizeof(config_protect)}, |
549 |
{"CONFIG_PROTECT", 14, _Q_STR, config_protect, sizeof(config_protect) }, |
478 |
{"NOCOLOR", 7, _Q_BOOL, &nocolor, 1}, |
550 |
{"NOCOLOR", 7, _Q_BOOL, &nocolor, 1 }, |
479 |
{"FEATURES",8, _Q_ISTR, features, sizeof(features)}, |
551 |
{"FEATURES", 8, _Q_ISTR, features, sizeof(features) }, |
480 |
{"PORTDIR", 7, _Q_STR, portdir, sizeof(portdir)}, |
552 |
{"PORTDIR", 7, _Q_STR, tmp_portdir, sizeof(tmp_portdir) }, |
481 |
{"PORTAGE_BINHOST", 15, _Q_STR, binhost, sizeof(binhost)}, |
553 |
{"PORTDIR_OVERLAY", 15, _Q_ISTR, portdir_overlay, sizeof(portdir_overlay) }, |
482 |
{"PORTAGE_TMPDIR", 14, _Q_STR, port_tmpdir, sizeof(port_tmpdir)}, |
554 |
{"PORTAGE_BINHOST", 15, _Q_STR, binhost, sizeof(binhost) }, |
483 |
{"PKGDIR", 6, _Q_STR, pkgdir, sizeof(pkgdir)}, |
555 |
{"PORTAGE_TMP", 9, _Q_STR, port_tmpdir, sizeof(port_tmpdir) }, |
484 |
{"ROOT", 4, _Q_STR, portroot, sizeof(portroot)} |
556 |
{"PKGDIR", 6, _Q_STR, pkgdir, sizeof(pkgdir) }, |
|
|
557 |
{"ROOT", 4, _Q_STR, portroot, sizeof(portroot) } |
485 |
}; |
558 |
}; |
486 |
|
559 |
|
|
|
560 |
overlay_gentoo = (overlay_t*) xmalloc(sizeof(*overlay_gentoo)); |
561 |
strcpy(overlay_gentoo->name,"gentoo"); |
562 |
strcpy(overlay_gentoo->path,"/usr/portage"); |
563 |
overlay_gentoo->next = NULL; |
564 |
|
565 |
|
487 |
if ((p = strchr(portroot, '/')) != NULL) |
566 |
if ((p = strchr(portroot, '/')) != NULL) |
488 |
if (strlen(p) != 1) |
567 |
if (strlen(p) != 1) |
489 |
strncat(portroot, "/", sizeof(portroot)); |
568 |
strncat(portroot, "/", sizeof(portroot)); |
Lines 575-580
void initialize_portage_env(void)
Link Here
|
575 |
no_colors(); |
654 |
no_colors(); |
576 |
else |
655 |
else |
577 |
color_remap(); |
656 |
color_remap(); |
|
|
657 |
|
658 |
|
659 |
strncpy(overlay_gentoo->path, tmp_portdir, sizeof(overlay_gentoo->path)); |
660 |
|
661 |
/* now we initiliase the overlay chained list with overlay_gentoo the first 'item' */ |
662 |
initialize_overlays(portdir_overlay); |
663 |
|
578 |
} |
664 |
} |
579 |
|
665 |
|
580 |
enum { |
666 |
enum { |
Lines 603-621
const char *initialize_flat(int cache_ty
Link Here
|
603 |
int a, b, c, d, e, i; |
689 |
int a, b, c, d, e, i; |
604 |
int frac, secs, count; |
690 |
int frac, secs, count; |
605 |
FILE *fp; |
691 |
FILE *fp; |
|
|
692 |
overlay_t *cur_overlay; |
606 |
|
693 |
|
607 |
a = b = c = d = e = i = 0; |
694 |
a = b = c = d = e = i = 0; |
608 |
count = frac = secs = 0; |
695 |
count = frac = secs = 0; |
|
|
696 |
cur_overlay = overlay_gentoo; |
609 |
|
697 |
|
610 |
cache_file = (cache_type == CACHE_EBUILD ? CACHE_EBUILD_FILE : CACHE_METADATA_FILE); |
698 |
cache_file = (cache_type == CACHE_EBUILD ? CACHE_EBUILD_FILE : CACHE_METADATA_FILE); |
611 |
|
699 |
|
612 |
if (chdir(portdir) != 0) { |
700 |
if (chdir(overlay_gentoo->path) != 0) { |
613 |
warnp("chdir to PORTDIR '%s' failed", portdir); |
701 |
warnp("chdir to PORTDIR '%s' failed", overlay_gentoo->path); |
614 |
goto ret; |
702 |
goto ret; |
615 |
} |
703 |
} |
616 |
|
704 |
|
617 |
if (cache_type == CACHE_METADATA && chdir(portcachedir) != 0) { |
705 |
if (cache_type == CACHE_METADATA && chdir(portcachedir) != 0) { |
618 |
warnp("chdir to portage cache '%s/%s' failed", portdir, portcachedir); |
706 |
warnp("chdir to paludis cache '%s/%s' failed", overlay_gentoo->path, portcachedir); |
619 |
goto ret; |
707 |
goto ret; |
620 |
} |
708 |
} |
621 |
|
709 |
|
Lines 631-694
const char *initialize_flat(int cache_ty
Link Here
|
631 |
|
719 |
|
632 |
unlink(cache_file); |
720 |
unlink(cache_file); |
633 |
if (errno != ENOENT) { |
721 |
if (errno != ENOENT) { |
634 |
warnfp("unlinking '%s/%s' failed", portdir, cache_file); |
722 |
warnfp("unlinking '%s/%s' failed", overlay_gentoo->path, cache_file); |
635 |
goto ret; |
723 |
goto ret; |
636 |
} |
724 |
} |
637 |
|
725 |
|
638 |
if ((fp = fopen(cache_file, "w")) == NULL) { |
726 |
if ((fp = fopen(cache_file, "w")) == NULL) { |
639 |
warnfp("opening '%s/%s' failed", portdir, cache_file); |
727 |
warnfp("opening '%s/%s' failed", overlay_gentoo->path, cache_file); |
640 |
goto ret; |
728 |
goto ret; |
641 |
} |
729 |
} |
642 |
|
730 |
|
643 |
gettimeofday(&start, NULL); |
731 |
gettimeofday(&start, NULL); |
644 |
|
732 |
|
645 |
if ((a = scandir(".", &category, filter_hidden, alphasort)) < 0) |
733 |
do { |
646 |
goto ret; |
734 |
if ( cur_overlay == overlay_gentoo || chdir(cur_overlay->path) == 0) { |
647 |
|
735 |
if ((a = scandir(".", &category, filter_hidden, alphasort)) < 0) |
648 |
for (i = 0 ; i < a; i++) { |
|
|
649 |
stat(category[i]->d_name, &st); |
650 |
if (!S_ISDIR(st.st_mode)) |
651 |
continue; |
652 |
if (strchr(category[i]->d_name, '-') == NULL) |
653 |
if ((strncmp(category[i]->d_name, "virtual", 7)) != 0) |
654 |
continue; |
736 |
continue; |
655 |
|
737 |
|
656 |
if ((b = scandir(category[i]->d_name, &pn, filter_hidden, alphasort)) < 0) |
738 |
for (i = 0 ; i < a; i++) { |
657 |
continue; |
739 |
stat(category[i]->d_name, &st); |
658 |
for (c = 0; c < b; c++) { |
740 |
if (!S_ISDIR(st.st_mode)) |
659 |
char de[_Q_PATH_MAX]; |
741 |
continue; |
|
|
742 |
if (strchr(category[i]->d_name, '-') == NULL) |
743 |
if ((strncmp(category[i]->d_name, "virtual", 7)) != 0) |
744 |
continue; |
660 |
|
745 |
|
661 |
snprintf(de, sizeof(de), "%s/%s", category[i]->d_name, pn[c]->d_name); |
746 |
if ((b = scandir(category[i]->d_name, &pn, filter_hidden, alphasort)) < 0) |
|
|
747 |
continue; |
748 |
for (c = 0; c < b; c++) { |
749 |
char de[_Q_PATH_MAX]; |
662 |
|
750 |
|
663 |
if (stat(de, &st) < 0) |
751 |
snprintf(de, sizeof(de), "%s/%s", category[i]->d_name, pn[c]->d_name); |
664 |
continue; |
|
|
665 |
|
752 |
|
666 |
switch (cache_type) { |
753 |
if (stat(de, &st) < 0) |
667 |
case CACHE_EBUILD: |
754 |
continue; |
668 |
if (!S_ISDIR(st.st_mode)) |
755 |
|
669 |
continue; |
756 |
switch (cache_type) { |
670 |
break; |
757 |
case CACHE_EBUILD: |
671 |
case CACHE_METADATA: |
758 |
if (!S_ISDIR(st.st_mode)) |
672 |
if (S_ISREG(st.st_mode)) |
759 |
continue; |
673 |
fprintf(fp, "%s\n", de); |
760 |
break; |
674 |
continue; |
761 |
case CACHE_METADATA: |
675 |
break; |
762 |
if (S_ISREG(st.st_mode)) |
676 |
} |
763 |
fprintf(fp, "%s\n", de); |
677 |
if ((e = scandir(de, &eb, filter_hidden, alphasort)) < 0) |
764 |
continue; |
678 |
continue; |
765 |
break; |
679 |
for (d = 0 ; d < e; d++) { |
766 |
} |
680 |
if ((p = strrchr(eb[d]->d_name, '.')) != NULL) |
767 |
if ((e = scandir(de, &eb, filter_hidden, alphasort)) < 0) |
681 |
if (strcmp(p, ".ebuild") == 0) { |
768 |
continue; |
682 |
count++; |
769 |
for (d = 0 ; d < e; d++) { |
683 |
fprintf(fp, "%s/%s/%s\n", category[i]->d_name, pn[c]->d_name, eb[d]->d_name); |
770 |
if ((p = strrchr(eb[d]->d_name, '.')) != NULL) |
|
|
771 |
if (strcmp(p, ".ebuild") == 0) { |
772 |
count++; |
773 |
fprintf(fp, "%s::%s/%s/%s\n", cur_overlay->name, category[i]->d_name, pn[c]->d_name, eb[d]->d_name); |
774 |
} |
684 |
} |
775 |
} |
|
|
776 |
while(d--) |
777 |
free(eb[d]); |
778 |
free(eb); |
779 |
} |
780 |
while(b--) |
781 |
free(pn[b]); |
782 |
free(pn); |
685 |
} |
783 |
} |
686 |
while(d--) free(eb[d]); |
784 |
} else |
687 |
free(eb); |
785 |
warnp("chdir to PORTDIR '%s' failed, skipping the %s repository", cur_overlay->path, cur_overlay->name); |
688 |
} |
786 |
|
689 |
while(b--) free(pn[b]); |
787 |
} while ( (cur_overlay = cur_overlay->next)); |
690 |
free(pn); |
788 |
|
691 |
} |
|
|
692 |
fclose(fp); |
789 |
fclose(fp); |
693 |
while(a--) free(category[a]); |
790 |
while(a--) free(category[a]); |
694 |
free(category); |
791 |
free(category); |
Lines 699-705
const char *initialize_flat(int cache_ty
Link Here
|
699 |
if (start.tv_usec > finish.tv_usec) { |
796 |
if (start.tv_usec > finish.tv_usec) { |
700 |
finish.tv_usec += 1000000; |
797 |
finish.tv_usec += 1000000; |
701 |
finish.tv_sec--; |
798 |
finish.tv_sec--; |
702 |
|
799 |
|
703 |
} |
800 |
} |
704 |
frac = (finish.tv_usec - start.tv_usec); |
801 |
frac = (finish.tv_usec - start.tv_usec); |
705 |
secs = (finish.tv_sec - start.tv_sec); |
802 |
secs = (finish.tv_sec - start.tv_sec); |
Lines 708-714
const char *initialize_flat(int cache_ty
Link Here
|
708 |
|
805 |
|
709 |
warn("Finished %u entries in %d.%06d seconds", count, secs, frac); |
806 |
warn("Finished %u entries in %d.%06d seconds", count, secs, frac); |
710 |
if (secs > 100) |
807 |
if (secs > 100) |
711 |
warn("You should consider a faster file system such as reiserfs for PORTDIR='%s'", portdir); |
808 |
warn("You should consider a faster file system such as reiserfs for PORTDIR='%s'", overlay_gentoo->path); |
712 |
ret: |
809 |
ret: |
713 |
return cache_file; |
810 |
return cache_file; |
714 |
} |
811 |
} |
Lines 717-724
ret:
Link Here
|
717 |
|
814 |
|
718 |
void reinitialize_ebuild_flat(void) |
815 |
void reinitialize_ebuild_flat(void) |
719 |
{ |
816 |
{ |
720 |
if ((chdir(portdir)) != 0) { |
817 |
if ((chdir(overlay_gentoo->path)) != 0) { |
721 |
warnp("chdir to PORTDIR '%s' failed", portdir); |
818 |
warnp("chdir to PORTDIR '%s' failed", overlay_gentoo->path); |
722 |
return; |
819 |
return; |
723 |
} |
820 |
} |
724 |
unlink(CACHE_EBUILD_FILE); |
821 |
unlink(CACHE_EBUILD_FILE); |
Lines 900-918
void cache_free(portage_cache *cache)
Link Here
|
900 |
|
997 |
|
901 |
char *grab_vdb_item(const char *, const char *, const char *); |
998 |
char *grab_vdb_item(const char *, const char *, const char *); |
902 |
char *grab_vdb_item(const char *item, const char *CATEGORY, const char *PF) { |
999 |
char *grab_vdb_item(const char *item, const char *CATEGORY, const char *PF) { |
903 |
static char buf[_Q_PATH_MAX]; |
1000 |
static char buf[_Q_PATH_MAX]; |
904 |
char *p; |
1001 |
char *p; |
905 |
FILE *fp; |
1002 |
FILE *fp; |
906 |
|
1003 |
|
907 |
snprintf(buf, sizeof(buf), "%s%s/%s/%s/%s", portroot, portvdb, CATEGORY, PF, item); |
1004 |
snprintf(buf, sizeof(buf), "%s%s/%s/%s/%s", portroot, portvdb, CATEGORY, PF, item); |
908 |
if ((fp = fopen(buf, "r")) == NULL) |
1005 |
if ((fp = fopen(buf, "r")) == NULL) |
909 |
return NULL; |
1006 |
return NULL; |
910 |
fgets(buf, sizeof(buf), fp); |
1007 |
fgets(buf, sizeof(buf), fp); |
911 |
if ((p = strchr(buf, '\n')) != NULL) |
1008 |
if ((p = strchr(buf, '\n')) != NULL) |
912 |
*p = 0; |
1009 |
*p = 0; |
913 |
fclose(fp); |
1010 |
fclose(fp); |
914 |
rmspace(buf); |
1011 |
rmspace(buf); |
915 |
|
1012 |
|
916 |
return buf; |
1013 |
return buf; |
917 |
} |
1014 |
} |
918 |
|
1015 |
|
Lines 922-928
queue *get_vdb_atoms(void) {
Link Here
|
922 |
int dfd, i; |
1019 |
int dfd, i; |
923 |
|
1020 |
|
924 |
char buf[_Q_PATH_MAX]; |
1021 |
char buf[_Q_PATH_MAX]; |
925 |
static char savecwd[_POSIX_PATH_MAX]; |
1022 |
static char savecwd[_POSIX_PATH_MAX]; |
926 |
|
1023 |
|
927 |
struct dirent **cat; |
1024 |
struct dirent **cat; |
928 |
struct dirent **pf; |
1025 |
struct dirent **pf; |
Lines 930-936
queue *get_vdb_atoms(void) {
Link Here
|
930 |
depend_atom *atom = NULL; |
1027 |
depend_atom *atom = NULL; |
931 |
queue *cpf = NULL; |
1028 |
queue *cpf = NULL; |
932 |
|
1029 |
|
933 |
getcwd(savecwd, sizeof(savecwd)); |
1030 |
getcwd(savecwd, sizeof(savecwd)); |
934 |
|
1031 |
|
935 |
assert(chdir(savecwd) == 0); |
1032 |
assert(chdir(savecwd) == 0); |
936 |
|
1033 |
|
Lines 974-980
queue *get_vdb_atoms(void) {
Link Here
|
974 |
snprintf(buf, sizeof(buf), "%s/%s-%s", atom->CATEGORY, atom->PN, atom->PV); |
1071 |
snprintf(buf, sizeof(buf), "%s/%s-%s", atom->CATEGORY, atom->PN, atom->PV); |
975 |
atom_implode(atom); |
1072 |
atom_implode(atom); |
976 |
cpf = add_set(buf, "0", cpf); |
1073 |
cpf = add_set(buf, "0", cpf); |
977 |
|
1074 |
|
978 |
} |
1075 |
} |
979 |
chdir(".."); |
1076 |
chdir(".."); |
980 |
while(dfd--) free(pf[dfd]); |
1077 |
while(dfd--) free(pf[dfd]); |
Lines 990-998
fuckit:
Link Here
|
990 |
return cpf; |
1087 |
return cpf; |
991 |
} |
1088 |
} |
992 |
|
1089 |
|
|
|
1090 |
/* free overlays */ |
1091 |
void free_overlays(overlay_t *overlay); |
1092 |
void free_overlays(overlay_t *overlay) |
1093 |
{ |
1094 |
if ( overlay->next ) |
1095 |
free_overlays(overlay->next); |
1096 |
free(overlay); |
1097 |
} |
1098 |
|
993 |
void cleanup() { |
1099 |
void cleanup() { |
994 |
reinitialize_as_needed(); |
1100 |
reinitialize_as_needed(); |
995 |
free_sets(virtuals); |
1101 |
free_sets(virtuals); |
|
|
1102 |
free_overlays(overlay_gentoo); |
996 |
fclose(stderr); |
1103 |
fclose(stderr); |
997 |
} |
1104 |
} |
998 |
|
1105 |
|