parse: add pkg_dependency_append() and fix world dependency merging

pull/1/merge
William Pitcock 2011-07-25 16:53:12 -05:00
parent bdbab6918a
commit 3e69f4c7a6
3 changed files with 26 additions and 1 deletions

5
main.c
View File

@ -95,7 +95,10 @@ pkg_queue_walk(pkg_queue_t *head)
foreach_list_entry(head, pkgq) foreach_list_entry(head, pkgq)
{ {
world.requires = parse_deplist(&world, pkgq->package); pkg_dependency_t *pkgdep;
pkgdep = parse_deplist(&world, pkgq->package);
world.requires = pkg_dependency_append(world.requires, pkgdep);
} }
if (want_modversion) if (want_modversion)

21
parse.c
View File

@ -145,6 +145,27 @@ pkg_dependency_add(pkg_dependency_t *head, const char *package, const char *vers
#define MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c))) #define MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c)))
#define OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=') #define OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
pkg_dependency_t *
pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t *tail)
{
pkg_dependency_t *node;
if (head == NULL)
return tail;
/* skip to end of list */
foreach_list_entry(head, node)
{
if (node->next == NULL)
break;
}
node->next = tail;
tail->prev = node;
return head;
}
pkg_dependency_t * pkg_dependency_t *
parse_deplist(pkg_t *pkg, const char *depends) parse_deplist(pkg_t *pkg, const char *depends)
{ {

1
pkg.h
View File

@ -92,5 +92,6 @@ void pkg_traverse(pkg_t *root, void (*pkg_traverse_func)(pkg_t *package, void *d
pkg_t *parse_file(const char *path); pkg_t *parse_file(const char *path);
char *tuple_find(pkg_tuple_t *head, const char *key); char *tuple_find(pkg_tuple_t *head, const char *key);
pkg_dependency_t *parse_deplist(pkg_t *pkg, const char *depends); pkg_dependency_t *parse_deplist(pkg_t *pkg, const char *depends);
pkg_dependency_t *pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t *tail);
#endif #endif