aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qmerge.c54
-rw-r--r--qpkg.c17
2 files changed, 40 insertions, 31 deletions
diff --git a/qmerge.c b/qmerge.c
index 2520b1e2..e3347a05 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.32 2006/02/19 23:25:09 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.33 2006/02/23 04:33:15 solar Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -51,7 +51,7 @@ static const char *qmerge_opts_help[] = {
COMMON_OPTS_HELP
};
-static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.32 2006/02/19 23:25:09 solar Exp $";
+static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.33 2006/02/23 04:33:15 solar Exp $";
#define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge"))
char pretend = 0;
@@ -1431,34 +1431,34 @@ int qmerge_main(int argc, char **argv) {
if (argc > 1) {
queue *world;
for (i = 0 ; i < argc ; i++) {
- if ((strcmp(argv[i], "world") == 0)) {
- size_t size = 0;
- world = get_vdb_atoms();
- if (world != NULL) {
- queue *ll;
- char *ptr;
-
- for (ll = world; ll != NULL; ll = ll->next)
- size += (strlen(ll->name) + 1);
- if (size < 1)
- continue;
+ size_t size = 0;
+ if ((strcmp(argv[i], "world") != 0))
+ continue;
+ world = get_vdb_atoms();
+ if (world != NULL) {
+ queue *ll;
+ char *ptr;
+
+ for (ll = world; ll != NULL; ll = ll->next)
+ size += (strlen(ll->name) + 1);
+ if (size < 1)
+ continue;
- size += (strlen(argv[0]) + 1);
- ptr = xmalloc(size);
- sprintf(ptr, "%s ", argv[0]);
+ size += (strlen(argv[0]) + 1);
+ ptr = xmalloc(size);
+ sprintf(ptr, "%s ", argv[0]);
- for (ll = world; ll != NULL; ll = ll->next) {
- char *p = NULL;
- asprintf(&p, "%s ", ll->name);
- strcat(ptr, p);
- free(p);
- }
- ARGC = 0;
- ARGV = NULL;
- /* this will leak mem */
- // follow_rdepends = 0;
- makeargv(ptr, &ARGC, &ARGV);
+ for (ll = world; ll != NULL; ll = ll->next) {
+ char *p = NULL;
+ asprintf(&p, "%s ", ll->name);
+ strcat(ptr, p);
+ free(p);
}
+ ARGC = 0;
+ ARGV = NULL;
+ /* this will leak mem */
+ // follow_rdepends = 0;
+ makeargv(ptr, &ARGC, &ARGV);
}
}
}
diff --git a/qpkg.c b/qpkg.c
index 09968212..dadadc3d 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qpkg.c,v 1.14 2006/02/23 04:07:37 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qpkg.c,v 1.15 2006/02/23 04:33:15 solar Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -9,17 +9,20 @@
#ifdef APPLET_qpkg
-#define QPKG_FLAGS "" COMMON_FLAGS
+#define QPKG_FLAGS "p" COMMON_FLAGS
static struct option const qpkg_long_opts[] = {
+ {"pretend", no_argument, NULL, 'p'},
COMMON_LONG_OPTS
};
static const char *qpkg_opts_help[] = {
+ "pretend only",
COMMON_OPTS_HELP
};
-static const char qpkg_rcsid[] = "$Id: qpkg.c,v 1.14 2006/02/23 04:07:37 solar Exp $";
+static const char qpkg_rcsid[] = "$Id: qpkg.c,v 1.15 2006/02/23 04:33:15 solar Exp $";
#define qpkg_usage(ret) usage(ret, QPKG_FLAGS, qpkg_long_opts, qpkg_opts_help, lookup_applet_idx("qpkg"))
+extern char pretend;
const char *qpkg_get_bindir(void);
const char *qpkg_get_bindir(void)
@@ -45,6 +48,11 @@ int qpkg_make(depend_atom *atom)
char *xpak_argv[2];
struct stat st;
+ if (pretend) {
+ printf(" %s-%s %s/%s:\n", GREEN, NORM, atom->CATEGORY, atom->P);
+ return 0;
+ }
+
snprintf(buf, sizeof(buf), "%s/%s/%s/CONTENTS", portvdb, atom->CATEGORY, atom->P);
if ((fp = fopen(buf, "r")) == NULL)
return -1;
@@ -124,6 +132,7 @@ int qpkg_main(int argc, char **argv)
while ((i = GETOPT_LONG(QPKG, qpkg, "")) != -1) {
switch (i) {
+ case 'p': pretend = 1; break;
COMMON_GETOPTS_CASES(qpkg)
}
}
@@ -208,7 +217,7 @@ retry_mkdir:
}
s = (argc - optind) - pkgs_made;
- if (s)
+ if (s && !pretend)
printf(" %s*%s %i package%s could not be matched :/\n", RED, NORM, (int)s, (s > 1 ? "s" : ""));
if (pkgs_made)
printf(" %s*%s Packages can be found in %s\n", GREEN, NORM, bindir);