Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Preserve automatic flag on forced reinstall.
Vsevolod Stakhov committed 11 years ago
commit 634a26689e318f87de90d3689882ae793107cafb
parent e875796
2 files changed +10 -4
modified libpkg/pkg_add.c
@@ -375,6 +375,7 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
	bool		 extract = true;
	bool		 handle_rc = false;
	bool		 disable_mtree;
+
	bool		 automatic;
	char		*mtree;
	char		*prefix;
	int		 retcode = EPKG_OK;
@@ -428,8 +429,8 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
			pkg_addannotation(pkg, "repo_type", remote->repo->ops->type);
		}

-
		pkg_get(remote, PKG_DIGEST, &manifestdigest);
-
		pkg_set(pkg, PKG_DIGEST, manifestdigest);
+
		pkg_get(remote, PKG_DIGEST, &manifestdigest, PKG_AUTOMATIC, &automatic);
+
		pkg_set(pkg, PKG_DIGEST, manifestdigest, PKG_AUTOMATIC, automatic);
	}

	if (location != NULL)
@@ -458,11 +459,12 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
			goto cleanup_reg;
	}

-
	if (local != NULL)
+
	if (local != NULL) {
		if (pkg_add_cleanup_old(local, remote, flags) != EPKG_OK) {
			retcode = EPKG_FATAL;
			goto cleanup;
		}
+
	}

	/*
	 * Execute pre-install scripts
modified libpkg/pkg_jobs.c
@@ -970,6 +970,7 @@ pkg_jobs_process_remote_pkg(struct pkg_jobs *j, struct pkg *p,
	struct pkg_job_seen *seen;
	struct pkg_job_request *jreq;
	int rc = EPKG_FATAL;
+
	bool automatic;
	const char *uid, *digest;

	pkg_get(p, PKG_UNIQUEID, &uid, PKG_DIGEST, &digest);
@@ -995,8 +996,11 @@ pkg_jobs_process_remote_pkg(struct pkg_jobs *j, struct pkg *p,
			HASH_FIND_STR(j->request_add, uid, jreq);
			if (jreq == NULL)
				pkg_jobs_add_req(j, uid, seen->un);
-
			if (force)
+
			if (force) {
				seen->un->reinstall = p;
+
				pkg_get(seen->un->pkg, PKG_AUTOMATIC, &automatic);
+
				pkg_set(p, PKG_AUTOMATIC, automatic);
+
			}
		}
		return (EPKG_OK);
	}