summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-12-10 16:42:25 +0200
committerTimo Teräs <timo.teras@iki.fi>2010-12-10 16:42:25 +0200
commit6e34f048c7e200a56761e19fea7801dbfa4b0e27 (patch)
treef72811c837ae2b791b8833def05c241b32c49083 /src
parent1f985b9d0f879c607cc97d23369ddd57453cdaae (diff)
downloadapk-tools-6e34f048c7e200a56761e19fea7801dbfa4b0e27.tar.gz
apk-tools-6e34f048c7e200a56761e19fea7801dbfa4b0e27.tar.bz2
apk-tools-6e34f048c7e200a56761e19fea7801dbfa4b0e27.tar.xz
apk-tools-6e34f048c7e200a56761e19fea7801dbfa4b0e27.zip
db: remove support for unsigned repository index
Unsigned indexes should not be needed anymore anyway.
Diffstat (limited to 'src')
-rw-r--r--src/apk_database.h2
-rw-r--r--src/cache.c9
-rw-r--r--src/database.c40
3 files changed, 11 insertions, 40 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 7b36978..76ce8a9 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -178,7 +178,7 @@ struct apk_repository *apk_db_select_repo(struct apk_database *db,
int apk_repository_update(struct apk_database *db, struct apk_repository *repo);
int apk_db_cache_active(struct apk_database *db);
-void apk_cache_format_index(apk_blob_t to, struct apk_repository *repo, int ver);
+void apk_cache_format_index(apk_blob_t to, struct apk_repository *repo);
int apk_cache_download(struct apk_database *db, const char *url,
const char *item, const char *cache_item, int verify);
diff --git a/src/cache.c b/src/cache.c
index 5311815..60c7aeb 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -97,12 +97,9 @@ static int cache_clean(struct apk_database *db)
if (apk_pkg_parse_name(b, &bname, &bver) < 0) {
/* Index - check for matching repository */
for (i = 0; i < db->num_repos; i++) {
- apk_cache_format_index(APK_BLOB_BUF(tmp), &db->repos[i], 0);
- if (apk_blob_compare(b, APK_BLOB_STR(tmp)) != 0) {
- apk_cache_format_index(APK_BLOB_BUF(tmp), &db->repos[i], 1);
- if (apk_blob_compare(b, APK_BLOB_STR(tmp)) != 0)
- continue;
- }
+ apk_cache_format_index(APK_BLOB_BUF(tmp), &db->repos[i]);
+ if (apk_blob_compare(b, APK_BLOB_STR(tmp)) != 0)
+ continue;
delete = 0;
break;
}
diff --git a/src/database.c b/src/database.c
index 5edc604..8f9e931 100644
--- a/src/database.c
+++ b/src/database.c
@@ -39,7 +39,6 @@ int apk_verbosity = 1;
unsigned int apk_flags = 0;
const char * const apkindex_tar_gz = "APKINDEX.tar.gz";
-const char * const apk_index_gz = "APK_INDEX.gz";
static const char * const apk_static_cache_dir = "var/lib/apk";
static const char * const apk_linked_cache_dir = "etc/apk/cache";
@@ -429,20 +428,13 @@ struct apk_package *apk_db_pkg_add(struct apk_database *db, struct apk_package *
return idb;
}
-void apk_cache_format_index(apk_blob_t to, struct apk_repository *repo, int ver)
+void apk_cache_format_index(apk_blob_t to, struct apk_repository *repo)
{
/* APKINDEX.12345678.tar.gz */
- /* APK_INDEX.12345678.gz */
- if (ver == 0)
- apk_blob_push_blob(&to, APK_BLOB_STR("APKINDEX."));
- else
- apk_blob_push_blob(&to, APK_BLOB_STR("APK_INDEX."));
+ apk_blob_push_blob(&to, APK_BLOB_STR("APKINDEX."));
apk_blob_push_hexdump(&to, APK_BLOB_PTR_LEN((char *) repo->csum.data,
APK_CACHE_CSUM_BYTES));
- if (ver == 0)
- apk_blob_push_blob(&to, APK_BLOB_STR(".tar.gz"));
- else
- apk_blob_push_blob(&to, APK_BLOB_STR(".gz"));
+ apk_blob_push_blob(&to, APK_BLOB_STR(".tar.gz"));
apk_blob_push_blob(&to, APK_BLOB_PTR_LEN("", 1));
}
@@ -1462,21 +1454,13 @@ int apk_repository_update(struct apk_database *db, struct apk_repository *repo)
if (!apk_repo_is_remote(repo))
return 0;
- apk_cache_format_index(APK_BLOB_BUF(cacheitem), repo, 0);
+ apk_cache_format_index(APK_BLOB_BUF(cacheitem), repo);
r = apk_cache_download(db, repo->url, apkindex_tar_gz, cacheitem,
(apk_flags & APK_ALLOW_UNTRUSTED) ?
APK_SIGN_NONE : APK_SIGN_VERIFY);
- if (r == 0 || r == -ENOKEY || r == -EKEYREJECTED) {
- if (r != 0)
- apk_error("%s: %s", repo->url, apk_error_str(r));
- return r;
- }
-
- apk_cache_format_index(APK_BLOB_BUF(cacheitem), repo, 1);
- r = apk_cache_download(db, repo->url, apk_index_gz, cacheitem,
- APK_SIGN_NONE);
if (r != 0)
- apk_error("Failed to update %s: download failed", repo->url);
+ apk_error("%s: %s", repo->url, apk_error_str(r));
+
return r;
}
@@ -1575,21 +1559,11 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t repository)
if (apk_flags & APK_UPDATE_CACHE)
apk_repository_update(db, repo);
- apk_cache_format_index(APK_BLOB_BUF(buf), repo, 0);
+ apk_cache_format_index(APK_BLOB_BUF(buf), repo);
bs = apk_bstream_from_file(db->cache_fd, buf);
- if (bs == NULL) {
- apk_cache_format_index(APK_BLOB_BUF(buf), repo, 1);
- bs = apk_bstream_from_file(db->cache_fd, buf);
- targz = 0;
- }
} else {
db->local_repos |= BIT(r);
-
bs = apk_repo_file_open(repo, apkindex_tar_gz, buf, sizeof(buf));
- if (bs == NULL) {
- bs = apk_repo_file_open(repo, apk_index_gz, buf, sizeof(buf));
- targz = 0;
- }
}
if (bs == NULL) {
apk_warning("Failed to open index for %s", repo->url);