From 09385545d99ecd20034b9c369396b20982b79351 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Sun, 11 Jan 2009 14:03:55 +0000 Subject: db, package: new dependency format, second try dependencies are separated with single space rather than ', '. makes db file slightly easier to parse from a shell script which might be handy. --- src/database.c | 4 ++-- src/package.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/database.c b/src/database.c index 9e6feb7..a45d8d1 100644 --- a/src/database.c +++ b/src/database.c @@ -502,8 +502,8 @@ static int apk_db_scriptdb_read(struct apk_database *db, struct apk_istream *is) int apk_db_create(const char *root) { - apk_blob_t deps = APK_BLOB_STR("busybox, alpine-baselayout, " - "apk-tools, alpine-conf\n"); + apk_blob_t deps = APK_BLOB_STR("busybox alpine-baselayout " + "apk-tools alpine-conf\n"); int fd; fchdir(apk_cwd_fd); diff --git a/src/package.c b/src/package.c index 9f33201..6978ede 100644 --- a/src/package.c +++ b/src/package.c @@ -123,13 +123,13 @@ void apk_deps_parse(struct apk_database *db, int i; start = blob.ptr; - for (i = 0; i < blob.len; i++) { - if (blob.ptr[i] != ',' && blob.ptr[i] != '\n') + for (i = 0; i < blob.len && blob.ptr[i] != '\n'; i++) { + if (blob.ptr[i] != ' ') continue; parse_depend(db, depends, APK_BLOB_PTR_PTR(start, &blob.ptr[i-1])); - start = &blob.ptr[i+1]; + start = &blob.ptr[i]; } parse_depend(db, depends, APK_BLOB_PTR_PTR(start, &blob.ptr[i-1])); @@ -145,7 +145,7 @@ int apk_deps_format(char *buf, int size, for (i = 0; i < depends->num - 1; i++) n += snprintf(&buf[n], size-n, - "%s, ", + "%s ", depends->item[i].name->name); n += snprintf(&buf[n], size-n, "%s\n", -- cgit v1.2.3-70-g09d2