Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix operator misprint in pkg-update code.
Vsevolod Stakhov committed 13 years ago
commit 5e7f8eb3c5beb0b168db70267d7f3822377320cb
parent 4948ea6
4 files changed +35 -24
modified libpkg/fetch.c
@@ -159,7 +159,7 @@ pkg_fetch_file_to_fd(const char *url, int dest, time_t *t)
	retry = max_retry;

	u = fetchParseURL(url);
-
	if (t != NULL && *t != 0)
+
	if (t != NULL)
		u->ims_time = *t;

	doc = u->doc;
modified libpkg/pkg_repo.c
@@ -623,26 +623,26 @@ pkg_create_repo(char *path, bool force, void (progress)(struct pkg *pkg, void *d
		goto cleanup;
	}

-
	snprintf(repodb, sizeof(repodb), "%s/packagesite.yaml", path);
+
	snprintf(repodb, sizeof(repodb), "%s/%s", path, repo_packagesite_file);
	if ((psyml = fopen(repodb, "w")) == NULL) {
		retcode = EPKG_FATAL;
		goto cleanup;
	}
-
	snprintf(repodb, sizeof(repodb), "%s/filesite.yaml", path);
+
	snprintf(repodb, sizeof(repodb), "%s/%s", path, repo_filesite_file);
	if ((fsyml = fopen(repodb, "w")) == NULL) {
		retcode = EPKG_FATAL;
		goto cleanup;
	}
-
	snprintf(repodb, sizeof(repodb), "%s/digests", path);
+
	snprintf(repodb, sizeof(repodb), "%s/%s", path, repo_digests_file);
	if ((mandigests = fopen(repodb, "w")) == NULL) {
		retcode = EPKG_FATAL;
		goto cleanup;
	}

-
	snprintf(repodb, sizeof(repodb), "%s/repo.sqlite", path);
+
	snprintf(repodb, sizeof(repodb), "%s/%s", path, repo_db_file);
	snprintf(repopack, sizeof(repopack), "%s/repoy.txz", path);

-
	pack_extract(repopack, "repo.sqlite", repodb);
+
	pack_extract(repopack, repo_db_file, repodb);

	if ((retcode = initialize_repo(repodb, force, &sqlite)) != EPKG_OK)
		goto cleanup;
@@ -960,11 +960,14 @@ read_pkg_file(void *data)
				strcmp(ext, ".tar") != 0)
			continue;

-
		if (strcmp(fts_name, "repo.txz") == 0 ||
-
			strcmp(fts_name, "packagesite.txz") == 0 ||
-
			strcmp(fts_name, "filesite.txz") == 0 ||
-
			strcmp(fts_name, "digests.txz") == 0)
+
		*ext = '\0';
+

+
		if (strcmp(fts_name, repo_db_archive) == 0 ||
+
			strcmp(fts_name, repo_packagesite_archive) == 0 ||
+
			strcmp(fts_name, repo_filesite_archive) == 0 ||
+
			strcmp(fts_name, repo_digests_archive) == 0)
			continue;
+
		*ext = '.';

		pkg_path = fts_path;
		pkg_path += strlen(d->root_path);
@@ -1047,27 +1050,27 @@ pkg_finish_repo(char *path, pem_password_cb *password_cb, char *rsa_key_path)
	    return (EPKG_FATAL);
	}

-
	snprintf(repo_path, sizeof(repo_path), "%s/packagesite.yaml", path);
-
	snprintf(repo_archive, sizeof(repo_archive), "%s/packagesite", path);
-
	if (pack_db("packagesite.yaml", repo_archive, repo_path,
+
	snprintf(repo_path, sizeof(repo_path), "%s/%s", path, repo_packagesite_file);
+
	snprintf(repo_archive, sizeof(repo_archive), "%s/%s", path, repo_packagesite_archive);
+
	if (pack_db(repo_packagesite_file, repo_archive, repo_path,
			rsa_key_path, password_cb) != EPKG_OK)
		return (EPKG_FATAL);

-
	snprintf(repo_path, sizeof(repo_path), "%s/repo.sqlite", path);
-
	snprintf(repo_archive, sizeof(repo_archive), "%s/repo", path);
-
	if (pack_db("repo.sqlite", repo_archive, repo_path,
+
	snprintf(repo_path, sizeof(repo_path), "%s/%s", path, repo_db_file);
+
	snprintf(repo_archive, sizeof(repo_archive), "%s/%s", path, repo_db_archive);
+
	if (pack_db(repo_db_file, repo_archive, repo_path,
			rsa_key_path, password_cb) != EPKG_OK)
		return (EPKG_FATAL);

-
	snprintf(repo_path, sizeof(repo_path), "%s/filesite.yaml", path);
-
	snprintf(repo_archive, sizeof(repo_archive), "%s/filesite", path);
-
	if (pack_db("filesite.yaml", repo_archive, repo_path,
+
	snprintf(repo_path, sizeof(repo_path), "%s/%s", path, repo_filesite_file);
+
	snprintf(repo_archive, sizeof(repo_archive), "%s/%s", path, repo_filesite_archive);
+
	if (pack_db(repo_filesite_file, repo_archive, repo_path,
			rsa_key_path, password_cb) != EPKG_OK)
		return (EPKG_FATAL);

-
	snprintf(repo_path, sizeof(repo_path), "%s/digests", path);
-
	snprintf(repo_archive, sizeof(repo_archive), "%s/digests", path);
-
	if (pack_db("digests", repo_archive, repo_path,
+
	snprintf(repo_path, sizeof(repo_path), "%s/%s", path, repo_digests_file);
+
	snprintf(repo_archive, sizeof(repo_archive), "%s/%s", path, repo_digests_archive);
+
	if (pack_db(repo_digests_file, repo_archive, repo_path,
			rsa_key_path, password_cb) != EPKG_OK)
		return (EPKG_FATAL);

modified libpkg/private/repodb.h
@@ -29,6 +29,15 @@
#ifndef _REPODB
#define _REPODB

+
static const char repo_db_file[] = "repo.sqlite";
+
static const char repo_db_archive[] = "repo";
+
static const char repo_packagesite_file[] = "packagesite.yaml";
+
static const char repo_packagesite_archive[] = "packagesite";
+
static const char repo_filesite_file[] = "filesite.yaml";
+
static const char repo_filesite_archive[] = "filesite";
+
static const char repo_digests_file[] = "digests";
+
static const char repo_digests_archive[] = "digests";
+

static const char initsql[] = ""
	"CREATE TABLE packages ("
	    "id INTEGER PRIMARY KEY,"
modified libpkg/update.c
@@ -89,12 +89,11 @@ repo_fetch_remote_tmp(const char *reponame, const char *filename, time_t *t, int
	}
	(void)unlink(tmp);

-
	if ((*rc != pkg_fetch_file_to_fd(url, fd, t)) != EPKG_OK) {
+
	if ((*rc = pkg_fetch_file_to_fd(url, fd, t)) != EPKG_OK) {
		close(fd);
		fd = -1;
	}

-
	*rc = EPKG_OK;
	return fd;
}