summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-01-12 14:33:29 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-01-12 14:33:29 +0200
commit1f9a36de6828b87ba9d7dedcae2de6092eed4f41 (patch)
treef928b3e94711951f603624a19924c290da362b8a /src/database.c
parent30965aa86735f7d2dcd544bae0b788195c51f336 (diff)
downloadapk-tools-1f9a36de6828b87ba9d7dedcae2de6092eed4f41.tar.gz
apk-tools-1f9a36de6828b87ba9d7dedcae2de6092eed4f41.tar.bz2
apk-tools-1f9a36de6828b87ba9d7dedcae2de6092eed4f41.tar.xz
apk-tools-1f9a36de6828b87ba9d7dedcae2de6092eed4f41.zip
db: support line feed as 'world' dependency separator
* default writing the world with spaces if a space is found (for backwards compatibility) for now
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c
index e3c10c5..57c9009 100644
--- a/src/database.c
+++ b/src/database.c
@@ -917,6 +917,9 @@ static int apk_db_read_state(struct apk_database *db, int flags)
blob = apk_blob_from_file(db->root_fd, apk_world_file);
if (APK_BLOB_IS_NULL(blob))
return -ENOENT;
+ blob = apk_blob_trim(blob);
+ if (apk_blob_chr(blob, ' '))
+ db->compat_old_world = 1;
apk_blob_pull_deps(&blob, db, &db->world);
free(blob.ptr);
}
@@ -1312,10 +1315,11 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
goto ret_r;
}
- for (i = 0; i < db->num_repo_tags; i++) {
+ /* repository id 0 is the no-tag repo */
+ for (i = 1; i < db->num_repo_tags; i++) {
if (!db->repo_tags[i].allowed_repos) {
- apk_warning("Repository tag '" BLOB_FMT "' used in world is no longer available",
- BLOB_PRINTF(*db->repo_tags[i].name));
+ apk_warning("Repository tag (%d) '" BLOB_FMT "' used in world is no longer available",
+ i, BLOB_PRINTF(*db->repo_tags[i].name));
db->missing_tags = 1;
}
}
@@ -1364,7 +1368,7 @@ int apk_db_write_config(struct apk_database *db)
if (os == NULL)
return -1;
- apk_deps_write(db, db->world, os);
+ apk_deps_write(db, db->world, os, APK_BLOB_PTR_LEN(db->compat_old_world ? " " : "\n", 1));
os->write(os, "\n", 1);
r = os->close(os);
if (r < 0)