Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add the iterator function for accessing the list of abstract metadata k-v pairs.
Matthew Seaman committed 13 years ago
commit 1a74e4080e883471567ed587c60caba893db5083
parent 77a4678
3 files changed +17 -2
modified libpkg/pkg.c
@@ -476,6 +476,14 @@ pkg_shlibs_provided(struct pkg *pkg, struct pkg_shlib **s)
}

int
+
pkg_abstract_metadata(struct pkg *pkg, struct pkg_abstract **am)
+
{
+
	assert(pkg != NULL);
+

+
	HASH_NEXT(pkg->abstract_metadata, (*am));
+
}
+

+
int
pkg_addlicense(struct pkg *pkg, const char *name)
{
	struct pkg_license *l = NULL;
modified libpkg/pkg.h.in
@@ -588,6 +588,13 @@ int pkg_shlibs_required(struct pkg *pkg, struct pkg_shlib **shlib);
int pkg_shlibs_provided(struct pkg *pkg, struct pkg_shlib **shlib);

/**
+
 * Iterates over the abstract metatdata associated with the package.
+
 * @param abstract must be set to NULL for the first call.
+
 * @return An error code
+
 */
+
int pkg_abstract_metadata(struct pkg *pkg, struct pkg_abstract **abstract);
+

+
/**
 * Iterate over all of the files within the package pkg, ensuring the
 * dependency list contains all applicable packages providing the
 * shared objects used by pkg.
modified libpkg/pkg_manifest.c
@@ -867,7 +867,7 @@ emit_manifest(struct pkg *pkg, yaml_emitter_t *emitter, bool compact)
	struct pkg_user *user = NULL;
	struct pkg_group *group = NULL;
	struct pkg_shlib *shlib = NULL;
-
	struct pkg_abtract *abstract = NULL;
+
	struct pkg_abstract *abstract = NULL;
	struct sbuf *tmpsbuf = NULL;
	int rc = EPKG_OK;
	int mapping;
@@ -985,7 +985,7 @@ emit_manifest(struct pkg *pkg, yaml_emitter_t *emitter, bool compact)
	}
	map = -1;
	while (pkg_abstract_metadata(pkg, &abstract) == EPKG_OK) {
-
		if (map = -1)
+
		if (map == -1)
			manifest_append_map(map, mapping, "abstract_metadata", FLOW);
		manifest_append_kv(map, pkg_abstract_key(abstract),
		    pkg_abstract_value(abstract), PLAIN);