diff options
-rw-r--r-- | libopkg/opkg_remove.c | 2 | ||||
-rw-r--r-- | tests/regress/Makefile | 1 | ||||
-rw-r--r-- | tests/regress/cfg.py | 4 | ||||
-rwxr-xr-x | tests/regress/issue79.py | 33 | ||||
-rwxr-xr-x | tests/regress/opkgcl.py | 11 |
5 files changed, 47 insertions, 4 deletions
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c index c6f2e37..20e7d7d 100644 --- a/libopkg/opkg_remove.c +++ b/libopkg/opkg_remove.c @@ -44,7 +44,7 @@ pkg_has_installed_dependents(pkg_t *pkg, abstract_pkg_t *** pdependents) if (dependers == NULL) continue; while ((dep_ab_pkg = *dependers++) != NULL) { - if (dep_ab_pkg->state_status == SS_INSTALLED){ + if (dep_ab_pkg->state_status == SS_INSTALLED || dep_ab_pkg->state_status == SS_UNPACKED){ n_installed_dependents++; } } 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: |