#! /usr/bin/env python # # Create packages 'a', 'b' which recommends 'a' and 'c' which depends on 'a'. # Install 'b' with '--no-install-recommends' and ensure 'a' is not installed. # Install 'c' with '--no-install-recommends' and ensure 'a' is installed. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a") o.add(Package="b", Recommends="a") o.add(Package="c", Depends="a") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("b", "--no-install-recommends") if opkgcl.is_installed("a"): opk.fail("Recommended package 'a' installed despite '--no-install-recommends'.") opkgcl.install("c", "--no-install-recommends") if not opkgcl.is_installed("a"): opk.fail("Required package 'a' not installed with '--no-install-recommends'.")
opk.regress_init() o = opk.OpkGroup() o.add(Package='a', Recommends='c, d', Version='1.0') o.add(Package='b', Depends='c') o.add(Package='c') o.add(Package='d') o.write_opk() o.write_list() opkgcl.update() opkgcl.install('a', '--add-ignore-recommends c') if not opkgcl.is_installed('a'): opk.fail("Package 'a' installed but reports as not installed.") if opkgcl.is_installed('c'): opk.xfail("[libsolv<0.7.3] Package 'c' should not have been installed since it was in --add-ignore-recommends.") if not opkgcl.is_installed('d'): opk.fail("Package 'd' installed but reports as not installed.") opkgcl.remove('a') opkgcl.remove('d') opkgcl.install('a b', '--add-ignore-recommends c') if not opkgcl.is_installed('a'): opk.fail("Package 'a' installed but reports as not installed.") if not opkgcl.is_installed('b'):
opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Depends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") o = opk.OpkGroup() o.add(Package="a", Version="2.0", Depends="c") o.add(Package="c", Conflicts="b") o.write_opk() o.write_list() opkgcl.update() status = opkgcl.upgrade("a", "--autoremove") if not opkgcl.is_installed("a", "2.0"): opk.xfail( "[internalsolv] New version of package 'a' available during upgrade but was not installed" ) if status != 0: opk.fail("Return value was different than 0") opkgcl.remove("a") opkgcl.remove("b") opkgcl.remove("c")
import os import opk, cfg, opkgcl opk.regress_init() open("asdf", "w").close() a = opk.Opk(Package="a", Version="1.0", Architecture="all") a.write(data_files=["asdf"]) b = opk.Opk(Package="b", Version="1.0", Architecture="all") b.write(data_files=["asdf"]) os.unlink("asdf") opkgcl.install("a_1.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' not installed.") if not os.path.exists("{}/asdf".format(cfg.offline_root)): opk.fail("asdf not created.") opkgcl.install("b_1.0_all.opk", "--force-overwrite") if "{}/asdf".format(cfg.offline_root) not in opkgcl.files("b"): opk.fail("asdf not claimed by ``b''.") if "{}/asdf".format(cfg.offline_root) in opkgcl.files("a"): opk.fail("asdf is still claimed by ``a''.") opkgcl.remove("b") opkgcl.remove("a")
import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package='a', Depends='b', Essential='yes') o.add(Package='b', Depends='c') o.add(Package='c') o.write_opk() o.write_list() opkgcl.update() opkgcl.install('a') if not opkgcl.is_installed('a'): opk.fail("Package 'a' installed but does not report as installed.") if not opkgcl.is_installed('b'): opk.fail("Package 'b' installed but does not report as installed.") if not opkgcl.is_installed('c'): opk.fail("Package 'c' installed but does not report as installed.") opkgcl.remove('c', '--force-removal-of-dependent-packages') if not opkgcl.is_installed('b'): opk.xfail( "[internalsolv] Package 'b' was removed, but Essential package 'a' depends on it" ) if not opkgcl.is_installed('c'): opk.fail("Package 'c' was removed, which breaks Essential package 'a'") if not opkgcl.is_installed('a'): opk.fail("Essential package 'a' was incorrectly removed")
# Create a 1.0 containing file "test1" and install by name f = open("test1", "w") f.write("Test") f.close() pkg = opk.Opk(Package="a", Version="1.0") pkg.write(data_files=["test1"]) o.addOpk(pkg) o.write_list() os.unlink("test1") opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if not os.path.exists("%s/test1" % cfg.offline_root): opk.fail("Package 'a' installed but file 'test1' not created.") # Create a 2.0 containing file "test2" and upgrade by URI f = open("test2", "w") f.write("Test") f.close() pkg = opk.Opk(Package="a", Version="2.0") pkg.write(data_files=["test2"]) o.addOpk(pkg) o.write_list() os.unlink("test2") opkgcl.install("a_2.0_all.opk")
# # Create package 'x(1.0)' with architecture a and 'x(1.0)' with architecture b. # Install 'x' with --add-arch a:2 and --add-arch b:3. # Check that 'x(1.0), arch b' is installed. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="x", Version="1.0", Architecture="b") o.add(Package="x", Version="1.0", Architecture="a") o.write_opk() o.write_list() opkgcl.update() # install should pick arch=b version opkgcl.install("x", "--add-arch a:2 --add-arch b:3") if opkgcl.is_installed("x", "1.0", "--add-arch a:2"): opk.fail("Package 'x(1.0), arch b' available but arch a installed") if not opkgcl.is_installed("x", "1.0", "--add-arch b:3"): opk.fail("Package 'x(1.0), arch=b' available but was not installed.") opkgcl.install("x", "--force-reinstall --add-arch a:2 --add-arch b:3") if not opkgcl.is_installed("x", "1.0", "--add-arch b:3"): opk.fail("Package 'x(1.0), arch=b' available but was not re-installed.")
import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Depends="b (= 1.0)") o.add(Package="a_second", Version="1.0", Depends="b (=1.0)") o.add(Package="b", Version="1.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a a_second") if not opkgcl.is_installed("a"): opk.fail("Package 'a' failed to install.") if not opkgcl.is_installed("a_second"): opk.fail("Package 'a_second' failed to install.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' not installed despite dependency from package 'a'.") o = opk.OpkGroup() o.add(Package="a", Version="1.1", Depends="b (= 1.1)") o.add(Package="a_second", Version="1.1", Depends="b (= 1.1)") o.add(Package="b", Version="1.1") o.write_opk() o.write_list() opkgcl.update() # 'opkg upgrade b' should fail as it won't upgrade a or a_second
o = opk.OpkGroup() o.add(Package="a", Depends="b (<< 2.0)") o.add(Package="b", Version="1.0") o.add(Package="b", Version="2.0") o.add(Package="b", Version="3.0") o.write_opk() o.write_list() opkgcl.update() # install a and check that b(1.0) is installed opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if opkgcl.is_installed("b", "3.0"): opk.fail("Package 'a' depends on 'b' earlier than 2.0, but 'b(3.0)' installed.") if opkgcl.is_installed("b", "2.0"): opk.fail("Package 'a' depends on 'b' earlier than 2.0, but 'b(2.0)' installed.") if not opkgcl.is_installed("b", "1.0"): opk.fail("Package 'a' depends on 'b' earlier than 2.0, but 'b(1.0)' not installed.") # try installing b(2.0) which should fail opkgcl.install("b_2.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' was removed.") if opkgcl.is_installed("b", "3.0"): opk.fail("Install called on 'b(2.0)', but 'b(3.0)' installed.") if opkgcl.is_installed("b", "2.0"): opk.fail("Package 'a' depends on 'b' earlier than 2.0, but 'b' upgraded to 2.0.")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="x") o.add(Package="a", Recommends="b") o.add(Package="b", Recommends="c") o.add(Package="c", Conflicts="x") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x"); if not opkgcl.is_installed("x"): opk.fail("Package 'x' installed but reports as not installed") opkgcl.install("a"); if not opkgcl.is_installed("x"): opk.fail("Package 'x' removed when 'a' installed, but should not be removed.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' not installed, but should be installed as a recommended pkg of 'a'.") if opkgcl.is_installed("c"): opk.fail("Package 'c' installed but conflicts with x.") if not opkgcl.is_installed("a"): opk.xfail("Package 'a' not installed even though 'c' is not an absolute dependency of 'b'.")
opk.regress_init() x1 = "x1" x2 = "x2" x3 = "x3" open(x1, "w").close() open(x2, "w").close() a = opk.Opk(Package="a") a.write(data_files=[x1, x2]) os.unlink(x1) os.unlink(x2) opkgcl.install("a_1.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' not installed.") open(x2, "w").close() open(x3, "w").close() a = opk.Opk(Package="b", Replaces="a", Provides="a", Conflicts="a") a.write(data_files=[x2, x3]) os.unlink(x2) os.unlink(x3) opkgcl.install("b_1.0_all.opk") if not opkgcl.is_installed("b"): opk.fail("Package 'b' not installed.") if opkgcl.is_installed("a"): opk.fail("Package 'a' was not replaced.") x2fullpath = "{}/x2".format(cfg.offline_root)
#! /usr/bin/env python # # Install a package 'x' which PROVIDES 'v' and ensure that we can install # another package 'y' which also PROVIDES 'v'. import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="x", Provides="v") o.add(Package="y", Provides="v") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x") if not opkgcl.is_installed("x"): opk.fail("Package 'x' installed but reports as not installed.") # Now try to install "y", which should succeed opkgcl.install("y") if not opkgcl.is_installed("y"): opk.fail("Package 'y' not installed despite lack of conflicts.")
o = opk.OpkGroup() o.add(Package="a", Depends="b (>= 2.0)") o.add(Package="b", Version="1.0") o.add(Package="b", Version="2.0") o.add(Package="b", Version="3.0") o.write_opk() o.write_list() opkgcl.update() # install a and check that b(3.0) is installed opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if opkgcl.is_installed("b", "1.0"): opk.fail("Package 'a' depends on 'b' later or equal to 2.0, but 'b(1.0)' installed.") if opkgcl.is_installed("b", "2.0"): opk.fail("Package 'b(3.0)' available, but 'b(2.0)' installed.") if not opkgcl.is_installed("b", "3.0"): opk.fail("Package 'a' depends on 'b' later than or equal to 2.0, but 'b' not installed.") # try forcing a downgrade to b(1.0) which should fail opkgcl.install("b_1.0_all.opk", "--force-downgrade") if not opkgcl.is_installed("a"): opk.fail("Package 'a' was removed.") if opkgcl.is_installed("b", "2.0"): opk.fail("Install called on 'b(1.0)' but 'b' downgraded to(2.0).") if opkgcl.is_installed("b", "1.0"): opkg.fail("Package 'a' depends on 'b' later than or equal to 2.0, but 'b' downgraded to 1.0.")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0") o.add(Package="b", Version="1.0", Recommends="a") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("b") if not opkgcl.is_installed("a"): opk.fail("Package a should have been auto-installed") if not opkgcl.is_autoinstalled("a"): opk.fail("Package a should have been marked as auto-installed") o = opk.OpkGroup() o.add(Package="a", Version="2.0") o.add(Package="b", Version="2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade("--autoremove") if opkgcl.is_installed("a"): opk.xfail("Package a should have been auto-removed")
f.write('Test') a = opk.Opk(Package='a', Version='1.0') a.write(data_files=['conflict_file']) b = opk.Opk(Package='b', Version='1.0') b.write(data_files=['conflict_file']) o.opk_list.append(a) o.opk_list.append(b) o.write_list() opkgcl.update() opkgcl.install('a') opkgcl.install('b') if not opkgcl.is_installed('a', '1.0'): opk.fail("Package 'a' failed to install") if opkgcl.is_installed('b'): opk.fail("Package 'b' installed despite file conflict") opkgcl.remove('b') if opkgcl.is_installed('b'): opk.fail("Package 'b' failed to remove") if is_half_installed('b'): opk.fail("Failed to clean up package 'b' from status file") b2 = opk.Opk(Package='b', Version='2.0') b2.write() o.opk_list.append(b2) o.write_list()
# # The symlink should be created and point to the appropriate file. Instead, the # symlink is not created at all. # # # Status # ====== # # Fixed in r544. import os import opk, cfg, opkgcl opk.regress_init() long_filename = 110 * "a" os.symlink(long_filename, "linky") a = opk.Opk(Package="a") a.write(data_files=["linky"]) os.unlink("linky") opkgcl.install("a_1.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' not installed.") if not os.path.lexists("{}/linky".format(cfg.offline_root)): opk.fail("symlink to file with a name longer than 100 " "characters not created.") opkgcl.remove("a")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Depends="b") o.add(Package="b", Version="1.0") o.add(Package="c", Version="1.0", 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", Depends="b") o.add(Package="b", Version="1.0") o.add(Package="c", Version="2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade("--autoremove") if not opkgcl.is_installed("b", "1.0"): opk.fail("b has been removed even though a still depends on it")
#! /usr/bin/env python # # Issue 127 reported by muusclaus # # 1. call "opkg upgrade PACKAGE_NAME" # 2. PACKAGE_NAME is a not installed package # # What is the expected output? # I expected to get an error message, that the package is not installed yet. # # What do you see instead? # The package will be installed like as I do an "opkg install ..." # import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade("a") if opkgcl.is_installed("a"): opk.fail("Package 'a' installed by upgrade.")
# # Install a package 'a' which depends on a second package 'b'. Check that both # are installed, that package 'a' does not report as automatically installed but # that package 'b' does report as automatically installed. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but does not report as installed.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' should be installed as a dependency of 'a' but does not report as installed.") # Check the packages are marked correctly if opkgcl.is_autoinstalled("a"): opk.fail("Package 'a' explicitly installed by reports as auto installed.") if not opkgcl.is_autoinstalled("b"): opk.fail("Package 'b' installed as a dependency but does not report as auto installed.")
# Create a 1.0 containing file "test1" and install by name f = open("test1", "w") f.write("Test") f.close() pkg = opk.Opk(Package="a", Version="1.0") pkg.write(data_files=["test1"]) o.addOpk(pkg) o.write_list() os.unlink("test1") opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if not os.path.exists("%s/test1" % cfg.offline_root): opk.fail("Package 'a' installed but file 'test1' not created.") # Destroy the old package os.unlink("a_1.0_all.opk") # Create a 2.0 containing file "test2" and upgrade by URI f = open("test2", "w") f.write("Test") f.close() pkg = opk.Opk(Package="a", Version="1.0") pkg.write(data_files=["test2"]) o.addOpk(pkg) o.write_list() os.unlink("test2")
o.add(Package="a", Version="1.0", Depends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") o = opk.OpkGroup() o.add(Package="a", Version="2.0", Depends="c") o.add(Package="c") o.write_opk() o.write_list() opkgcl.update() status = opkgcl.install("c", "--download-only") if opkgcl.is_installed("c"): opk.fail("Pacakge c was installed during a --download-only operation") status = opkgcl.remove("a", "--download-only") if not opkgcl.is_installed("a"): opk.fail("Package a was removed during a --download-only operation") status = opkgcl.upgrade("--download-only") if not opkgcl.is_installed("a", "1.0"): opk.fail("Pacakge a was upgraded during a --download-only operation") if not opkgcl.is_installed("b"): opk.fail("Package b was incorrectly removed during a --download-only operation") if opkgcl.is_installed("c"): opk.fail("Package c was incorrectly installed during a --download-only operation")
_, version = opkgcl.opkgcl("--version") libsolv = True if 'libsolv' in version else False o = opk.OpkGroup() o.add(Package='a', Version='1.0', Depends='b') o.add(Package='b', Version='1.0', Depends='c', Provides='d') o.add(Package='c', Version='1.0', Provides='e') o.write_opk() o.write_list() opkgcl.update() opkgcl.install('a') if not opkgcl.is_installed('a', '1.0'): opk.fail("Package 'a' (1.0) installed but does not report as installed.") if not opkgcl.is_installed('b', '1.0'): opk.fail("Package 'b (1.0)' should be installed as a dependency of 'a' but does not report as installed.") if not opkgcl.is_installed('c', '1.0'): opk.fail("Package 'c' (1.0) or 'e' should be installed as a dependency of 'b (1.0)' but does not report as installed.") o.add(Package='a', Version='2.0', Depends='f') o.add(Package='f', Version='2.0', Depends='g', Provides='d') o.add(Package='g', Version='2.0', Provides='e') o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade() if not opkgcl.is_installed('a', '2.0'): opk.fail("Package 'a' (2.0) installed but does not report as installed.")
# 4.- Install 'a' # 5.- Install 'b' # # What is the expected output? What do you see instead? # ====================================== # # Installation of b fails (it shouldn't) # import os import opk, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Provides="x", Conflicts="x") o.add(Package="b", Depends="x") o.add(Package="x") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") opkgcl.install("b") if not opkgcl.is_installed("b"): opk.xfail("Package 'b' installed but reports as not installed.")
Version="1.0", Conflicts="a (<< 2.0)", Replaces="a (<< 2.0)") c1.write(data_files=["foo1"]) o.opk_list.append(a2) o.opk_list.append(b1) o.opk_list.append(c1) o.write_list() os.unlink("foo") opkgcl.update() status = opkgcl.upgrade("a") if status != 0: opk.fail("Upgrade operation failed (Return value was different than 0)") if not opkgcl.is_installed("a", "2.0"): opk.fail("Package 'a_2.0' not installed.") foo_fullpath = "{}/foo".format(cfg.offline_root) if not os.path.exists(foo_fullpath): opk.fail("File 'foo' incorrectly orphaned.") if not foo_fullpath in opkgcl.files("b"): opk.fail("Package 'b' does not own file 'foo'.") foo1_fullpath = "{}/foo1".format(cfg.offline_root) if not os.path.exists(foo1_fullpath):
# Create packages 'a', 'b' which recommends 'a' and 'c' which depends on 'a'. # Install 'b' with '--add-exclude a' and ensure 'b' is installed but 'a' is not. # Install 'c' with '--add-exclude a' and ensure 'c' and 'a' are not installed. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a") o.add(Package="b", Recommends="a") o.add(Package="c", Depends="a") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("b", "--add-exclude a") if opkgcl.is_installed("a"): opk.fail("Package 'a' installed despite being excluded.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' not installed, excluded pacakge was only a recommendation.") opkgcl.install("c", "--add-exclude a") if opkgcl.is_installed("a"): opk.fail("Package 'a' installed despite being excluded.") if opkgcl.is_installed("c"): opk.fail("Package 'c' installed despite required package being excluded.")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") # Make a new version of 'a' available o.add(Package="a", Version="2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade() if not opkgcl.is_installed("a", "2.0"): opk.fail( "New version of package 'a' available during upgrade but was not installed" ) if opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' upgraded but old version still installed.")
# Open # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="x") o.add(Package="a", Recommends="b") o.add(Package="b", Conflicts="x") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x"); if not opkgcl.is_installed("x"): opk.fail("Package 'x' installed but reports as not installed") opkgcl.install("a"); if not opkgcl.is_installed("x"): opk.fail("Package 'x' removed when 'a' installed, but should not be removed.") if opkgcl.is_installed("b"): opk.fail("Package 'b' installed but conflicts with x.") if not opkgcl.is_installed("a"): opk.xfail("Package 'a' not installed even though 'b' is not an absolute dependency of 'a'.")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="x", Provides="v", Conflicts="v", Version="1.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x") if not opkgcl.is_installed("x"): opk.fail("Package 'x' installed but reports as not installed.") # Now try to upgrade o.add(Package="x", Provides="v", Conflicts="v", Version="2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade() if not opkgcl.is_installed("x", "2.0"): opk.fail("New version of package 'x' available during upgrade but was not installed") if opkgcl.is_installed("x", "1.0"): opk.fail("Package 'a' upgraded but old version still installed.")
# Open # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed") if not opkgcl.is_installed("b"): opk.fail("Package 'b' should be installed as a dependency of 'a' " "but reports as not installed") opkgcl.remove("b","--force-removal-of-dependent-packages") if opkgcl.is_installed("b"): opk.fail("Package 'b' removed but reports as installed.") if opkgcl.is_installed("a"): opk.xfail("Package 'b' removed with --force-removal-of-dependent-packages " "but 'a' which depends on 'b' still installed.")
opk.regress_init() o = opk.OpkGroup() o.add(Package="x") o.add(Package="a", Depends="b, c") o.add(Package="b") o.add(Package="c", Conflicts="x"); o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x") if not opkgcl.is_installed("x"): opk.fail("Package 'x' installed but reports as not installed.") opkgcl.install("a") if opkgcl.is_installed("c"): opk.fail("Package 'c' installed but conflicts with x.") if opkgcl.is_installed("a"): opk.fail("Package 'a' installed but dependency 'c' is not installed due to a conflict.") if opkgcl.is_installed("b"): opk.xfail("Package 'b' installed and orphaned.") opkgcl.remove("x") opkgcl.remove("a") opkgcl.remove("b") opkgcl.remove("c")
open("asdf", "w").close() a = opk.Opk(Package="a", Version="1.0", Depends="b") a.write() b = opk.Opk(Package="b", Version="1.0") b.write(data_files=["asdf"]) o = opk.OpkGroup() o.addOpk(a) o.addOpk(b) o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_autoinstalled("b"): opk.fail("b is not autoinstalled") if (bug): a = opk.Opk(Package="a", Version="2.0", Depends="b") a.write() b = opk.Opk(Package="b", Version="2.0") b.write(data_files=["asdf"]) o = opk.OpkGroup() o.addOpk(a) o.addOpk(b) o.write_list() opkgcl.update() opkgcl.upgrade();
import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package='a', Recommends='b (= 1.0)', Version='1.0') o.add(Package='b', Version='1.0') o.write_opk() o.write_list() opkgcl.update() opkgcl.install('a') o = opk.OpkGroup() o.add(Package='a', Recommends='b (= 2.0)', Version='2.0') o.add(Package='b', Version='2.0') o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade('a') if not opkgcl.is_installed("a", "2.0"): opk.fail("Package 'a' failed to upgrade") if not opkgcl.is_installed("b", "2.0"): opk.fail("Package 'b' failed to upgrade")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="x", Version="1.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x") if not opkgcl.is_installed("x"): opk.fail("Package 'x' installed but reports as not installed.") opkgcl.flag_hold("x") # Make new versions of 'x' and 'z' available o.add(Package="x", Version="2.0") o.add(Package="z", Depends="x>=2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("z") if opkgcl.is_installed("z"): opk.fail("Package 'z' installed despite dependency on 'x>=2.0' with 'x' version 1.0 on hold.") if opkgcl.is_installed("x", "2.0"):
o.add(Package="a", Version="1.0", Recommends="b") o.add(Package="b", Version="2.0") o.write_opk() o.write_list() # prime the status file so 'b' is not installed as a recommendation os.makedirs("{}/var/lib/opkg".format(cfg.offline_root)) status_filename = "{}/var/lib/opkg/status".format(cfg.offline_root) f = open(status_filename, "w") f.write("Package: b\n") f.write("Version: 1.0\n") f.write("Architecture: all\n") f.write("Status: deinstall hold not-installed\n") f.close() opkgcl.update() opkgcl.install("a") if opkgcl.is_installed("b"): opk.fail("Package 'b' installed despite " "deinstall/hold status.") opkgcl.remove("a") opkgcl.install("a") if opkgcl.is_installed("b"): opk.fail("Package 'b' installed - deinstall/hold status " "not retained.") opkgcl.remove("a") open(status_filename, "w").close()
opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b, c") o.add(Package="b") o.add(Package="c", Depends="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but does not report as installed.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' should be installed as a dependency of 'a' but does not report as installed.") if not opkgcl.is_installed("c"): opk.fail("Package 'c' should be installed as a dependency of 'a' but does not report as installed.") # Check the packages are marked correctly if opkgcl.is_autoinstalled("a"): opk.fail("Package 'a' explicitly installed by user but reports as auto installed.") if not opkgcl.is_autoinstalled("b"): opk.fail("Package 'b' installed as a dependency but does not report as auto installed.") if not opkgcl.is_autoinstalled("c"): opk.fail("Package 'c' installed as a dependency but does not report as auto installed.") # Check that autoinstalled packages are removed properly opkgcl.remove("a","--autoremove")
opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b") o.add(Package="b", Depends="d") o.add(Package="c", Provides="d", Conflicts="e") o.add(Package="e", Provides="d", Conflicts="c") o.write_opk() o.write_list() opkgcl.update() status, stdout = opkgcl.opkgcl(" --force-postinstall install a") if status != 0: opk.fail("Return value was different than 0") if "Collected errors" in stdout: opk.fail("Command returned an error") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but does not report as installed.") if not opkgcl.is_installed("b"): opk.fail( "Package 'b' should be installed as a dependency of 'a' but does not report as installed." ) if not opkgcl.is_installed("c") and not opkgcl.is_installed("e"): opk.fail( "Package 'c' or 'e' should be installed as a dependency of 'b' but does not report as installed." ) if opkgcl.is_installed("c") and opkgcl.is_installed("e"): opk.fail( "Package 'c' or 'e' should be installed as a dependency of 'b' but not both."
import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Essential="yes") o.add(Package="a", Version = "2.0", Essential="yes") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a_1.0_all.opk") if not opkgcl.is_installed("a","1.0"): opk.fail("Package 'a' installed but does not report as installed.") opkgcl.remove("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a 1.0' is marked essential but was removed.") # Upgrading a should be allowed opkgcl.install("a_2.0_all.opk") if not opkgcl.is_installed("a","2.0"): opk.fail("Package 'a 2.0' available but was not upgraded.") if opkgcl.is_installed("a","1.0"): opk.fail("Package 'a' upgraded but old version not removed.") opkgcl.remove("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a 2.0' is marked essential but was removed.")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Depends="b (= 1.0)") o.add(Package="b", Version="1.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' failed to install.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' not installed despite dependency from package 'a'.") o = opk.OpkGroup() o.add(Package="a", Version="1.1", Depends="b (= 1.1)") o.add(Package="b", Version="1.1") o.write_opk() o.write_list() opkgcl.update() # 'opkg upgrade b' should fail as it won't upgrade a opkgcl.upgrade("b") # Check 'a' has not been upgraded
o = opk.OpkGroup() o.add(Package="a", Depends="b (= 2.0)") o.add(Package="b", Version="1.0") o.add(Package="b", Version="2.0") o.add(Package="b", Version="3.0") o.write_opk() o.write_list() opkgcl.update() # install a and check that b(2.0) is installed opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if opkgcl.is_installed("b", "3.0"): opk.fail("Package 'a' depends on 'b(2.0)', but 'b(3.0)' installed.") if opkgcl.is_installed("b", "1.0"): opk.fail("Package 'a' depends on 'b(2.0)', but 'b(1.0)' installed.") if not opkgcl.is_installed("b", "2.0"): opk.fail("Package 'a' depends on 'b(2.0)', but 'b(2.0)' not installed.") # try installing b(3.0) which should fail opkgcl.install("b_3.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' was removed.") if opkgcl.is_installed("b", "3.0"): opk.fail("Package 'a' depends on 'b(2.0)', but 'b' upgraded to 3.0.") if opkgcl.is_installed("b", "1.0"): opkg.fail("Install called on 'b(3.0)' but 'b' downgraded to 1.0.")
o = opk.OpkGroup() o.add(Package="a", Depends="b (<< 2.0)") o.add(Package="b", Version="1.0") o.add(Package="b", Version="2.0") o.add(Package="b", Version="3.0") o.write_opk() o.write_list() opkgcl.update() # install a and check that b(1.0) is installed opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if opkgcl.is_installed("b", "3.0"): opk.fail( "Package 'a' depends on 'b' earlier than 2.0, but 'b(3.0)' installed.") if opkgcl.is_installed("b", "2.0"): opk.fail( "Package 'a' depends on 'b' earlier than 2.0, but 'b(2.0)' installed.") if not opkgcl.is_installed("b", "1.0"): opk.fail( "Package 'a' depends on 'b' earlier than 2.0, but 'b(1.0)' not installed." ) # try installing b(2.0) which should fail opkgcl.install("b_2.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' was removed.")
# # Within the function `pkg_hash_fetch_best_installation_candidate`, we wish to # test the condition where `(held_pkg && good_pkg_by_name) == true`. So install # a 1.0, mark it as on hold and explicitly install 'a_2.0_all.opk'. This # installation should be blocked. # import os import opk, cfg, opkgcl opk.regress_init() a_10 = opk.Opk(Package="a", Version="1.0") a_10.write() a_20 = opk.Opk(Package="a", Version="2.0") a_20.write() opkgcl.install("a_1.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") opkgcl.flag_hold("a") # Try to explicitly install a version 2.0 opkgcl.install("a_2.0_all.opk") if opkgcl.is_installed("a", "2.0"): opk.xfail("Old version of package 'a' flagged as on hold but was upgraded.") if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' not upgraded but old version was removed.")
# Open # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed") if not opkgcl.is_installed("b"): opk.fail("Package 'b' should be installed as a dependency of 'a' " "but reports as not installed") opkgcl.remove("b","--force-removal-of-dependent-packages") if opkgcl.is_installed("b"): opk.fail("Package 'b' removed but reports as installed.") if opkgcl.is_installed("a"): opk.fail("Package 'b' removed with --force-removal-of-dependent-packages " "but 'a' which depends on 'b' still installed.")
long_b = 110*"b" long_filename = long_dir + "/"+ long_b long_filename2 = long_dir + "/" + 110*"c" os.mkdir(long_dir) open(long_filename, "w").close() os.symlink(long_b, long_filename2) a = opk.Opk(Package="a") a.write(data_files=[long_dir, long_filename, long_filename2]) os.unlink(long_filename) os.unlink(long_filename2) os.rmdir(long_dir) opkgcl.install("a_1.0_all.opk") if not opkgcl.is_installed("a"): opk.fail("Package 'a' not installed.") if not os.path.exists("{}/{}".format(cfg.offline_root, long_dir)): opk.fail("dir with name longer than 100 " "characters not created.") if not os.path.exists("{}/{}".format(cfg.offline_root, long_filename)): opk.fail("file with a name longer than 100 characters, " "in dir with name longer than 100 characters, " "not created.") if not os.path.lexists("{}/{}".format(cfg.offline_root, long_filename2)): opk.fail("symlink with a name longer than 100 characters, " "pointing at a file with a name longer than " "100 characters," "in dir with name longer than 100 characters, "
opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Description="Just Short") o.add(Package="b", Version="1.0", Description="Terse\n Verbose description\n across multiple lines") o.write_opk() o.write_list() opkgcl.update() info = opkgcl.info("a") if "Just Short" not in info: opk.fail("Package 'a' description should contain 'Just Short'") info = opkgcl.info("a", flags="--short-description") if "Just Short" not in info: opk.fail("Package 'a' description should contain 'Just Short'") info = opkgcl.info("b") if "Terse" not in info: opk.fail("Package 'b' description should contain 'Terse'") if "Verbose description\n across multiple lines" not in info: opk.fail( "Package 'b' description should contain all lines because short-description was not specified" ) info = opkgcl.info("b", flags="--short-description") if "Terse" not in info:
# 3. Install 'b' # 4. Install 'a' # # What is the expected output? What do you see instead? ######################################## # # Installation of 'a' should fail, since 'a' conflicts with 'b'. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Provides="b", Conflicts="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("b") if not opkgcl.is_installed("b"): opk.fail("Package 'b' failed to install.") opkgcl.install("a") if opkgcl.is_installed("a"): opk.fail( "Package 'a' was incorrectly installed, since it conflicts with b.")
import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0") o.add(Package="a", Version="2.0") o.add(Package="a", Version="3.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a=1.0") if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a', Version '1.0', failed to install.") if opkgcl.is_upgradable("a", "2.0"): opk.fail( "Package 'a', is upgradable to version '2.0', though a better candidate is available." ) if not opkgcl.is_upgradable("a", "3.0"): opk.fail("Package 'a', is not upgradable to version '3.0'.") opkgcl.install("a=2.0") if not opkgcl.is_installed("a", "2.0"): opk.fail("Package 'a', Version '2.0', failed to install.") if not opkgcl.is_upgradable("a", "3.0"): opk.fail("Package 'a', is not upgradable to version '3.0'.")
# 4.- Install 'a' # 5.- Install 'b' # # What is the expected output? What do you see instead? # ====================================== # # Installation of b fails (it shouldn't) # import os import opk, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Provides="x", Conflicts="x") o.add(Package="b", Depends="x") o.add(Package="x") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") opkgcl.install("b") if not opkgcl.is_installed("b"): opk.fail("Package 'b' installed but reports as not installed.")
# A is installed and can be found in the status file. # # # Status # ====== # # Graham Gower: # > Can no longer reproduce. Must have been fixed as a side effect of other # > changes... import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b") o.add(Package="b", Depends="c") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if opkgcl.is_installed("a"): opk.fail("Package 'a' installed, despite dependency " "upon a package with an unresolved dependency.") if opkgcl.is_installed("b"): opk.fail("Package 'b' installed, despite unresolved dependency.")
# import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="2.0") o.add(Package="b", Version="1.0", Conflicts="a (<< 1.0)") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") opkgcl.install("b") o = opk.OpkGroup() o.add(Package="a", Version="3.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade() if not opkgcl.is_installed("a", "3.0"): opk.fail( "New version of package 'a' available during upgrade but was not installed" )
opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="c") o.add(Package="b", Depends="c") o.add(Package="c") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but does not report as installed.") if not opkgcl.is_installed("c"): opk.fail("Package 'c' should be installed as a dependency of 'a' but does not report as installed.") opkgcl.install("b") if not opkgcl.is_installed("b"): opk.fail("Package 'b' installed but does not report as installed.") # Check the packages are marked correctly if opkgcl.is_autoinstalled("a"): opk.fail("Package 'a' explicitly installed by user but reports as auto installed.") if opkgcl.is_autoinstalled("b"): opk.fail("Package 'b' explicitly installed by user but reports as auto installed.") if not opkgcl.is_autoinstalled("c"): opk.fail("Package 'c' installed as a dependency but does not report as auto installed.")
# # What is the expected output? What do you see instead? # ===================================================== # # Expect B to be removed with A. Instead only A is removed. # # # Status # ====== # # Fixed with r555/r556. import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Recommends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") opkgcl.remove("a", "--autoremove") if opkgcl.is_installed("b"): opk.fail("Recommended package 'b' not autoremoved.")
o = opk.OpkGroup() o.add(Package="a", Depends="nonexistent") o.add(Package="b", Depends="c") o.add(Package="c"); o.write_opk() o.write_list() opkgcl.update() # check that --force-depends works when installing a package opkgcl.install("a","--force-depends") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed with --force-depends but does not report as installed.") # check that --force-depends does not stop deps from being installed when available opkgcl.install("b", "--force-depends") if not opkgcl.is_installed("b"): opk.fail("Package 'b' installed but does not report as installed.") if not opkgcl.is_installed("c"): opk.fail("Package 'b' depends on 'c' and 'c' is available, but 'c' not installed.") # check that --force-depends works when removing a package opkgcl.remove("c", "--force-depends") if opkgcl.is_installed("c"): opk.fail("Package 'c' removed with --force-depends but reports as still installed.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' not removed but reports as not installed.")
# import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Depends="b") o.add(Package="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed") if not opkgcl.is_installed("b"): opk.fail("Package 'b' should be installed as a dependency of 'a' " "but reports as not installed") opkgcl.remove("b", "--force-removal-of-dependent-packages") if opkgcl.is_installed("b"): opk.fail("Package 'b' removed but reports as installed.") if opkgcl.is_installed("a"): opk.xfail( "[internalsolv] Package 'b' removed with --force-removal-of-dependent-packages " "but 'a' which depends on 'b' still installed.")
'set e', 'ls %s/test_file' % cfg.offline_root, ]) b.write() f = open('test_file', 'w') f.write('Test') f.close() c = opk.Opk(Package='c') c.write(data_files=['test_file']) o.opk_list.append(a) o.opk_list.append(b) o.opk_list.append(c) o.write_list() opkgcl.update() os.unlink('test_file') if opkgcl.install('a') != 0: opk.fail( "Installation of Pacakge 'a' failed (Return value was different than 0)" ) if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") if not opkgcl.is_installed("b"): opk.fail("Package 'b' installed but reports as not installed.") if not opkgcl.is_installed("c"): opk.fail("Package 'c' installed but reports as not installed.")
import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Depends="b") o.add(Package="b", Version="1.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") o = opk.OpkGroup() o.add(Package="a", Version="2.0", Depends="b") o.add(Package="b", Version="2.0") o.write_opk() o.write_list() opkgcl.update() status = opkgcl.upgrade() if not opkgcl.is_installed("a", "2.0"): opk.fail("New version of package 'a' available during upgrade but was not installed") if not opkgcl.is_installed("b", "2.0"): opk.fail("New version of package 'b' available during upgrade but was not installed") if status != 0: opk.fail("Return value was different than 0") opkgcl.remove("a") opkgcl.remove("b")
a2 = opk.Opk(Package="a") a2.write(data_files=["foo", "bar"]) o.opk_list.append(a2) o.write_list() os.unlink("foo") os.unlink("bar") opkgcl.update() opkgcl.install("a", "--force-reinstall") foo_fullpath = "{}/foo".format(cfg.offline_root) bar_fullpath = "{}/bar".format(cfg.offline_root) if not os.path.exists(foo_fullpath) or not os.path.exists(bar_fullpath): opk.fail("Files foo and/or bar are missing.") a_files = opkgcl.files("a") if not foo_fullpath in a_files or not bar_fullpath in a_files: opk.fail("Package 'a' does not own foo and/or bar.") opkgcl.remove("a") if os.path.exists(foo_fullpath) or os.path.exists(bar_fullpath): opk.fail("Files foo and/or bar still exist " "after removal of package 'a'.") # ---- o = opk.OpkGroup() a2 = opk.Opk(Package="a") a2.write()
# latest version is chosen out of the two available. Then explicitly install the # old version and check that it replaces the newer version, resulting in a # downgrade. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0") o.add(Package="a", Version="2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a") if not opkgcl.is_installed("a", "2.0"): opk.fail("Package 'a' installed but latest version does not report as installed.") if opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' version '1.0' installed as well as version '2.0'.") # Explicitly install old version opkgcl.install("a_1.0_all.opk", "--force-downgrade") if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' explicitly downgraded but old version does not report as installed.") if opkgcl.is_installed("a", "2.0"): opk.fail("Package 'a' explicitly downgraded but latest version still reports as installed.")