summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2010-03-04 14:01:37 +0200
committerTimo Teras <timo.teras@iki.fi>2010-03-04 14:01:37 +0200
commitef7d467083f88e2473c697b111eeea9ca5649bda (patch)
tree81ce6aa0bcba18ca4583dcf3e6dda0b604a77f2f
parent4b29ea2a081d4002b7fea7e4caa0be760b3731af (diff)
downloadapk-tools-ef7d467083f88e2473c697b111eeea9ca5649bda.tar.bz2
apk-tools-ef7d467083f88e2473c697b111eeea9ca5649bda.tar.xz
fetch: do not include installed non-repository files in search
we do not create mirror repositories from other valid repositories, not from what was installed locally.
-rw-r--r--src/apk_database.h19
-rw-r--r--src/database.c5
-rw-r--r--src/fetch.c8
3 files changed, 19 insertions, 13 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 8ec7bac..da3b0ae 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -140,14 +140,17 @@ struct apk_db_file *apk_db_file_query(struct apk_database *db,
apk_blob_t dir,
apk_blob_t name);
-#define APK_OPENF_READ 0x0001
-#define APK_OPENF_WRITE 0x0002
-#define APK_OPENF_CREATE 0x0004
-#define APK_OPENF_NO_INSTALLED 0x0010
-#define APK_OPENF_NO_SCRIPTS 0x0020
-#define APK_OPENF_NO_WORLD 0x0040
-#define APK_OPENF_NO_REPOS 0x0080
-
+#define APK_OPENF_READ 0x0001
+#define APK_OPENF_WRITE 0x0002
+#define APK_OPENF_CREATE 0x0004
+#define APK_OPENF_NO_INSTALLED 0x0010
+#define APK_OPENF_NO_SCRIPTS 0x0020
+#define APK_OPENF_NO_WORLD 0x0040
+#define APK_OPENF_NO_SYS_REPOS 0x0100
+#define APK_OPENF_NO_INSTALLED_REPO 0x0200
+
+#define APK_OPENF_NO_REPOS (APK_OPENF_NO_SYS_REPOS | \
+ APK_OPENF_NO_INSTALLED_REPO)
#define APK_OPENF_NO_STATE (APK_OPENF_NO_INSTALLED | \
APK_OPENF_NO_SCRIPTS | \
APK_OPENF_NO_WORLD)
diff --git a/src/database.c b/src/database.c
index 7c7f8e2..ae7bbfc 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1131,7 +1131,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
goto ret_r;
}
- if (!(dbopts->open_flags & APK_OPENF_NO_REPOS)) {
+ if (!(dbopts->open_flags & APK_OPENF_NO_INSTALLED_REPO)) {
if (apk_db_cache_active(db)) {
bs = apk_bstream_from_file(db->cache_fd, "installed");
if (bs != NULL) {
@@ -1139,7 +1139,8 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
bs->close(bs, NULL);
}
}
-
+ }
+ if (!(dbopts->open_flags & APK_OPENF_NO_SYS_REPOS)) {
list_for_each_entry(repo, &dbopts->repository_list, list) {
r = apk_db_add_repository(db, APK_BLOB_STR(repo->url));
rr = r ?: rr;
diff --git a/src/fetch.c b/src/fetch.c
index f827d95..67b3322 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -240,10 +240,12 @@ static struct apk_option fetch_options[] = {
static struct apk_applet apk_fetch = {
.name = "fetch",
- .help = "Download PACKAGEs from repositories to a local directory from "
- "which a local mirror repository can be created.",
+ .help = "Download PACKAGEs from global repositories to a local "
+ "directory from which a local mirror repository can be "
+ "created.",
.arguments = "PACKAGE...",
- .open_flags = APK_OPENF_READ|APK_OPENF_NO_STATE,
+ .open_flags = APK_OPENF_READ | APK_OPENF_NO_STATE |
+ APK_OPENF_NO_INSTALLED_REPO,
.context_size = sizeof(struct fetch_ctx),
.num_options = ARRAY_SIZE(fetch_options),
.options = fetch_options,