1
/* libdeps.c - Retrieve and calculate dependencies for deborphan.
2
Copyright (C) 2000 Cris van Pelt
4
Distributed under the terms of the Artistic License. */
15
#include <deborphan.h>
23
/* For each package found, this scans the `package' structure, to
24
* see if anything depends on it.
27
check_lib_deps(pkg_info * package, pkg_info * current_pkg)
29
int deps, prov, no_dep_found = 1, search_found = 1;
33
extern char **search_for;
35
if (current_pkg->hold)
37
if (current_pkg->priority < options[PRIORITY])
39
if (keep && mustkeep(current_pkg->self))
41
if (!is_library(current_pkg))
44
if (options[SEARCH]) {
46
/* Count packages. Just once. */
48
for (; *(search_for+j); j++);
50
/* Search for the package, and clear it from the list if it is
52
for (i = 0; *(search_for + i); i++) {
53
if (!strcmp(*(search_for + i), current_pkg->self.name)) {
55
*(search_for + i) = *(search_for + --j);
56
*(search_for + j) = NULL;
64
if (options[SHOW_DEPS]) {
65
printf("%s", current_pkg->self.name);
67
if (options[SHOW_SECTION])
68
printf(" (%s", current_pkg->section);
69
if (options[SHOW_PRIORITY])
70
printf(" - %s", priority_to_string(current_pkg->priority));
71
if (options[SHOW_SECTION])
76
/* Search all (installed) packages for dependencies.
78
for (; package && no_dep_found; package = package->next) {
79
for (deps = 0; package->deps[deps].name && no_dep_found; deps++) {
80
for (prov = 0; current_pkg->provides[prov].name && no_dep_found;
82
if (pkgcmp(current_pkg->provides[prov], package->deps[deps])) {
83
if (options[SHOW_DEPS])
84
printf(" %s\n", package->self.name);
90
if (pkgcmp(current_pkg->self, package->deps[deps])) {
91
if (options[SHOW_DEPS])
92
printf(" %s\n", package->self.name);
99
if (no_dep_found && (!options[SHOW_DEPS])) {
100
if (options[SHOW_SECTION])
101
printf("%-25s", current_pkg->section);
103
if (options[SHOW_PRIORITY])
104
printf("%-24s%s", current_pkg->self.name,
105
priority_to_string(current_pkg->priority));
107
printf("%s", current_pkg->self.name);