diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-20 17:51:44 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-20 17:51:44 +0200 |
commit | f372bfd978be3874c3361cc022e8fc5842657ad2 (patch) | |
tree | c058b1de64347d4e65e862a1f5f9124434240a24 /src/index.c | |
parent | fde9ad1782dd4ddb28c428b488e0278471a91c90 (diff) | |
parent | 35bba3de1f4d6464dc03ffc60b6a6b6ec25ef6b0 (diff) | |
download | apk-tools-lua.tar.bz2 apk-tools-lua.tar.xz |
Conflicts:
src/lua-apk.c
Diffstat (limited to 'src/index.c')
-rw-r--r-- | src/index.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c index d2b4b01..442e98a 100644 --- a/src/index.c +++ b/src/index.c @@ -25,6 +25,7 @@ struct index_ctx { const char *index; const char *output; const char *description; + apk_blob_t *rewrite_arch; time_t index_mtime; int method; }; @@ -44,6 +45,9 @@ static int index_parse(void *ctx, struct apk_db_options *dbopts, case 'd': ictx->description = optarg; break; + case 0x10000: + ictx->rewrite_arch = apk_blob_atomize(APK_BLOB_STR(optarg)); + break; default: return -1; } @@ -88,6 +92,7 @@ static int index_main(void *ctx, struct apk_database *db, int argc, char **argv) struct apk_file_info fi; int total, r, i, j, found, newpkgs = 0; struct index_ctx *ictx = (struct index_ctx *) ctx; + struct apk_package *pkg; if (isatty(STDOUT_FILENO) && ictx->output == NULL && !(apk_flags & APK_FORCE)) { @@ -139,12 +144,14 @@ static int index_main(void *ctx, struct apk_database *db, int argc, char **argv) break; for (j = 0; j < name->pkgs->num; j++) { - struct apk_package *pkg = name->pkgs->item[j]; + pkg = name->pkgs->item[j]; if (apk_blob_compare(bver, *pkg->version) != 0) continue; if (pkg->size != fi.size) continue; pkg->filename = strdup(argv[i]); + if (ictx->rewrite_arch != NULL) + pkg->arch = ictx->rewrite_arch; found = TRUE; break; } @@ -153,8 +160,10 @@ static int index_main(void *ctx, struct apk_database *db, int argc, char **argv) if (!found) { struct apk_sign_ctx sctx; apk_sign_ctx_init(&sctx, ictx->method, NULL, db->keys_fd); - if (apk_pkg_read(db, argv[i], &sctx, NULL) == 0) + if (apk_pkg_read(db, argv[i], &sctx, &pkg) == 0) newpkgs++; + if (ictx->rewrite_arch != NULL) + pkg->arch = ictx->rewrite_arch; apk_sign_ctx_free(&sctx); } } @@ -214,6 +223,8 @@ static struct apk_option index_options[] = { { 'd', "description", "Embed TEXT as description and version " "information of the repository index", required_argument, "TEXT" }, + { 0x10000, "rewrite-arch", "Use ARCH as architery for all packages", + required_argument, "ARCH" }, }; static struct apk_applet apk_index = { |