forked from ariadne/pkgconf
dependency: add pkg_dependency_parse_str() for breaking out a dependency list that has already been substituted.
parent
fc923cb97a
commit
4edd04b16b
19
dependency.c
19
dependency.c
|
@ -107,22 +107,19 @@ pkg_dependency_free(pkg_dependency_t *head)
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_dependency_t *
|
pkg_dependency_t *
|
||||||
pkg_dependency_parse(pkg_t *pkg, const char *depends)
|
pkg_dependency_parse_str(pkg_dependency_t *deplist_head, const char *depends)
|
||||||
{
|
{
|
||||||
parse_state_t state = OUTSIDE_MODULE;
|
parse_state_t state = OUTSIDE_MODULE;
|
||||||
pkg_dependency_t *deplist = NULL;
|
pkg_dependency_t *deplist = NULL;
|
||||||
pkg_dependency_t *deplist_head = NULL;
|
|
||||||
pkg_comparator_t compare = PKG_ANY;
|
pkg_comparator_t compare = PKG_ANY;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
char *kvdepends = pkg_tuple_parse(pkg->vars, depends);
|
|
||||||
char *start = buf;
|
char *start = buf;
|
||||||
char *ptr = buf;
|
char *ptr = buf;
|
||||||
char *vstart = NULL;
|
char *vstart = NULL;
|
||||||
char *package = NULL, *version = NULL;
|
char *package = NULL, *version = NULL;
|
||||||
|
|
||||||
strlcpy(buf, kvdepends, sizeof buf);
|
strlcpy(buf, depends, sizeof buf);
|
||||||
strlcat(buf, " ", sizeof buf);
|
strlcat(buf, " ", sizeof buf);
|
||||||
free(kvdepends);
|
|
||||||
|
|
||||||
while (*ptr)
|
while (*ptr)
|
||||||
{
|
{
|
||||||
|
@ -294,3 +291,15 @@ pkg_dependency_parse(pkg_t *pkg, const char *depends)
|
||||||
|
|
||||||
return deplist_head;
|
return deplist_head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkg_dependency_t *
|
||||||
|
pkg_dependency_parse(pkg_t *pkg, const char *depends)
|
||||||
|
{
|
||||||
|
pkg_dependency_t *list = NULL;
|
||||||
|
char *kvdepends = pkg_tuple_parse(pkg->vars, depends);
|
||||||
|
|
||||||
|
list = pkg_dependency_parse_str(list, kvdepends);
|
||||||
|
free(kvdepends);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
1
pkg.h
1
pkg.h
|
@ -139,6 +139,7 @@ pkg_fragment_t *pkg_libs(pkg_t *root, int maxdepth, unsigned int flags);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
pkg_t *pkg_new_from_file(const char *path, FILE *f);
|
pkg_t *pkg_new_from_file(const char *path, FILE *f);
|
||||||
|
pkg_dependency_t *pkg_dependency_parse_str(pkg_dependency_t *deplist_head, const char *depends);
|
||||||
pkg_dependency_t *pkg_dependency_parse(pkg_t *pkg, const char *depends);
|
pkg_dependency_t *pkg_dependency_parse(pkg_t *pkg, const char *depends);
|
||||||
pkg_dependency_t *pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t *tail);
|
pkg_dependency_t *pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t *tail);
|
||||||
void pkg_dependency_free(pkg_dependency_t *head);
|
void pkg_dependency_free(pkg_dependency_t *head);
|
||||||
|
|
Loading…
Reference in New Issue