install: make sure package dependencies have no trivial cycles

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-02-21 15:11:09 +01:00
parent 98b655f133
commit 82c888bcbf
1 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,13 @@ int collect_dependencies(int repofd, struct pkg_dep_list *list)
buffer[dep.name_length] = '\0';
if (strcmp((char *)buffer, it->name) == 0) {
fprintf(stderr,
"%s: package depends on itself\n",
it->name);
goto fail;
}
it->deps[i] = find_pkg(list, (char *)buffer);
if (it->deps[i] == NULL) {
it->deps[i] = append_pkg(list, (char *)buffer);