summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorpixdamix@gmail.com <pixdamix@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2011-07-13 07:53:28 (EDT)
committer pixdamix@gmail.com <pixdamix@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2011-07-13 07:53:28 (EDT)
commit989e9d3972939e7b8a3b3720d0bcffb1f559b468 (patch)
treeef317d62eb2c4f7eefe27805ba31540029ab6017 /tests
parent3d697f6303f381a507f37f8d63129151d745dc6c (diff)
Fix issue-79: Opkg can remove a package even if another still depends on it.
- The problematic case is described by tests/regress/issue79.py Signed-off-by: Camille Moncelier <moncelier@devlife.org> git-svn-id: http://opkg.googlecode.com/svn/trunk@625 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'tests')
-rw-r--r--tests/regress/Makefile1
-rw-r--r--tests/regress/cfg.py4
-rwxr-xr-xtests/regress/issue79.py33
-rwxr-xr-xtests/regress/opkgcl.py11
4 files changed, 46 insertions, 3 deletions
diff --git a/tests/regress/Makefile b/tests/regress/Makefile
index bb9d212..866d161 100644
--- a/tests/regress/Makefile
+++ b/tests/regress/Makefile
@@ -2,6 +2,7 @@ PYTHON=/usr/bin/python3
REGRESSION_TESTS=issue26.py issue31.py issue45.py issue46.py \
issue50.py issue51.py issue55.py issue58.py \
issue72.py \
+ issue79.py \
filehash.py
regress:
diff --git a/tests/regress/cfg.py b/tests/regress/cfg.py
index 4304378..6f78996 100644
--- a/tests/regress/cfg.py
+++ b/tests/regress/cfg.py
@@ -1,3 +1,5 @@
+import os
+
opkdir = "/tmp/opk"
offline_root = "/tmp/opkg"
-opkgcl = "/home/grg/opkg/code/svn/src/opkg-cl"
+opkgcl = os.path.realpath("../../src/opkg-cl")
diff --git a/tests/regress/issue79.py b/tests/regress/issue79.py
new file mode 100755
index 0000000..1d427f6
--- /dev/null
+++ b/tests/regress/issue79.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+import os
+import opk, cfg, opkgcl
+
+opk.regress_init()
+
+o = opk.OpkGroup()
+o.add(Package="a", Version="1.0", Architecture="all", Depends="b", )
+o.add(Package="b", Version="1.0", Architecture="all")
+o.add(Package="c", Version="1.0", Architecture="all", Depends="b")
+o.write_opk()
+o.write_list()
+
+opkgcl.update()
+opkgcl.install("a")
+opkgcl.install("c")
+
+opkgcl.flag_unpacked("a")
+
+o = opk.OpkGroup()
+o.add(Package="a", Version="1.0", Architecture="all", Depends="b", )
+o.add(Package="b", Version="1.0", Architecture="all")
+o.add(Package="c", Version="2.0", Architecture="all")
+o.write_opk()
+o.write_list()
+
+opkgcl.update()
+opkgcl.upgrade("--autoremove")
+
+if not opkgcl.is_installed("b", "1.0"):
+ print("b has been removed even though a still depends on it")
+ exit(False)
diff --git a/tests/regress/opkgcl.py b/tests/regress/opkgcl.py
index effc5c8..bdd9e1e 100755
--- a/tests/regress/opkgcl.py
+++ b/tests/regress/opkgcl.py
@@ -17,14 +17,21 @@ def remove(pkg_name, flags=""):
def update():
return opkgcl("update")[0]
-def upgrade():
- return opkgcl("upgrade")[0]
+def upgrade(params=None):
+ if params:
+ opkgcl("upgrade {}".format(params))[0]
+ else:
+ return opkgcl("upgrade")[0]
def files(pkg_name):
output = opkgcl("files {}".format(pkg_name))[1]
return output.split("\n")[1:]
+def flag_unpacked(pkg_name):
+ out = opkgcl("flag unpacked {}".format(pkg_name))
+ return out == "Setting flags for package {} to unpacked.".format(pkg_name)
+
def is_installed(pkg_name, version=None):
out = opkgcl("list_installed {}".format(pkg_name))[1]
if len(out) == 0 or out.split()[0] != pkg_name: