summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/apk_package.h2
-rw-r--r--src/database.c9
-rw-r--r--src/package.c14
3 files changed, 13 insertions, 12 deletions
diff --git a/src/apk_package.h b/src/apk_package.h
index 43fd10c..a2c00ad 100644
--- a/src/apk_package.h
+++ b/src/apk_package.h
@@ -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);
diff --git a/src/database.c b/src/database.c
index 276af2b..849c3c2 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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);
diff --git a/src/package.c b/src/package.c
index ae01ad7..55dc5aa 100644
--- a/src/package.c
+++ b/src/package.c
@@ -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);