Commit 02e6dcfa authored by Timo Teräs's avatar Timo Teräs

index: do not generate indexes with Arch field

it's not backwards compatible with older apk-tools in the
alpine-2.1.x branch.
parent 1d0204e0
......@@ -150,7 +150,7 @@ int apk_ipkg_run_script(struct apk_installed_package *ipkg,
unsigned int type, char **argv);
struct apk_package *apk_pkg_parse_index_entry(struct apk_database *db, apk_blob_t entry);
int apk_pkg_write_index_entry(struct apk_package *pkg, struct apk_ostream *os);
int apk_pkg_write_index_entry(struct apk_package *pkg, struct apk_ostream *os, int write_arch);
int apk_pkg_version_compare(struct apk_package *a, struct apk_package *b);
......
......@@ -683,7 +683,7 @@ static int apk_db_write_fdb(struct apk_database *db, struct apk_ostream *os)
list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) {
pkg = ipkg->pkg;
r = apk_pkg_write_index_entry(pkg, os);
r = apk_pkg_write_index_entry(pkg, os, TRUE);
if (r < 0)
return r;
......@@ -948,6 +948,7 @@ struct index_write_ctx {
struct apk_ostream *os;
int count;
int force;
int write_arch;
};
static int write_index_entry(apk_hash_item item, void *ctx)
......@@ -959,7 +960,7 @@ static int write_index_entry(apk_hash_item item, void *ctx)
if (!iwctx->force && pkg->filename == NULL)
return 0;
r = apk_pkg_write_index_entry(pkg, iwctx->os);
r = apk_pkg_write_index_entry(pkg, iwctx->os, iwctx->write_arch);
if (r < 0)
return r;
......@@ -972,7 +973,7 @@ static int write_index_entry(apk_hash_item item, void *ctx)
static int apk_db_index_write_nr_cache(struct apk_database *db)
{
struct index_write_ctx ctx = { NULL, 0, TRUE };
struct index_write_ctx ctx = { NULL, 0, TRUE, TRUE };
struct apk_installed_package *ipkg;
struct apk_ostream *os;
int r;
......@@ -1006,7 +1007,7 @@ static int apk_db_index_write_nr_cache(struct apk_database *db)
int apk_db_index_write(struct apk_database *db, struct apk_ostream *os)
{
struct index_write_ctx ctx = { os, 0, FALSE };
struct index_write_ctx ctx = { os, 0, FALSE, FALSE };
apk_hash_foreach(&db->available.packages, write_index_entry, &ctx);
......
......@@ -637,9 +637,9 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg,
case 'L':
pkg->license = apk_blob_cstr(value);
break;
case 'A':
pkg->arch = apk_blob_cstr(value);
break;
case 'A':
pkg->arch = apk_blob_cstr(value);
break;
case 'D':
apk_deps_parse(db, &pkg->depends, value);
break;
......@@ -970,7 +970,7 @@ struct apk_package *apk_pkg_parse_index_entry(struct apk_database *db, apk_blob_
}
int apk_pkg_write_index_entry(struct apk_package *info,
struct apk_ostream *os)
struct apk_ostream *os, int write_arch)
{
char buf[512];
apk_blob_t bbuf = APK_BLOB_BUF(buf);
......@@ -982,9 +982,9 @@ int apk_pkg_write_index_entry(struct apk_package *info,
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->name->name));
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nV:"));
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->version));
if (info->arch != NULL) {
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nA:"));
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->arch));
if (write_arch && info->arch != NULL) {
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nA:"));
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->arch));
}
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nS:"));
apk_blob_push_uint(&bbuf, info->size, 10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment