summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Gustafsson <fredrigu@axis.com>2019-11-20 17:01:45 +0100
committerTimo Teräs <timo.teras@iki.fi>2020-05-06 15:49:33 +0300
commit68639286775e4cc0efbd5494475b23bb85218f3a (patch)
tree171b842b9cb967bff93107eb613c3c9460940ee8
parent1d7123d83796182f851ccccaf056063955343718 (diff)
downloadapk-tools-68639286775e4cc0efbd5494475b23bb85218f3a.tar.gz
apk-tools-68639286775e4cc0efbd5494475b23bb85218f3a.tar.bz2
apk-tools-68639286775e4cc0efbd5494475b23bb85218f3a.tar.xz
apk-tools-68639286775e4cc0efbd5494475b23bb85218f3a.zip
index: add argument --no-warnings
When creating an index apk warns if a dependency is missing a provider. However when using a multi-arch repository, it's not an error that a certain architecture is missing a dependency because that dependency could be in an other architecture. Since apk index doesn't know about this, add an argument to disable that warning. Maintainer note: rebased for new option handling, and minor stylistic adjustments. Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com>
-rw-r--r--doc/apk-index.8.scd5
-rw-r--r--src/app_index.c12
2 files changed, 16 insertions, 1 deletions
diff --git a/doc/apk-index.8.scd b/doc/apk-index.8.scd
index df01bac..92a75d7 100644
--- a/doc/apk-index.8.scd
+++ b/doc/apk-index.8.scd
@@ -30,6 +30,11 @@ will accept it. See *abuild-sign*(1) for details.
Read an existing index from _INDEX_ to speed up the creation of the new
index by reusing data when possible.
+*--no-warnings*
+ Disable the warning about missing dependencies. This happens when A,
+ depends on package B, that does not have a provider in the indexed
+ repository.
+
# AUTHORS
Natanael Copa <ncopa@alpinelinux.org>++
diff --git a/src/app_index.c b/src/app_index.c
index 8bd3a6a..8a9ba8c 100644
--- a/src/app_index.c
+++ b/src/app_index.c
@@ -19,6 +19,8 @@
#include "apk_database.h"
#include "apk_print.h"
+#define APK_INDEXF_NO_WARNINGS 0x0001
+
struct counts {
int unsatisfied;
};
@@ -30,11 +32,13 @@ struct index_ctx {
apk_blob_t *rewrite_arch;
time_t index_mtime;
int method;
+ unsigned short index_flags;
};
enum {
OPT_INDEX_description,
OPT_INDEX_index,
+ OPT_INDEX_no_warnings,
OPT_INDEX_output,
OPT_INDEX_rewrite_arch,
};
@@ -43,6 +47,7 @@ static const char option_desc[] =
APK_OPTAPPLET
APK_OPT2R("description", "d")
APK_OPT2R("index", "x")
+ APK_OPT1n("no-warnings")
APK_OPT2R("output", "o")
APK_OPT1R("rewrite-arch");
@@ -63,6 +68,9 @@ static int option_parse_applet(void *ctx, struct apk_db_options *dbopts, int opt
case OPT_INDEX_rewrite_arch:
ictx->rewrite_arch = apk_blob_atomize(APK_BLOB_STR(optarg));
break;
+ case OPT_INDEX_no_warnings:
+ ictx->index_flags |= APK_INDEXF_NO_WARNINGS;
+ break;
default:
return -ENOTSUP;
}
@@ -244,7 +252,9 @@ static int index_main(void *ctx, struct apk_database *db, struct apk_string_arra
}
total = r;
- apk_hash_foreach(&db->available.names, warn_if_no_providers, &counts);
+ if (!(ictx->index_flags & APK_INDEXF_NO_WARNINGS)) {
+ apk_hash_foreach(&db->available.names, warn_if_no_providers, &counts);
+ }
if (counts.unsatisfied != 0)
apk_warning("Total of %d unsatisfiable package "