2010-11-20 12:29:18 +02:00
|
|
|
/*
|
|
|
|
* qpkg.h - Quick package database query
|
|
|
|
*
|
|
|
|
* Written 2010 by Werner Almesberger
|
|
|
|
* Copyright 2010 Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
2010-11-19 19:00:15 +02:00
|
|
|
#ifndef QPKG_H
|
|
|
|
#define QPKG_H
|
|
|
|
|
2010-11-20 17:25:45 +02:00
|
|
|
enum flags {
|
qpkg: added detection of cyclic dependencies
We define a cyclic dependency as the possibility (!) of the prerequisites
of a package X including a package that depends on X, and issue an error
if encountering such a situation.
Note that, if the dependencies of X can be resolved in a manner that does
not include the cyclic dependency, qpkg will still fail if it encounters
the cycle. Also note that qpkg (at least so far) does no perform an
exhaustive search to ferret out cyclic dependencies.
Furthermore, we don't consider that a cyclic dependency may not necessarily
imply a real life problem. E.g., if a package A contains elements X and
Y, with X needing package B, and the content of package B has a run-time
dependency on Y, the cyclic dependency between A and B would not exist
when considering its constituents. Since we don't have this information, we
just err on the side of caution.
- qpkg.h (enum flags): divide flags into categories (parse-time and
run-time) and add flag QPKG_ADDING to mark packets whose dependencies we
are processing
- prereq.c (resolve, prereq): track which packages we're tentatively
considering for installation and detect cyclic dependencies
- test/cyclic: regression test for detection of cyclic dependencies
- TODO: updated with recent changes
2010-11-22 01:31:20 +02:00
|
|
|
/* parse-time flags */
|
2010-11-20 17:25:45 +02:00
|
|
|
QPKG_INSTALLED = 1 << 0, /* installed on target */
|
qpkg: added detection of cyclic dependencies
We define a cyclic dependency as the possibility (!) of the prerequisites
of a package X including a package that depends on X, and issue an error
if encountering such a situation.
Note that, if the dependencies of X can be resolved in a manner that does
not include the cyclic dependency, qpkg will still fail if it encounters
the cycle. Also note that qpkg (at least so far) does no perform an
exhaustive search to ferret out cyclic dependencies.
Furthermore, we don't consider that a cyclic dependency may not necessarily
imply a real life problem. E.g., if a package A contains elements X and
Y, with X needing package B, and the content of package B has a run-time
dependency on Y, the cyclic dependency between A and B would not exist
when considering its constituents. Since we don't have this information, we
just err on the side of caution.
- qpkg.h (enum flags): divide flags into categories (parse-time and
run-time) and add flag QPKG_ADDING to mark packets whose dependencies we
are processing
- prereq.c (resolve, prereq): track which packages we're tentatively
considering for installation and detect cyclic dependencies
- test/cyclic: regression test for detection of cyclic dependencies
- TODO: updated with recent changes
2010-11-22 01:31:20 +02:00
|
|
|
|
|
|
|
/* run-time flags */
|
|
|
|
QPKG_ADDING = 1 << 10, /* resolving dependencies */
|
2010-11-20 17:25:45 +02:00
|
|
|
};
|
|
|
|
|
2010-11-19 19:00:15 +02:00
|
|
|
enum relop {
|
|
|
|
rel_eq,
|
|
|
|
rel_ge,
|
|
|
|
rel_lt,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pkg;
|
|
|
|
|
|
|
|
struct ref {
|
|
|
|
struct id *pkg;
|
|
|
|
struct id *version;
|
|
|
|
enum relop relop; /* undefined if version == NULL */
|
|
|
|
struct ref *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pkg {
|
|
|
|
struct id *id;
|
|
|
|
struct id *version;
|
2010-11-21 08:53:19 +02:00
|
|
|
const char *arch;
|
2010-11-19 19:00:15 +02:00
|
|
|
struct ref *conflicts;
|
|
|
|
struct ref *depends;
|
|
|
|
const char *filename;
|
2010-11-20 17:25:45 +02:00
|
|
|
int flags; /* see enum flags */
|
2010-11-19 19:00:15 +02:00
|
|
|
struct pkg *more;
|
|
|
|
int mark;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct tree *packages;
|
|
|
|
struct tree *versions;
|
|
|
|
|
2010-11-22 01:55:25 +02:00
|
|
|
int debug;
|
|
|
|
|
2010-11-19 19:00:15 +02:00
|
|
|
#endif /* !QPKG_H */
|