def cleanup(): opkgcl.remove("a") opkgcl.remove("b") opkgcl.remove('c')
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")
def cleanup(): opkgcl.remove("a1") opkgcl.remove("b1") opkgcl.remove("a") opkgcl.remove("b") opkgcl.remove('c')
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")
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.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.")
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() opkgcl.update() opkgcl.install('b') if not opkgcl.is_installed('b', '2.0'):
def cleanup(): opkgcl.remove("a") opkgcl.remove("b") opkgcl.remove("c")
o = opk.OpkGroup() o.add(Package="x", Version="1.0", Architecture="a") o.add(Package="x", Version="2.0", Architecture="b") o.write_opk() o.write_list() opkgcl.update() arch_flags = "--add-arch a:2 --add-arch b:1" # install should prioritize version opkgcl.install("x", arch_flags) if opkgcl.is_installed("x", "1.0", arch_flags): opk.fail("Package 'x(2.0)' available but 1.0 installed") if not opkgcl.is_installed("x", "2.0", arch_flags): opk.fail("Package 'x(2.0)' available but was not installed.") opkgcl.remove("x", arch_flags) if opkgcl.is_installed("x", "2.0", arch_flags): opk.fail("Package 'x' removed but reports as installed.") # prefer-arch-to-version should prefer the architecture opkgcl.install("x", arch_flags + " --prefer-arch-to-version") if opkgcl.is_installed("x", "2.0", arch_flags): opk.fail("Package 'x(1.0) has preferred arch but 2.0 was installed") if not opkgcl.is_installed("x", "1.0", arch_flags): opk.fail( "Package 'x(1.0)' with preferred arch available but was not installed." )
o.write_opk() o.write_list() opkgcl.update() opkgcl.install("'a*'") if not opkgcl.is_installed('a-b'): opk.xfail( "[internalsolv] 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") opkgcl.remove("'a*'") if opkgcl.is_installed('a-b'): opk.fail("Package 'a-b' failed to remove") if opkgcl.is_installed('a-c'): opk.fail("Package 'a-c' failed to remove") opkgcl.install("'?-b'") if not opkgcl.is_installed('a-b'): opk.fail("Package 'a-b' not installed but reports as being installed.") if opkgcl.is_installed('a-c'): opk.fail("Package 'a-c' was incorrectly installed") if opkgcl.is_installed('b-a'): opk.fail("Package 'b-a' was incorrectly installed") opkgcl.remove("'?-b'") if opkgcl.is_installed('a-b'):
'ls "$0"', ]) o.addOpk(a) o.write_opk() o.write_list() prepare_sysroot() opkgcl.update() # First install with intercepts enabled truncFile(TEST_LOG) if opkgcl.install('a', '--force-postinstall') != 0: opk.fail('Failed to install test package') if opkgcl.remove('a', '--force-postinstall') != 0: opk.fail('Failed to remove test package') if readFile(TEST_LOG) != 'intercept from a.postinst:': opk.fail('Unexpected intercept log') # Reconfigure opkg to disable intercepts appendFile('%s/etc/opkg/opkg.conf' % cfg.offline_root, 'option intercepts_dir /dev/null\n') # Re-run the test truncFile(TEST_LOG) if opkgcl.install('a', '--force-postinstall') != 0: opk.fail('Failed to install test package') if opkgcl.remove('a', '--force-postinstall') != 0: opk.fail('Failed to remove test package') if readFile(TEST_LOG) != '':
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) if not x2fullpath in opkgcl.files("b"): opk.xfail("Package 'b' does not own file 'x2'.") opkgcl.remove("b")
o.add(Package='a', subdirectory='./ipks/') o.write_opk() o.write_list() opkgcl.update() workdir = Path(cfg.opkdir, 'work') # refresh the work directory, clearing old downloads try: rmtree(workdir) except FileNotFoundError: pass os.makedirs(workdir, exist_ok=False) os.chdir(workdir) # check that the relative-pathed package can be installed opkgcl.install('a') if not opkgcl.is_installed('a'): opk.fail("Relatively-pathed package 'a' reports as not installed.") opkgcl.remove('a') # check that a download operation deposits the file in work/, rather than a # subdirectory. status = opkgcl.download('a') if status > 0: opk.fail('opkg download operation returned status code %d' % status) path_actual = os.path.join(workdir, 'a_1.0_all.opk') try: os.stat(path_actual) except FileNotFoundError: opk.fail("Package 'a' downloaded to an incorrect path.")
o.add(Package="y", Version="1.0", Depends="x") o.write_opk() o.write_list() opkgcl.update() # Will force failure to install 'x', even though it's listed in Packages os.unlink("x_1.0_all.opk") opkgcl.install("y") o.removeOpk(x) o.add(Package="x", Version="2.0") o.write_opk() o.write_list() opkgcl.update() opkgcl.install("x") if not opkgcl.is_installed("x", version="2.0"): opk.fail("Failed to install 'x' (2.0)") opkgcl.remove("y") if opkgcl.is_installed("y"): opk.fail("Failed to uninstall 'y'") opkgcl.remove("x") if opkgcl.is_installed("x"): opk.fail("Failed to uninstall 'x'")
'ls "$0"', ]) o.addOpk(a) o.write_opk() o.write_list() prepare_sysroot() opkgcl.update() # First install with intercepts enabled truncFile(TEST_LOG) if opkgcl.install('a') != 0: opk.fail('Failed to install test package') if opkgcl.remove('a') != 0: opk.fail('Failed to remove test package') if readFile(TEST_LOG) != 'intercept from a.postinst:': opk.fail('Unexpected intercept log') sysconfdir = os.environ['SYSCONFDIR'] testconfdir = cfg.offline_root + sysconfdir # Reconfigure opkg to disable intercepts appendFile('%s/opkg/opkg.conf' % testconfdir, 'option intercepts_dir /dev/null\n') # Re-run the test truncFile(TEST_LOG) if opkgcl.install('a') != 0: opk.fail('Failed to install test package') if opkgcl.remove('a') != 0:
#! /usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # # Install a package and check that it is listed as installed. Then remove the # package and check that it is no longer listed as installed. # import os import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() o.add(Package="a") o.write_opk() o.write_list() opkgcl.update() if opkgcl.is_installed("a"): opk.fail("Package 'a' not installed but reports as being installed.") opkgcl.install("a") if not opkgcl.is_installed("a"): opk.fail("Package 'a' installed but reports as not installed.") opkgcl.remove("a") if opkgcl.is_installed("a"): opk.fail("Package 'a' removed but still reports as being installed.")
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.") # Check that trying to remove 'b' fails and doesn't change the system (issue 9862) if not opkgcl.remove("b"): opk.fail("Package 'b' should not be allowed to be uninstalled") if not opkgcl.is_installed("a"): opk.fail("Package 'a' was incorrectly uninstalled") if not opkgcl.is_installed("b"): opk.fail("Package 'b' was incorrectly uninstalled")
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 # 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.")
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")
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.")
# 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.")
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") if opkgcl.is_installed("a"): opk.fail("Package 'a' removed but reports as installed.") if opkgcl.is_installed("b"): opk.xfail("Package 'b' not removed from --autoremove.") if opkgcl.is_installed("c"): opk.fail("Package 'c' not removed from --autoremove.")
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.") # Check that autoinstalled packages are not removed when other packages still depend on them opkgcl.remove("a","--autoremove") if opkgcl.is_installed("a"): opk.fail("Package 'a' removed but reports as installed.") if not opkgcl.is_installed("c"): opk.fail("Package 'c' depended upon by 'b' but was autoremoved.") # Check that autoinstalled packages are removed when no other packages depend on them opkgcl.remove("b","--autoremove") if opkgcl.is_installed("b"): opk.fail("Package 'b' removed but reports as installed.") if opkgcl.is_installed("c"): opk.fail("Package 'c' not removed from --autoremove.")
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.") opkgcl.remove("a", "--force-removal-of-essential-packages")
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.")
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) if not x2fullpath in opkgcl.files("b"): opk.xfail("[libsolv] Package 'b' does not own file 'x2'.") opkgcl.remove("b")
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() o.opk_list.append(a2) o.write_list() opkgcl.update()
opk.regress_init() o = opk.OpkGroup() o.add(Package="x", Version="1.0", Architecture="a") o.add(Package="x", Version="2.0", Architecture="b") o.write_opk() o.write_list() opkgcl.update() arch_flags = "--add-arch a:2 --add-arch b:1" # install should prioritize version opkgcl.install("x", arch_flags) if opkgcl.is_installed("x", "1.0", arch_flags): opk.fail("Package 'x(2.0)' available but 1.0 installed") if not opkgcl.is_installed("x", "2.0", arch_flags): opk.fail("Package 'x(2.0)' available but was not installed.") opkgcl.remove("x", arch_flags) if opkgcl.is_installed("x", "2.0", arch_flags): opk.fail("Package 'x' removed but reports as installed.") # prefer-arch-to-version should prefer the architecture opkgcl.install("x", arch_flags + " --prefer-arch-to-version") if opkgcl.is_installed("x", "2.0", arch_flags): opk.fail("Package 'x(1.0) has preferred arch but 2.0 was installed") if not opkgcl.is_installed("x", "1.0", arch_flags): opk.fail("Package 'x(1.0)' with preferred arch available but was not installed.")