#!/bin/sh
set -e
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64' 'i386'
insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar
Breaks: foo (<< 1)
Replaces: foo (<< 1)' "$DESCR"
+insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64
+Breaks: foo:amd64 (<< 1)
+Replaces: foo:i386 (<< 1)' "$DESCR"
setupaptarchive
testsuccess aptcache stats
cp rootdir/tmp/testsuccess.output stats.output
testsuccess test -s stats.output
+testfailureequal 'E: apt-cache stats does not take any arguments' aptcache stats foo
testsuccess aptcache xvcg foo
cp rootdir/tmp/testsuccess.output xvcg.output
testsuccess test -s xvcg.output
cp rootdir/tmp/testsuccess.output dump.output
testsuccess test -s dump.output
-testequal 'dpkg
-bar
-fancy
-foo' aptcache pkgnames
-testequal 'bar' aptcache pkgnames bar
-testequal 'fancy
-foo' aptcache pkgnames f
+testsuccessequal 'bar
+foo
+dpkg
+specific
+fancy' aptcache pkgnames
+testsuccessequal 'bar' aptcache pkgnames bar
+testsuccessequal 'foo
+fancy' aptcache pkgnames f
-testequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo
+testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive unstable/main all Packages" aptcache madison foo
### depends
-testequal 'foo
+testsuccessequal 'foo
Depends: bar
+ Conflicts: <foobar>
|Recommends: <cool>
- Recommends: <cooler>
+ Recommends: <cooler>' aptcache depends foo
+testsuccessequal 'foo
+ Depends: bar
Conflicts: <foobar>
- Conflicts: <foobar:i386>' aptcache depends foo
-testequal 'foo
+ |Recommends: <cool>
+ Recommends: <cooler>' aptcache depends foo --implicit
+testsuccessequal 'foo
Depends: bar
- Recommends: <cool>
Conflicts: <foobar>
- Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
-testequal 'foo
+ Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
+testsuccessequal 'foo
Depends: bar
- |Recommends: <cool> (>= 2)
- Recommends: <cooler> (<< 5)
Conflicts: <foobar>
- Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowVersion=1
-testequal 'foo
+ Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit
+testsuccessequal 'foo
Depends: bar
Conflicts: <foobar>
- Conflicts: <foobar:i386>' aptcache depends foo --no-recommends
-testequal 'foo
- Depends: bar' aptcache depends foo --important
-testequal 'foo
+ |Recommends: <cool> (>= 2)
+ Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1
+testsuccessequal 'foo
+ Depends: bar
Conflicts: <foobar>
- Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts
-testequal 'foo
+ |Recommends: <cool> (>= 2)
+ Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit
+testsuccessequal 'foo
Depends: bar
+ Conflicts: <foobar>' aptcache depends foo --no-recommends
+testsuccessequal 'foo
+ Depends: bar
+ Conflicts: <foobar>' aptcache depends foo --no-recommends --implicit
+testsuccessequal 'foo
+ Depends: bar' aptcache depends foo --important --implicit
+testsuccessequal 'foo
+ Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts
+testsuccessequal 'foo
+ Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts --implicit
+testsuccessequal 'foo
+ Depends: bar
+ Conflicts: <foobar>
|Recommends: <cool>
Recommends: <cooler>
+bar
+ Depends: bar
+ Breaks: foo
+ Replaces: foo
+<foobar>
+<cool>
+<cooler>' aptcache depends foo --recurse
+testsuccessequal 'foo
+ Depends: bar
Conflicts: <foobar>
- Conflicts: <foobar:i386>
+ |Recommends: <cool>
+ Recommends: <cooler>
bar
Depends: bar
Breaks: foo
- Breaks: <foo:i386>
Replaces: foo
+ Breaks: <foo:i386>
Replaces: <foo:i386>
+<foobar>
<cool>
<cooler>
-<foobar>
-<foobar:i386>
-<foo:i386>' aptcache depends foo --recurse
-testequal 'foo
+<foo:i386>' aptcache depends foo --recurse --implicit
+testsuccessequal 'foo
+ Depends: bar
+bar
+ Depends: bar
+ Replaces: foo' aptcache depends foo --recurse --important --replaces
+testsuccessequal 'foo
Depends: bar
bar
Depends: bar
Replaces: foo
Replaces: <foo:i386>
-<foo:i386>' aptcache depends foo --recurse --important --replaces
+<foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
+testsuccessequal 'bar
+ Depends: bar
+ Breaks: foo
+ Replaces: foo' aptcache depends bar
+testsuccessequal 'bar
+ Depends: bar
+ Breaks: foo
+ Replaces: foo
+ Breaks: <foo:i386>
+ Replaces: <foo:i386>' aptcache depends bar --implicit
+
+testsuccessequal 'specific
+ Depends: <bar:i386>
+ Depends: <specific:amd64>
+ specific
+ Breaks: <foo:amd64>
+ Replaces: <foo:i386>' aptcache depends specific
+testsuccessequal 'specific
+ Depends: <bar:i386>
+ Depends: <specific:amd64>
+ specific
+ Breaks: <foo:amd64>
+ Replaces: <foo:i386>' aptcache depends specific --implicit
-## rdpends
+## rdepends
-testequal 'foo
+# Note that specific does not appear in this list as it doesn't depend on foo,
+# but on an arch-specific foo!
+testsuccessequal 'foo
Reverse Depends:
bar
bar' aptcache rdepends foo
-testequal 'foo
+testsuccessequal 'foo
Reverse Depends:
- Replaces: bar
- Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
-testequal 'foo
+ Breaks: bar
+ Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
+testsuccessequal 'foo
Reverse Depends:
- Replaces: bar (<< 1)
- Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
-testequal 'foo
+ Breaks: bar (<< 1)
+ Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
+testsuccessequal 'foo
Reverse Depends:
Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks