summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-24 09:37:17 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-24 10:13:05 +0200
commite128c95fdfe8293c8838551249c7dec20aa91818 (patch)
tree38d98e25abda5c2ac21da7cf124c4d1f1787766d
parent9ef5bf6e2dc42eb5ba834455f8e5e3e8bc5fed7d (diff)
downloadapk-tools-e128c95fdfe8293c8838551249c7dec20aa91818.tar.gz
apk-tools-e128c95fdfe8293c8838551249c7dec20aa91818.tar.bz2
apk-tools-e128c95fdfe8293c8838551249c7dec20aa91818.tar.xz
apk-tools-e128c95fdfe8293c8838551249c7dec20aa91818.zip
pkg: add field for provides as 'p'
ref #574
-rw-r--r--src/apk_package.h2
-rw-r--r--src/package.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/apk_package.h b/src/apk_package.h
index 329bdec..8321682 100644
--- a/src/apk_package.h
+++ b/src/apk_package.h
@@ -93,7 +93,7 @@ struct apk_package {
apk_blob_t *origin, *maintainer;
char *url, *description, *commit;
char *filename;
- struct apk_dependency_array *depends, *install_if;
+ struct apk_dependency_array *depends, *install_if, *provides;
size_t installed_size, size;
time_t build_time;
unsigned int topology_hard;
diff --git a/src/package.c b/src/package.c
index 74ce183..5b89c0b 100644
--- a/src/package.c
+++ b/src/package.c
@@ -69,6 +69,7 @@ struct apk_package *apk_pkg_new(void)
if (pkg != NULL) {
apk_dependency_array_init(&pkg->depends);
apk_dependency_array_init(&pkg->install_if);
+ apk_dependency_array_init(&pkg->provides);
}
return pkg;
@@ -732,6 +733,9 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg,
case 'I':
pkg->installed_size = apk_blob_pull_uint(&value, 10);
break;
+ case 'p':
+ apk_blob_pull_deps(&value, db, &pkg->provides);
+ break;
case 'i':
apk_blob_pull_deps(&value, db, &pkg->install_if);
break;
@@ -748,7 +752,7 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg,
pkg->commit = apk_blob_cstr(value);
break;
case 'F': case 'M': case 'R': case 'Z': case 'r': case 'q':
- case 'a': case 'p': case 's':
+ case 'a': case 's':
/* installed db entries which are handled in database.c */
return 1;
default:
@@ -780,6 +784,7 @@ static int read_info_line(void *ctx, apk_blob_t line)
{ "arch", 'A' },
{ "depend", 'D' },
{ "install_if", 'i' },
+ { "provides", 'p' },
{ "origin", 'o' },
{ "maintainer", 'm' },
{ "builddate", 't' },
@@ -1093,6 +1098,7 @@ int apk_pkg_write_index_entry(struct apk_package *info,
bbuf = apk_blob_pushed(APK_BLOB_BUF(buf), bbuf);
if (os->write(os, bbuf.ptr, bbuf.len) != bbuf.len ||
write_depends(os, "D:", info->depends) ||
+ write_depends(os, "p:", info->provides) ||
write_depends(os, "i:", info->install_if))
return -1;