summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-07 20:46:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-07 20:46:40 +0000
commitc617573f7ca65da803615991419db926420f22b1 (patch)
treebb3d7d440cbeec7fee53d0751c5232f31a4c8548 /t
parentc54d9828bb2eb4a38197b8d656aefd52c9c9ea36 (diff)
downloadurpmi-c617573f7ca65da803615991419db926420f22b1.tar
urpmi-c617573f7ca65da803615991419db926420f22b1.tar.gz
urpmi-c617573f7ca65da803615991419db926420f22b1.tar.bz2
urpmi-c617573f7ca65da803615991419db926420f22b1.tar.xz
urpmi-c617573f7ca65da803615991419db926420f22b1.zip
o handle "unrequested orphans" (similar to "deborphan")
Diffstat (limited to 't')
-rw-r--r--t/01compile.t2
-rw-r--r--t/data/SPECS/orphans-1/a.spec13
-rw-r--r--t/data/SPECS/orphans-1/b.spec13
-rw-r--r--t/data/SPECS/orphans-1/c.spec14
-rw-r--r--t/data/SPECS/orphans-1/cc.spec13
-rw-r--r--t/data/SPECS/orphans-1/d.spec14
-rw-r--r--t/data/SPECS/orphans-1/dd.spec13
-rw-r--r--t/data/SPECS/orphans-1/e.spec14
-rw-r--r--t/data/SPECS/orphans-1/ee1.spec13
-rw-r--r--t/data/SPECS/orphans-1/f.spec14
-rw-r--r--t/data/SPECS/orphans-1/ff1.spec13
-rw-r--r--t/data/SPECS/orphans-1/g.spec14
-rw-r--r--t/data/SPECS/orphans-1/gg.spec13
-rw-r--r--t/data/SPECS/orphans-1/h.spec14
-rw-r--r--t/data/SPECS/orphans-1/hh.spec13
-rw-r--r--t/data/SPECS/orphans-1/l.spec14
-rw-r--r--t/data/SPECS/orphans-1/ll.spec14
-rw-r--r--t/data/SPECS/orphans-1/m.spec14
-rw-r--r--t/data/SPECS/orphans-1/mm.spec14
-rw-r--r--t/data/SPECS/orphans-1/n.spec14
-rw-r--r--t/data/SPECS/orphans-1/nn.spec14
-rw-r--r--t/data/SPECS/orphans-1/o.spec14
-rw-r--r--t/data/SPECS/orphans-1/oo1.spec14
-rw-r--r--t/data/SPECS/orphans-1/r.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-a.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-b.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-c.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-d.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-e.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-f.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-g.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-h.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-l.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-m.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-n.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-o.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-r.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-s.spec14
-rw-r--r--t/data/SPECS/orphans-1/req-t.spec14
-rw-r--r--t/data/SPECS/orphans-1/rr1.spec14
-rw-r--r--t/data/SPECS/orphans-1/rr2.spec14
-rw-r--r--t/data/SPECS/orphans-1/s.spec14
-rw-r--r--t/data/SPECS/orphans-1/ss1.spec14
-rw-r--r--t/data/SPECS/orphans-1/ss2.spec14
-rw-r--r--t/data/SPECS/orphans-1/t.spec14
-rw-r--r--t/data/SPECS/orphans-1/tt1.spec14
-rw-r--r--t/data/SPECS/orphans-2/a-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/bb-2.spec15
-rw-r--r--t/data/SPECS/orphans-2/c-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/d-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/e-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/ee2.spec13
-rw-r--r--t/data/SPECS/orphans-2/f-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/ff2-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/g-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/gg-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/h-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/l-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/m-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/mm-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/n-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/nn-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/o-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/oo2-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/r-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-a-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-b-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-c-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-d-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-e-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-f-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-g-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-h-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-l-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-m-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-n-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-o-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-r-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-s-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/req-t-2.spec13
-rw-r--r--t/data/SPECS/orphans-2/s-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/t-2.spec14
-rw-r--r--t/data/SPECS/orphans-2/tt2-2.spec14
-rw-r--r--t/superuser--orphans.t99
84 files changed, 1220 insertions, 1 deletions
diff --git a/t/01compile.t b/t/01compile.t
index 03410fca..2b81d0c3 100644
--- a/t/01compile.t
+++ b/t/01compile.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More tests => 26;
for my $module (glob("urpm/*.pm")) {
$module =~ s,/,::,g;
diff --git a/t/data/SPECS/orphans-1/a.spec b/t/data/SPECS/orphans-1/a.spec
new file mode 100644
index 00000000..f75c94d2
--- /dev/null
+++ b/t/data/SPECS/orphans-1/a.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: a
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/b.spec b/t/data/SPECS/orphans-1/b.spec
new file mode 100644
index 00000000..337a7807
--- /dev/null
+++ b/t/data/SPECS/orphans-1/b.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: b
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/c.spec b/t/data/SPECS/orphans-1/c.spec
new file mode 100644
index 00000000..4bb4a950
--- /dev/null
+++ b/t/data/SPECS/orphans-1/c.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: c
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: cc
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/cc.spec b/t/data/SPECS/orphans-1/cc.spec
new file mode 100644
index 00000000..ee8387c0
--- /dev/null
+++ b/t/data/SPECS/orphans-1/cc.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: cc
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/d.spec b/t/data/SPECS/orphans-1/d.spec
new file mode 100644
index 00000000..53983ffb
--- /dev/null
+++ b/t/data/SPECS/orphans-1/d.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: d
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: dd
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/dd.spec b/t/data/SPECS/orphans-1/dd.spec
new file mode 100644
index 00000000..c89f2aeb
--- /dev/null
+++ b/t/data/SPECS/orphans-1/dd.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: dd
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/e.spec b/t/data/SPECS/orphans-1/e.spec
new file mode 100644
index 00000000..b8178f7d
--- /dev/null
+++ b/t/data/SPECS/orphans-1/e.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: e
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ee1
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/ee1.spec b/t/data/SPECS/orphans-1/ee1.spec
new file mode 100644
index 00000000..889c0506
--- /dev/null
+++ b/t/data/SPECS/orphans-1/ee1.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: ee1
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/f.spec b/t/data/SPECS/orphans-1/f.spec
new file mode 100644
index 00000000..75f073b3
--- /dev/null
+++ b/t/data/SPECS/orphans-1/f.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: f
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ff1
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/ff1.spec b/t/data/SPECS/orphans-1/ff1.spec
new file mode 100644
index 00000000..a078af5f
--- /dev/null
+++ b/t/data/SPECS/orphans-1/ff1.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: ff1
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/g.spec b/t/data/SPECS/orphans-1/g.spec
new file mode 100644
index 00000000..a626432d
--- /dev/null
+++ b/t/data/SPECS/orphans-1/g.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: g
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: gg = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/gg.spec b/t/data/SPECS/orphans-1/gg.spec
new file mode 100644
index 00000000..7531870c
--- /dev/null
+++ b/t/data/SPECS/orphans-1/gg.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: gg
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/h.spec b/t/data/SPECS/orphans-1/h.spec
new file mode 100644
index 00000000..4f9b2682
--- /dev/null
+++ b/t/data/SPECS/orphans-1/h.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: h
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: hh
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/hh.spec b/t/data/SPECS/orphans-1/hh.spec
new file mode 100644
index 00000000..7467d74d
--- /dev/null
+++ b/t/data/SPECS/orphans-1/hh.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: hh
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/l.spec b/t/data/SPECS/orphans-1/l.spec
new file mode 100644
index 00000000..b74f0fa8
--- /dev/null
+++ b/t/data/SPECS/orphans-1/l.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: l
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ll
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/ll.spec b/t/data/SPECS/orphans-1/ll.spec
new file mode 100644
index 00000000..071650cc
--- /dev/null
+++ b/t/data/SPECS/orphans-1/ll.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: ll
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: l
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/m.spec b/t/data/SPECS/orphans-1/m.spec
new file mode 100644
index 00000000..4074abe4
--- /dev/null
+++ b/t/data/SPECS/orphans-1/m.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: m
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: mm = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/mm.spec b/t/data/SPECS/orphans-1/mm.spec
new file mode 100644
index 00000000..3dc9d24e
--- /dev/null
+++ b/t/data/SPECS/orphans-1/mm.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: mm
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: m
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/n.spec b/t/data/SPECS/orphans-1/n.spec
new file mode 100644
index 00000000..af7fb8a5
--- /dev/null
+++ b/t/data/SPECS/orphans-1/n.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: n
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: nn = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/nn.spec b/t/data/SPECS/orphans-1/nn.spec
new file mode 100644
index 00000000..e3c95c2b
--- /dev/null
+++ b/t/data/SPECS/orphans-1/nn.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: nn
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: n = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/o.spec b/t/data/SPECS/orphans-1/o.spec
new file mode 100644
index 00000000..a85d038c
--- /dev/null
+++ b/t/data/SPECS/orphans-1/o.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: o
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: oo%version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/oo1.spec b/t/data/SPECS/orphans-1/oo1.spec
new file mode 100644
index 00000000..319a05a4
--- /dev/null
+++ b/t/data/SPECS/orphans-1/oo1.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: oo1
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: o = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/r.spec b/t/data/SPECS/orphans-1/r.spec
new file mode 100644
index 00000000..28feb112
--- /dev/null
+++ b/t/data/SPECS/orphans-1/r.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: r
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: rr
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-a.spec b/t/data/SPECS/orphans-1/req-a.spec
new file mode 100644
index 00000000..1939f59e
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-a.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-a
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: a
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-b.spec b/t/data/SPECS/orphans-1/req-b.spec
new file mode 100644
index 00000000..1abe81b8
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-b.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-b
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-c.spec b/t/data/SPECS/orphans-1/req-c.spec
new file mode 100644
index 00000000..9de29a7e
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-c.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-c
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: c
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-d.spec b/t/data/SPECS/orphans-1/req-d.spec
new file mode 100644
index 00000000..e18c4e39
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-d.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-d
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: d
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-e.spec b/t/data/SPECS/orphans-1/req-e.spec
new file mode 100644
index 00000000..eb279f06
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-e.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-e
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: e
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-f.spec b/t/data/SPECS/orphans-1/req-f.spec
new file mode 100644
index 00000000..0c92520b
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-f.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-f
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: f
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-g.spec b/t/data/SPECS/orphans-1/req-g.spec
new file mode 100644
index 00000000..8ead4246
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-g.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-g
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: g
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-h.spec b/t/data/SPECS/orphans-1/req-h.spec
new file mode 100644
index 00000000..5af41ab0
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-h.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-h
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: h
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-l.spec b/t/data/SPECS/orphans-1/req-l.spec
new file mode 100644
index 00000000..e5acbee7
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-l.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-l
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: l
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-m.spec b/t/data/SPECS/orphans-1/req-m.spec
new file mode 100644
index 00000000..3e225a18
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-m.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-m
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: m
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-n.spec b/t/data/SPECS/orphans-1/req-n.spec
new file mode 100644
index 00000000..8e6473bc
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-n.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-n
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: n
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-o.spec b/t/data/SPECS/orphans-1/req-o.spec
new file mode 100644
index 00000000..beb04be2
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-o.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-o
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: o
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-r.spec b/t/data/SPECS/orphans-1/req-r.spec
new file mode 100644
index 00000000..d05bae88
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-r.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-r
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: r
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-s.spec b/t/data/SPECS/orphans-1/req-s.spec
new file mode 100644
index 00000000..e85a3c35
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-s.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-s
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: s
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/req-t.spec b/t/data/SPECS/orphans-1/req-t.spec
new file mode 100644
index 00000000..70b8ce17
--- /dev/null
+++ b/t/data/SPECS/orphans-1/req-t.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: req-t
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: t
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/rr1.spec b/t/data/SPECS/orphans-1/rr1.spec
new file mode 100644
index 00000000..f89b79b0
--- /dev/null
+++ b/t/data/SPECS/orphans-1/rr1.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: rr1
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: rr
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/rr2.spec b/t/data/SPECS/orphans-1/rr2.spec
new file mode 100644
index 00000000..a2cf3057
--- /dev/null
+++ b/t/data/SPECS/orphans-1/rr2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: rr2
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: rr
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/s.spec b/t/data/SPECS/orphans-1/s.spec
new file mode 100644
index 00000000..da80e9db
--- /dev/null
+++ b/t/data/SPECS/orphans-1/s.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: s
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ss1 ss2
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/ss1.spec b/t/data/SPECS/orphans-1/ss1.spec
new file mode 100644
index 00000000..434dc73a
--- /dev/null
+++ b/t/data/SPECS/orphans-1/ss1.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: ss1
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: ss
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/ss2.spec b/t/data/SPECS/orphans-1/ss2.spec
new file mode 100644
index 00000000..a7a14f4e
--- /dev/null
+++ b/t/data/SPECS/orphans-1/ss2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: ss2
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: ss
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/t.spec b/t/data/SPECS/orphans-1/t.spec
new file mode 100644
index 00000000..b511a836
--- /dev/null
+++ b/t/data/SPECS/orphans-1/t.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: t
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: tt >= %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-1/tt1.spec b/t/data/SPECS/orphans-1/tt1.spec
new file mode 100644
index 00000000..f4b8b35f
--- /dev/null
+++ b/t/data/SPECS/orphans-1/tt1.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: tt1
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: tt = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/a-2.spec b/t/data/SPECS/orphans-2/a-2.spec
new file mode 100644
index 00000000..0cd2afc8
--- /dev/null
+++ b/t/data/SPECS/orphans-2/a-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: a
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/bb-2.spec b/t/data/SPECS/orphans-2/bb-2.spec
new file mode 100644
index 00000000..0a57c173
--- /dev/null
+++ b/t/data/SPECS/orphans-2/bb-2.spec
@@ -0,0 +1,15 @@
+Summary: x
+Name: bb
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Obsoletes: b < 2
+Provides: b = 2
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/c-2.spec b/t/data/SPECS/orphans-2/c-2.spec
new file mode 100644
index 00000000..55d29981
--- /dev/null
+++ b/t/data/SPECS/orphans-2/c-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: c
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: cc
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/d-2.spec b/t/data/SPECS/orphans-2/d-2.spec
new file mode 100644
index 00000000..85bfbf5e
--- /dev/null
+++ b/t/data/SPECS/orphans-2/d-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: d
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/e-2.spec b/t/data/SPECS/orphans-2/e-2.spec
new file mode 100644
index 00000000..538aa45c
--- /dev/null
+++ b/t/data/SPECS/orphans-2/e-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: e
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ee2
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/ee2.spec b/t/data/SPECS/orphans-2/ee2.spec
new file mode 100644
index 00000000..00a4cbf5
--- /dev/null
+++ b/t/data/SPECS/orphans-2/ee2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: ee2
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/f-2.spec b/t/data/SPECS/orphans-2/f-2.spec
new file mode 100644
index 00000000..01fccf8c
--- /dev/null
+++ b/t/data/SPECS/orphans-2/f-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: f
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ff2
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/ff2-2.spec b/t/data/SPECS/orphans-2/ff2-2.spec
new file mode 100644
index 00000000..deb7e536
--- /dev/null
+++ b/t/data/SPECS/orphans-2/ff2-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: ff2
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Conflicts: ff1 < 2
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/g-2.spec b/t/data/SPECS/orphans-2/g-2.spec
new file mode 100644
index 00000000..d08c3677
--- /dev/null
+++ b/t/data/SPECS/orphans-2/g-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: g
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: gg = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/gg-2.spec b/t/data/SPECS/orphans-2/gg-2.spec
new file mode 100644
index 00000000..ccc6d4e7
--- /dev/null
+++ b/t/data/SPECS/orphans-2/gg-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: gg
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/h-2.spec b/t/data/SPECS/orphans-2/h-2.spec
new file mode 100644
index 00000000..2bbcc00d
--- /dev/null
+++ b/t/data/SPECS/orphans-2/h-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: h
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/l-2.spec b/t/data/SPECS/orphans-2/l-2.spec
new file mode 100644
index 00000000..f1a456f1
--- /dev/null
+++ b/t/data/SPECS/orphans-2/l-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: l
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ll
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/m-2.spec b/t/data/SPECS/orphans-2/m-2.spec
new file mode 100644
index 00000000..b3d7c233
--- /dev/null
+++ b/t/data/SPECS/orphans-2/m-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: m
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: mm = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/mm-2.spec b/t/data/SPECS/orphans-2/mm-2.spec
new file mode 100644
index 00000000..78c8e3ee
--- /dev/null
+++ b/t/data/SPECS/orphans-2/mm-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: mm
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: m
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/n-2.spec b/t/data/SPECS/orphans-2/n-2.spec
new file mode 100644
index 00000000..438e8a2e
--- /dev/null
+++ b/t/data/SPECS/orphans-2/n-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: n
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: nn = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/nn-2.spec b/t/data/SPECS/orphans-2/nn-2.spec
new file mode 100644
index 00000000..193e2903
--- /dev/null
+++ b/t/data/SPECS/orphans-2/nn-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: nn
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: n = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/o-2.spec b/t/data/SPECS/orphans-2/o-2.spec
new file mode 100644
index 00000000..0451c55c
--- /dev/null
+++ b/t/data/SPECS/orphans-2/o-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: o
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: oo%version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/oo2-2.spec b/t/data/SPECS/orphans-2/oo2-2.spec
new file mode 100644
index 00000000..4a8568ed
--- /dev/null
+++ b/t/data/SPECS/orphans-2/oo2-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: oo2
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: o = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/r-2.spec b/t/data/SPECS/orphans-2/r-2.spec
new file mode 100644
index 00000000..ef6c3a75
--- /dev/null
+++ b/t/data/SPECS/orphans-2/r-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: r
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-a-2.spec b/t/data/SPECS/orphans-2/req-a-2.spec
new file mode 100644
index 00000000..d463a2ad
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-a-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-a
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-b-2.spec b/t/data/SPECS/orphans-2/req-b-2.spec
new file mode 100644
index 00000000..7d7ca3a7
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-b-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-b
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-c-2.spec b/t/data/SPECS/orphans-2/req-c-2.spec
new file mode 100644
index 00000000..205f2eb6
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-c-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-c
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-d-2.spec b/t/data/SPECS/orphans-2/req-d-2.spec
new file mode 100644
index 00000000..d2ef1ddb
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-d-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-d
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-e-2.spec b/t/data/SPECS/orphans-2/req-e-2.spec
new file mode 100644
index 00000000..9053971c
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-e-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-e
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-f-2.spec b/t/data/SPECS/orphans-2/req-f-2.spec
new file mode 100644
index 00000000..4ced265b
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-f-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-f
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-g-2.spec b/t/data/SPECS/orphans-2/req-g-2.spec
new file mode 100644
index 00000000..9794dd1c
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-g-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-g
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-h-2.spec b/t/data/SPECS/orphans-2/req-h-2.spec
new file mode 100644
index 00000000..145a7310
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-h-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-h
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-l-2.spec b/t/data/SPECS/orphans-2/req-l-2.spec
new file mode 100644
index 00000000..8422178c
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-l-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-l
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-m-2.spec b/t/data/SPECS/orphans-2/req-m-2.spec
new file mode 100644
index 00000000..21767f34
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-m-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-m
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-n-2.spec b/t/data/SPECS/orphans-2/req-n-2.spec
new file mode 100644
index 00000000..abc0b8d0
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-n-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-n
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-o-2.spec b/t/data/SPECS/orphans-2/req-o-2.spec
new file mode 100644
index 00000000..f7d463fb
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-o-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-o
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-r-2.spec b/t/data/SPECS/orphans-2/req-r-2.spec
new file mode 100644
index 00000000..a3c52f82
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-r-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-r
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-s-2.spec b/t/data/SPECS/orphans-2/req-s-2.spec
new file mode 100644
index 00000000..38164a06
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-s-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-s
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/req-t-2.spec b/t/data/SPECS/orphans-2/req-t-2.spec
new file mode 100644
index 00000000..f008de2a
--- /dev/null
+++ b/t/data/SPECS/orphans-2/req-t-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: req-t
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/s-2.spec b/t/data/SPECS/orphans-2/s-2.spec
new file mode 100644
index 00000000..5b4775e1
--- /dev/null
+++ b/t/data/SPECS/orphans-2/s-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: s
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: ss
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/t-2.spec b/t/data/SPECS/orphans-2/t-2.spec
new file mode 100644
index 00000000..8d5801ae
--- /dev/null
+++ b/t/data/SPECS/orphans-2/t-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: t
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: tt >= %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/orphans-2/tt2-2.spec b/t/data/SPECS/orphans-2/tt2-2.spec
new file mode 100644
index 00000000..30937923
--- /dev/null
+++ b/t/data/SPECS/orphans-2/tt2-2.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: tt2
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: tt = %version
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/superuser--orphans.t b/t/superuser--orphans.t
new file mode 100644
index 00000000..d9369a36
--- /dev/null
+++ b/t/superuser--orphans.t
@@ -0,0 +1,99 @@
+#!/usr/bin/perl
+
+# a-1 upgrades to a-2
+# b-1 upgrades to bb-2 (via obsoletes)
+# c-1 (requires cc) upgrades to c-2 (requires cc)
+# d-1 (requires dd) upgrades to d-2
+# e-1 (requires ee1) upgrades to e-2 (requires ee2)
+# f-1 (requires ff1) upgrades to f-2 (requires ff2), ff2 conflicts with ff1
+# g-1 (requires gg = 1) upgrades to g-2 (requires gg = 2)
+# h-1 (suggests hh) upgrades to h-2
+#
+# l-1 upgrades to l-2, l requires ll and ll requires l
+# m-1 (requires mm = 1) upgrades to m-2 (requires mm = 2), mm requires m (circular dep)
+# n-1 (requires nn = 1) upgrades to n-2 (requires nn = 2), nn-1 requires n-1, nn-2 requires n-2 (circular dep)
+# o-1 (requires oo1) upgrades to o-2 (requires oo2), oo1 requires o = 1, oo2 requires o = 2 (circular dep)
+#
+# r-1 (requires rr) upgrades to r-2, rr1 provides rr, rr2 provides rr
+# s-1 (requires ss1 and ss2) upgrades to s-2 (requires ss), ss1-2 provides ss, ss2-2 provides ss
+# t-1 (requires tt >= 1) upgrades to t-2 (requires tt >= 2), tt1-1 provides tt = 1, tt1-2 provides tt = 2
+#
+# req-a requires a, req-b requires b...
+#
+use strict;
+use lib '.', 't';
+use helper;
+use urpm::util;
+use Test::More 'no_plan';
+
+need_root_and_prepare();
+
+
+my $name = 'orphans';
+urpmi_addmedia("$name-1 $::pwd/media/$name-1");
+urpmi_addmedia("$name-2 $::pwd/media/$name-2");
+
+# we want urpmi --auto-select to always check orphans (when not using --auto-orphans)
+set_urpmi_cfg_global_options({ 'nb-of-new-unrequested-pkgs-between-auto-select-orphans-check' => 0 });
+
+
+test_auto_select_both('a', 'a', 'a-2');
+test_auto_select_both('b', 'b', 'bb-2');
+test_auto_select_both('c', 'c cc', 'c-2 cc-1');
+test_auto_select_both('d', 'd dd', 'd-2', 'dd-1');
+test_auto_select_both('e', 'e ee1', 'e-2 ee2-2', 'ee1-1');
+test_auto_select_both('f', 'f ff1', 'f-2 ff2-2');
+test_auto_select_both('g', 'g gg', 'g-2 gg-2');
+test_auto_select_both('h', 'h hh', 'h-2', 'hh-1');
+test_auto_select_both('l', 'l ll', 'l-2 ll-1');
+test_auto_select_both('m', 'm mm', 'm-2 mm-2');
+test_auto_select_both('n', 'n nn', 'n-2 nn-2');
+test_auto_select_both('o', 'o oo1', 'o-2 oo2-2');
+test_auto_select_both('r', 'r rr2', 'r-2', 'rr2-1');
+test_auto_select_both('s', 's ss1 ss2', 's-2 ss1-1 ss2-1');
+test_auto_select_both('t', 't tt1', 't-2 tt2-2', 'tt1-1');
+
+test_auto_select(['r', 'rr1'], 'r rr1 rr2', 'r-2 rr1-1', 'rr2-1');
+#test_auto_select(['s ss1'], 's ss1 ss2', 's-2 ss1-1', 'ss2-1'); # this fails, but that's ok
+
+sub add_version1 { map { "$_-1-1" } split(' ', $_[0] || '') }
+sub add_version2 { map { "$_-2-1" } split(' ', $_[0] || '') }
+sub add_release { map { "$_-1" } split(' ', $_[0] || '') }
+sub add_version1_s { join(' ', add_version1(@_)) }
+sub add_version2_s { join(' ', add_version2(@_)) }
+sub add_release_s { join(' ', add_release(@_)) }
+
+sub test_auto_select_both {
+ my ($pkg, $wanted_v1, $wanted_v2, $orphans_v2) = @_;
+
+ $orphans_v2 ||= '';
+ test_auto_select([$pkg], $wanted_v1, $wanted_v2, $orphans_v2);
+ test_auto_select(["req-$pkg"], "req-$pkg $wanted_v1", "req-$pkg-2", "$wanted_v2 $orphans_v2");
+}
+
+sub test_auto_select {
+ my ($req_v1, $wanted_v1, $wanted_v2, $orphans_v2) = @_;
+ test_auto_select_raw_urpmq_urpme ($req_v1, add_version1_s($wanted_v1), add_release_s($wanted_v2), add_release_s($orphans_v2));
+ test_auto_select_raw_auto_orphans($req_v1, add_version1_s($wanted_v1), add_release_s($wanted_v2));
+}
+
+sub test_auto_select_raw_urpmq_urpme {
+ my ($req_v1, $wanted_v1, $wanted_v2, $orphans_v2) = @_;
+ print "# test_auto_select_raw_urpmq_urpme(@$req_v1, $wanted_v1, $wanted_v2)\n";
+ urpmi("--media $name-1 --auto $_") foreach @$req_v1;
+ check_installed_fullnames(split ' ', $wanted_v1);
+ urpmi("--media $name-2 --auto --auto-select");
+ check_installed_fullnames(split ' ', "$wanted_v2 $orphans_v2");
+ is(run_urpm_cmd('urpmq -r --auto-orphans'), join('', sort map { "$_\n" } split ' ', $orphans_v2));
+ urpme("--auto --auto-orphans");
+ check_installed_fullnames_and_remove(split ' ', $wanted_v2);
+}
+
+sub test_auto_select_raw_auto_orphans {
+ my ($req_v1, $wanted_v1, $wanted_v2) = @_;
+ print "# test_auto_select_raw_auto_orphans(@$req_v1, $wanted_v1, $wanted_v2)\n";
+ urpmi("--media $name-1 --auto $_") foreach @$req_v1;
+ check_installed_fullnames(split ' ', $wanted_v1);
+ urpmi("--media $name-2 --auto --auto-select --auto-orphans");
+ check_installed_fullnames_and_remove(split ' ', $wanted_v2);
+}