summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-04-04 13:19:12 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-04-04 13:19:12 +0300
commit0cc2086e27a2109e13e8925b882d1014b5bab96b (patch)
tree946d1edd7b7638fe09b052fc112d8b9447c82da6
parentdded261924dba3d86200a2c748443d0f3ec3247b (diff)
downloadapk-tools-0cc2086e27a2109e13e8925b882d1014b5bab96b.tar.gz
apk-tools-0cc2086e27a2109e13e8925b882d1014b5bab96b.tar.bz2
apk-tools-0cc2086e27a2109e13e8925b882d1014b5bab96b.tar.xz
apk-tools-0cc2086e27a2109e13e8925b882d1014b5bab96b.zip
index: support rewriting of architecture
Our build infra does not yet handle properly noarch, so for the time being we will rewrite them as native packages in index. This allows the package to be fetched from the proper URL. This feature will be removed once abuild and the build infra handle noarch properly.
-rw-r--r--src/index.c15
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 = {