From 1f9a36de6828b87ba9d7dedcae2de6092eed4f41 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Thu, 12 Jan 2012 14:33:29 +0200 Subject: db: support line feed as 'world' dependency separator * default writing the world with spaces if a space is found (for backwards compatibility) for now --- src/database.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/database.c') 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) -- cgit v1.2.3-60-g2f50