Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Allow pkg info to print dependencies on local files
Baptiste Daroussin committed 15 years ago
commit 7231e409b6cac3875d16d9ee426a463249e25e6c
parent 7f3adc8
2 files changed +40 -1
modified libpkg/pkg.c
@@ -90,6 +90,9 @@ pkg_open(const char *path, struct pkg **pkg, int query_flags)
	 * informations */

	pkg_new(pkg);
+
	(*pkg)->type = PKG_FILE;
+

+
	array_init(&(*pkg)->deps, 5);

	while ((ret = archive_read_next_header(a, &ae)) == ARCHIVE_OK) {
		if (!strcmp(archive_entry_pathname(ae),"+DESC")) {
modified libpkg/pkg_manifest.c
@@ -149,7 +149,43 @@ m_parse_option(struct pkg *pkg, char *buf)
static int
m_parse_dep(struct pkg *pkg, char *buf)
{
-
	/* TODO */
+
	struct pkg *dep;
+
	char *buf_ptr;
+
	int nbel, i;
+
	size_t next;
+

+
	while (isspace(*buf))
+
		buf++;
+

+
	buf_ptr = buf;
+

+
	nbel = split_chr(buf_ptr, ' ');
+

+
	pkg_new(&dep);
+

+
	next = strlen(buf_ptr);
+
	for (i = 0; i <= nbel; i++) {
+
		switch(i) {
+
			case 0:
+
				sbuf_cat(dep->name, buf_ptr);
+
				sbuf_finish(dep->name);
+
				break;
+
			case 1:
+
				sbuf_cat(dep->origin, buf_ptr);
+
				sbuf_finish(dep->origin);
+
				break;
+
			case 2:
+
				sbuf_cat(dep->version, buf_ptr);
+
				sbuf_finish(dep->version);
+
				break;
+
		}
+
		buf_ptr += next + 1;
+
		next = strlen(buf_ptr);
+
	}
+

+
	dep->type = PKG_NOTFOUND;
+
	array_append(&pkg->deps, dep);
+

	return (0);
}