1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-01 10:59:42 +02:00
wernermisc/qpkg/test/cyclic
Werner Almesberger 0bc4b6046b 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-21 20:31:20 -03:00

35 lines
679 B
Bash
Executable File

#!/bin/sh
. ./Common
###############################################################################
qpkg_fail "cyclic dependency (one step)" prereq foo <<EOF
Package: foo
Version: 0
Architecture: test
Depends: foo
Filename: foo_0_test.ipkg
EOF
expect <<EOF
package foo version 0 has cyclic dependency
EOF
###############################################################################
qpkg_fail "cyclic dependency (two steps)" prereq foo <<EOF
Package: bar
Version: 1
Architecture: test
Depends: foo
Filename: bar_1_test.ipkg
Package: foo
Version: 0
Architecture: test
Depends: bar
Filename: foo_0_test.ipkg
EOF
expect <<EOF
package foo version 0 has cyclic dependency
EOF