summaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-03-17 13:19:06 +0200
committerTimo Teras <timo.teras@iki.fi>2009-03-17 13:19:06 +0200
commit7735cc644d342e39b8b2b71da6890656d1846fab (patch)
tree8f180bd7fde819b744d98d2859f502707a97e187 /src/package.c
parent57391d1e4c4b8464ca14b464cc6c29987922fe88 (diff)
downloadapk-tools-7735cc644d342e39b8b2b71da6890656d1846fab.tar.bz2
apk-tools-7735cc644d342e39b8b2b71da6890656d1846fab.tar.xz
pkg: write dependencies directly file instead of buffer
So we don't get artificial limits on the amount of dependencies (fixes #8).
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/package.c b/src/package.c
index a5e988b..4d9f33d 100644
--- a/src/package.c
+++ b/src/package.c
@@ -149,6 +149,29 @@ int apk_deps_format(char *buf, int size,
return n;
}
+int apk_deps_write(struct apk_dependency_array *deps, struct apk_ostream *os)
+{
+ int i, len, n = 0;
+
+ if (deps == NULL)
+ return 0;
+
+ for (i = 0; i < deps->num; i++) {
+ if (i) {
+ if (os->write(os, " ", 1) != 1)
+ return -1;
+ n += 1;
+ }
+
+ len = strlen(deps->item[i].name->name);
+ if (os->write(os, deps->item[i].name->name, len) != len)
+ return -1;
+ n += len;
+ }
+
+ return n;
+}
+
static const char *script_types[] = {
[APK_SCRIPT_PRE_INSTALL] = "pre-install",
[APK_SCRIPT_POST_INSTALL] = "post-install",