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="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")
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") 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("--autoremove") if not opkgcl.is_installed("a", "2.0"): opk.xfail("New version of package 'a' available during upgrade but was not installed") if status != 0: opk.xfail("Return value was different than 0") opkgcl.remove("a") opkgcl.remove("b") opkgcl.remove("c")
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 opkgcl.upgrade("b") # Check 'a' has not been upgraded if opkgcl.is_installed("a", "1.1"): opk.xfail( "[libsolv] Package 'a' upgraded despite not being listed in packages to upgrade." ) if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' version 1.0 removed.") # Check 'a_second' has not been upgraded if opkgcl.is_installed("a_second", "1.1"): opk.fail( "Package 'a_second' upgraded despite not being listed in packages to upgrade." ) if not opkgcl.is_installed("a_second", "1.0"):
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.")
# # Upgrade fails # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Provides="b, c", Replaces="b", Conflicts="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a", "--force-postinstall") o = opk.OpkGroup() o.add(Package="a", Version="2.0", Provides="b, c", Replaces="b", Conflicts="b") o.write_opk() o.write_list() opkgcl.update() status = opkgcl.upgrade("--force-postinstall") if not opkgcl.is_installed("a", "2.0"): opk.fail("New version of package 'a' available during upgrade but was not installed") opkgcl.remove("a")
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 opkgcl.upgrade("b") # Check 'a' has not been upgraded if opkgcl.is_installed("a", "1.1"): opk.fail("Package 'a' upgraded despite not being listed in packages to upgrade.") if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' version 1.0 removed.") # Check 'a_second' has not been upgraded if opkgcl.is_installed("a_second", "1.1"): opk.fail("Package 'a_second' upgraded despite not being listed in packages to upgrade.") if not opkgcl.is_installed("a_second", "1.0"): opk.fail("Package 'a_second' version 1.0 removed.") # Check 'b' has not been upgraded if opkgcl.is_installed("b", "1.1"):
Replaces="a (<< 2.0)") b1.write(data_files=["foo"]) c1 = opk.Opk(Package="c", 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'.")
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.")
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")
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")
# # Test opkg when specifying a virtual package to install: # opkg install <virtual_pkg_name> # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version='1.0', Provides="virt") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("virt") if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'virt' (provided by 'a') failed to install.") o.add(Package="a", Version='2.0', Provides="virt") o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade("virt") if not opkgcl.is_installed("a", "2.0"): opk.fail("Package 'virt' (provided by 'a') failed to upgrade.")
# import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a", Version="1.0", Provides="b, c", Replaces="b", Conflicts="b") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("a", "--force-postinstall") o = opk.OpkGroup() o.add(Package="a", Version="2.0", Provides="b, c", Replaces="b", Conflicts="b") o.write_opk() o.write_list() opkgcl.update() status = opkgcl.upgrade("--force-postinstall") if not opkgcl.is_installed("a", "2.0"): opk.fail( "New version of package 'a' available during upgrade but was not installed" ) opkgcl.remove("a")
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 if opkgcl.is_installed("a", "1.1"): opk.xfail("[libsolv] Package 'a' upgraded despite not being listed in packages to upgrade.") if not opkgcl.is_installed("a", "1.0"): opk.fail("Package 'a' version 1.0 removed.") # Check 'b' has not been upgraded if opkgcl.is_installed("b", "1.1"): opk.fail("Package 'b' upgraded despite breaking dependency of package 'a'.") if not opkgcl.is_installed("b", "1.0"): opk.fail("Package 'b' version 1.0 removed.") # 'opkg upgrade a' should succeed and upgrade both a and b opkgcl.upgrade("a")
#! /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.")
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")
if not opkgcl.is_installed('a-b'): opk.fail("Package 'a-b' not installed but reports as being installed.") if not opkgcl.is_installed('a-c'): opk.fail("Package 'a-c' not installed but reports as being installed.") if opkgcl.is_installed('b-a'): opk.fail("Package 'b-a' was incorrectly installed") o.add(Package='a-b', Version='2.0') o.add(Package='a-c', Version='2.0') o.add(Package='b-a', Version='2.0') o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade("'a*'") if not opkgcl.is_installed('a-b', '2.0'): opk.fail( "New version of package 'a-b' available during upgrade but was not installed." ) if not opkgcl.is_installed('a-c', '2.0'): opk.fail( "New version of package 'a-c' available during upgrade but was not installed." ) if opkgcl.is_installed('b-a'): opk.fail("Package 'b-a' was incorrectly installed") opkgcl.remove("'a*'") opkgcl.install('b-a=1.0') opkgcl.upgrade("'?-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' installed but reports as not installed.") if not opkgcl.is_installed('c'): opk.fail("Package 'c' should have been installed since 'b' depends on it.") if not opkgcl.is_installed('d'): opk.fail("Package 'd' installed but reports as not installed.") opkgcl.remove('b c d', '--force-depends') o.add(Package='a', Recommends='c', Version='2.0') o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade('a', "--add-ignore-recommends '*'") if not opkgcl.is_installed('a', '2.0'): opk.fail("Package 'a (2.0)' installed but reports as not installed.") if opkgcl.is_installed('c'): opk.fail("Package 'c' should not have been installed since it was in --add-ignore-recommends.") if opkgcl.is_installed('d'): opk.fail("Package 'd' should not have been installed since it was in --add-ignore-recommends.")
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(); if not opkgcl.is_autoinstalled("b"): opk.fail("b is not autoinstalled anymore") a = opk.Opk(Package="a", Version="3.0") a.write(data_files=["asdf"]) os.unlink("asdf") o = opk.OpkGroup() o.addOpk(a) o.write_list() opkgcl.update() opkgcl.upgrade();
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")
) opkgcl.remove('a') 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.fail("Package 'b' installed but reports as not installed.") if not opkgcl.is_installed('c'): opk.fail("Package 'c' should have been installed since 'b' depends on it.") opkgcl.remove('b c', '--force-depends') o.add(Package='a', Recommends='c', Version='2.0') o.write_opk() o.write_list() opkgcl.update() opkgcl.upgrade('a', '--add-ignore-recommends c') if not opkgcl.is_installed('a', '2.0'): opk.fail("Package 'a (2.0)' installed but reports as not installed.") if opkgcl.is_installed('c'): opk.fail( "Package 'c' should not have been installed since it was in --add-ignore-recommends." )