Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Directly get the job type from the job itself
Baptiste Daroussin committed 13 years ago
commit 9f30ecfed5e7503cb44c99bb3a1524bdc3ceba65
parent 7e985a6189a2e9da65d1c7a0d4c536ffbf7a5926
8 files changed +16 -7
modified libpkg/pkg.h
@@ -874,6 +874,7 @@ int pkg_jobs_add(struct pkg_jobs *jobs, struct pkg *pkg);
int pkg_jobs_append(struct pkg_jobs *j, match_t match, char **argv, int argc, bool recursive);
int pkg_jobs_solve(struct pkg_jobs *j);
int pkg_jobs_find(struct pkg_jobs *j, const char *origin, struct pkg **pkg);
+
pkg_jobs_t pkg_jobs_type(struct pkg_jobs *j);

/**
 * Returns the number of elements in the job queue
modified libpkg/pkg_jobs.c
@@ -213,6 +213,12 @@ pkg_jobs_count(struct pkg_jobs *j)
	return (HASH_COUNT(j->jobs));
}

+
pkg_jobs_t
+
pkg_jobs_type(struct pkg_jobs *j)
+
{
+
	return (j->type);
+
}
+

int
pkg_jobs(struct pkg_jobs *j, struct pkg **pkg)
{
modified pkg/autoremove.c
@@ -105,7 +105,7 @@ exec_autoremove(int argc, char **argv)
	}

	if (!quiet || dry_run) {
-
		print_jobs_summary(jobs, PKG_JOBS_AUTOREMOVE,
+
		print_jobs_summary(jobs,
		    "Deinstallation has been requested for the following %d packages:\n\n", nbactions);
		if (!yes && !dry_run)
			yes = query_yesno(
modified pkg/delete.c
@@ -145,7 +145,7 @@ exec_delete(int argc, char **argv)

	pkg = NULL;
	if (!quiet || dry_run) {
-
		print_jobs_summary(jobs, PKG_JOBS_DEINSTALL,
+
		print_jobs_summary(jobs,
		    "Deinstallation has been requested for the following %d packages:\n\n", nbactions);
		if (!yes && !dry_run)
			yes = query_yesno(
modified pkg/fetch.c
@@ -132,7 +132,7 @@ exec_fetch(int argc, char **argv)
		goto cleanup;

	if (!quiet) {
-
		print_jobs_summary(jobs, PKG_JOBS_FETCH, "The following packages will be fetched:\n\n");
+
		print_jobs_summary(jobs, "The following packages will be fetched:\n\n");
		
		if (!yes)
			pkg_config_bool(PKG_CONFIG_ASSUME_ALWAYS_YES, &yes);
modified pkg/install.c
@@ -154,7 +154,7 @@ exec_install(int argc, char **argv)
	/* print a summary before applying the jobs */
	pkg = NULL;
	if (!quiet || dry_run) {
-
		print_jobs_summary(jobs, PKG_JOBS_INSTALL,
+
		print_jobs_summary(jobs,
		    "The following %d packages will be installed:\n\n",
		    nbactions);

modified pkg/pkgcli.h
@@ -215,8 +215,7 @@ bool query_yesno(const char *msg, ...);
int info_flags(unsigned int opt);
void print_info(struct pkg * const pkg, unsigned int opt);
char *absolutepath(const char *src, char *dest, size_t dest_len);
-
void print_jobs_summary(struct pkg_jobs *j, pkg_jobs_t type,
-
			const char *msg, ...);
+
void print_jobs_summary(struct pkg_jobs *j, const char *msg, ...);
struct sbuf *exec_buf(const char *cmd);
int hash_file(const char *, char[SHA256_DIGEST_LENGTH * 2 +1]);

modified pkg/utils.c
@@ -524,7 +524,7 @@ print_info(struct pkg * const pkg, unsigned int options)
}

void
-
print_jobs_summary(struct pkg_jobs *jobs, pkg_jobs_t type, const char *msg, ...)
+
print_jobs_summary(struct pkg_jobs *jobs, const char *msg, ...)
{
	struct pkg *pkg = NULL;
	char path[MAXPATHLEN];
@@ -535,6 +535,9 @@ print_jobs_summary(struct pkg_jobs *jobs, pkg_jobs_t type, const char *msg, ...)
	bool locked;
	char size[7];
	va_list ap;
+
	pkg_jobs_t type;
+

+
	type = pkg_jobs_type(jobs);

	va_start(ap, msg);
	vprintf(msg, ap);