Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Insert manifest digest to repo db.
Vsevolod Stakhov committed 13 years ago
commit 42037d3efff1cf506f9578bc6829d43c791714d5
parent 4186881
3 files changed +10 -7
modified libpkg/pkg_repo.c
@@ -322,7 +322,7 @@ pkg_create_repo(char *path, bool force, void (progress)(struct pkg *pkg, void *d
		cur_dig->files_pos = files_pos;
		LL_PREPEND(dlist, cur_dig);

-
		retcode = pkgdb_repo_add_package(r->pkg, r->path, sqlite);
+
		retcode = pkgdb_repo_add_package(r->pkg, r->path, sqlite, manifest_digest);
		if (retcode == EPKG_END) {
			continue;
		}
modified libpkg/pkgdb_repo.c
@@ -88,10 +88,10 @@ static sql_prstmt sql_prepared_statements[PRSTMT_LAST] = {
		NULL,
		"INSERT INTO packages ("
		"origin, name, version, comment, desc, arch, maintainer, www, "
-
		"prefix, pkgsize, flatsize, licenselogic, cksum, path"
+
		"prefix, pkgsize, flatsize, licenselogic, cksum, path, manifestdigest"
		")"
-
		"VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14)",
-
		"TTTTTTTTTIIITT",
+
		"VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)",
+
		"TTTTTTTTTIIITTT",
	},
	[DEPS] = {
		NULL,
@@ -458,7 +458,8 @@ pkgdb_repo_cksum_exists(sqlite3 *sqlite, const char *cksum)
}

int
-
pkgdb_repo_add_package(struct pkg *pkg, const char *pkg_path, sqlite3 *sqlite)
+
pkgdb_repo_add_package(struct pkg *pkg, const char *pkg_path,
+
		sqlite3 *sqlite, const char *manifest_digest)
{
	const char *name, *version, *origin, *comment, *desc;
	const char *arch, *maintainer, *www, *prefix, *sum, *rpath;
@@ -484,7 +485,7 @@ try_again:
	if ((ret = run_prepared_statement(PKG, origin, name, version,
			comment, desc, arch, maintainer, www, prefix,
			pkgsize, flatsize, (int64_t)licenselogic, sum,
-
			rpath)) != SQLITE_DONE) {
+
			rpath, manifest_digest)) != SQLITE_DONE) {
		if (ret == SQLITE_CONSTRAINT) {
			switch(maybe_delete_conflicting(origin,
					version, pkg_path)) {
modified libpkg/private/pkgdb.h
@@ -97,10 +97,12 @@ int pkgdb_repo_cksum_exists(sqlite3 *sqlite, const char *cksum);
 * @param pkg package structure
 * @param pkg_path path triggered package addition
 * @param sqlite sqlite pointer
+
 * @param manifest_digest sha256 checksum of the manifest of the package
 * @return EPKG_OK if package added, EPKG_END if package already exists and is newer than
 * inserted one, EPKG_FATAL if error occurred
 */
-
int pkgdb_repo_add_package(struct pkg *pkg, const char *pkg_path, sqlite3 *sqlite);
+
int pkgdb_repo_add_package(struct pkg *pkg, const char *pkg_path,
+
		sqlite3 *sqlite, const char *manifest_digest);

/**
 * Upgrade repo db version if required