From 989e9d3972939e7b8a3b3720d0bcffb1f559b468 Mon Sep 17 00:00:00 2001 From: pixdamix@gmail.com Date: Wed, 13 Jul 2011 07:53:28 -0400 Subject: 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 git-svn-id: http://opkg.googlecode.com/svn/trunk@625 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'tests') 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: -- cgit v0.9.1