diff options
author | Timo Teräs <timo.teras@iki.fi> | 2011-04-04 14:05:52 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2011-04-04 14:05:52 +0300 |
commit | 5a9d8323a088e370a5943071e78f9c3032aed261 (patch) | |
tree | 6b7f0984c294eba6268f3149ed5d36bb566706e0 /src/package.c | |
parent | 0cc2086e27a2109e13e8925b882d1014b5bab96b (diff) | |
download | apk-tools-5a9d8323a088e370a5943071e78f9c3032aed261.tar.gz apk-tools-5a9d8323a088e370a5943071e78f9c3032aed261.tar.bz2 apk-tools-5a9d8323a088e370a5943071e78f9c3032aed261.tar.xz apk-tools-5a9d8323a088e370a5943071e78f9c3032aed261.zip |
pkg: add origin, maintainer, build_time and commit id to index
Parse these fields from .PKGINFO, and write them to index.
Diffstat (limited to 'src/package.c')
-rw-r--r-- | src/package.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/package.c b/src/package.c index 1a5d502..2699420 100644 --- a/src/package.c +++ b/src/package.c @@ -659,6 +659,18 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg, case 'i': apk_deps_parse(db, &pkg->install_if, value); break; + case 'o': + pkg->origin = apk_blob_atomize_dup(value); + break; + case 'm': + pkg->maintainer = apk_blob_atomize_dup(value); + break; + case 't': + pkg->build_time = apk_blob_pull_uint(&value, 10); + break; + case 'c': + pkg->commit = apk_blob_cstr(value); + break; case 'F': case 'M': case 'R': case 'Z': /* installed db entries which are handled in database.c */ return 1; @@ -691,6 +703,10 @@ static int read_info_line(void *ctx, apk_blob_t line) { "arch", 'A' }, { "depend", 'D' }, { "install_if", 'i' }, + { "origin", 'o' }, + { "maintainer", 'm' }, + { "builddate", 't' }, + { "commit", 'c' }, }; struct read_info_ctx *ri = (struct read_info_ctx *) ctx; apk_blob_t l, r; @@ -800,6 +816,8 @@ void apk_pkg_free(struct apk_package *pkg) free(pkg->url); if (pkg->description) free(pkg->description); + if (pkg->commit) + free(pkg->commit); free(pkg); } @@ -968,6 +986,22 @@ int apk_pkg_write_index_entry(struct apk_package *info, apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->url)); apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nL:")); apk_blob_push_blob(&bbuf, *info->license); + if (info->origin) { + apk_blob_push_blob(&bbuf, APK_BLOB_STR("\no:")); + apk_blob_push_blob(&bbuf, *info->origin); + } + if (info->maintainer) { + apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nm:")); + apk_blob_push_blob(&bbuf, *info->maintainer); + } + if (info->build_time) { + apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nt:")); + apk_blob_push_uint(&bbuf, info->build_time, 10); + } + if (info->commit) { + apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nc:")); + apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->commit)); + } apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n")); if (APK_BLOB_IS_NULL(bbuf)) |