summaryrefslogtreecommitdiffstats
path: root/src/index.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-16 15:14:23 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-16 15:14:23 +0200
commit1b5422fb4af4bb836d15e07c86128507147315d0 (patch)
tree3157af3499f45ab0ba28177e64e33363f2518b71 /src/index.c
parent6b6c10cdf244d3a307df4c339cde774600d49f49 (diff)
downloadapk-tools-1b5422fb4af4bb836d15e07c86128507147315d0.tar.bz2
apk-tools-1b5422fb4af4bb836d15e07c86128507147315d0.tar.xz
index: write out only packages specified in command line
Ignore /etc/apk/repositories, so additional repositories that depend on other repositories need to have explicit --repository reference on command line when generating the index (to avoid warnings).
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/index.c b/src/index.c
index 81adc51..c272b74 100644
--- a/src/index.c
+++ b/src/index.c
@@ -16,7 +16,6 @@
#include "apk_database.h"
struct counts {
- int total;
int unsatisfied;
};
@@ -34,7 +33,6 @@ static int warn_if_no_providers(apk_hash_item item, void *ctx)
"not reporting the rest.");
}
}
- counts->total++;
return 0;
}
@@ -42,16 +40,16 @@ static int warn_if_no_providers(apk_hash_item item, void *ctx)
static int index_main(void *ctx, int argc, char **argv)
{
struct apk_database db;
- struct counts counts = {0,0};
+ struct counts counts = {0};
struct apk_ostream *os;
- int i;
+ int total, i;
apk_db_open(&db, NULL);
for (i = 0; i < argc; i++)
apk_db_pkg_add_file(&db, argv[i]);
os = apk_ostream_to_fd(STDOUT_FILENO);
- apk_db_index_write(&db, os);
+ total = apk_db_index_write(&db, os);
os->close(os);
apk_hash_foreach(&db.available.names, warn_if_no_providers, &counts);
@@ -61,7 +59,7 @@ static int index_main(void *ctx, int argc, char **argv)
apk_warning("Total of %d unsatisfiable package "
"names. Your repository maybe broken.",
counts.unsatisfied);
- apk_message("Index has %d packages", counts.total);
+ apk_message("Index has %d packages", total);
return 0;
}