Exemple #1
0
#! /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.")
#! /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.xfail("Package 'y' not installed despite lack of conflicts.")
Exemple #3
0
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="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()
Exemple #4
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(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 than 2.0, but 'b(1.0)' installed.")
if opkgcl.is_installed("b", "2.0"):
    opk.fail("Package 'a' depends on 'b' later than 2.0, but 'b(2.0)' installed.")
if not opkgcl.is_installed("b", "3.0"):
    opk.fail("Package 'a' depends on 'b' later than 2.0, but 'b(3.0)' not installed.")

# try downgrading to b(2.0) which should fail
opkgcl.install("b_2.0_all.opk","--force-downgrade")
if not opkgcl.is_installed("a"):
    opk.fail("Package 'a' was removed.")
if opkgcl.is_installed("b", "1.0"):
    opk.fail("Install called on 'b(2.0)', but 'b(1.0)' installed.")
if opkgcl.is_installed("b", "2.0"):
Exemple #5
0
# 'b' and 'c'. Ensure that 'a' can be installed and either 'b' or 'c' is
# installed.
#
# This ensures that opkg can select a provider when both providers are
# effectively equal. Neither is preferred, neither is held, neither matches the
# abstract package name, etc.
#
# In opkg v0.2.3 this failed: neither provider was selected and so no provider
# of 'p' was returned.
#

import os
import opk, cfg, opkgcl

opk.regress_init()

o = opk.OpkGroup()
o.add(Package="a", Depends="p")
o.add(Package="b", Provides="p")
o.add(Package="c", Provides="p")
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") or opkgcl.is_installed("c")):
    opk.fail("No provider of 'p' was installed.")
Exemple #6
0
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")
Exemple #7
0
import opk, cfg, opkgcl


def cleanup():
    opkgcl.remove("a")
    opkgcl.remove("b")
    opkgcl.remove("c")


opk.regress_init()

o = opk.OpkGroup()
o.add(Package="a", Provides="v")
o.add(Package="b", Provides="v", Depends="b_nonexistant")
o.add(Package="c", Depends="v")

o.write_opk()
o.write_list()

opkgcl.update()

# install ``c'' from repository
opkgcl.install("c")
if not opkgcl.is_installed("c"):
    print(__file__, ": package ``c'' not installed.")
    cleanup()
    exit(False)

cleanup()
# by z. Check that z refuses to install due to a-1.0 being held.

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.")
Exemple #9
0
o.add(Package="b", Version="2.0", Architecture="all")
o.write_opk()
o.write_list()

# prime the status file so 'b' is not installed as a recommendation
status_filename = "{}/usr/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"):
    print(__file__, ": Package 'b' installed despite "
          "deinstall/hold status.")
    exit(False)

opkgcl.remove("a")
opkgcl.install("a")
if opkgcl.is_installed("b"):
    print(__file__, ": Package 'b' installed - deinstall/hold status "
          "not retained.")
    exit(False)

opkgcl.remove("a")
open(status_filename, "w").close()
Exemple #10
0
#! /usr/bin/env python
#
# Install a package 'x' which PROVIDES and CONFLICTS 'v', indicating that 'v' is
# a virtual package and no other provider of this virtual package should be
# installed whilst 'x' is installed. Then try to install 'y' which also PROVIDES
# 'v'.

import os
import opk, cfg, opkgcl

opk.regress_init()

o = opk.OpkGroup()
o.add(Package="x", Provides="v", Conflicts="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 fail

opkgcl.install("y")
if opkgcl.is_installed("y"):
	opk.fail("Package 'y' installed despite conflict with 'v' provided by 'x'.")
Exemple #11
0
opk.regress_init()

o = opk.OpkGroup()
o.add(Package="a", Version="2.0")
o.write_opk()
o.write_list()

# older version, not in Packages list
a1 = opk.Opk(Package="a", Version="1.0")
a1.write()

opkgcl.update()

# install v2 from repository
opkgcl.install("a")
if not opkgcl.is_installed("a", "2.0"):
    print(__file__, ": Package 'a_2.0' not installed.")
    exit(False)

opkgcl.install("a_1.0_all.opk", "--force-downgrade")
if not opkgcl.is_installed("a", "1.0"):
    print(__file__, ": Package 'a_1.0' not installed (1).")
    exit(False)

opkgcl.install("a_1.0_all.opk", "--force-downgrade")
if not opkgcl.is_installed("a", "1.0"):
    print(__file__, ": Package 'a_1.0' not installed (2).")
    exit(False)

opkgcl.remove("a")
Exemple #12
0
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.xfail(
        "[internalsolv/libsolv<0.6.28]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.fail(
        "Package 'a' not installed even though 'c' is not an absolute dependency of 'b'."
Exemple #13
0
with open('conflict_file', 'w') as f:
    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")

b2 = opk.Opk(Package='b', Version='2.0')
b2.write(data_files=['conflict_file'])

o.opk_list.append(b2)
o.write_list()

opkgcl.update()

# Installing another version to ensure the state of the first gets updated
# even though the second also contains a conflict
opkgcl.install('b_2.0_all.opk')
import opk, cfg, opkgcl

opk.regress_init()
o = opk.OpkGroup()

o.add(Package='a', Recommends='c', Version='1.0')
o.add(Package='b', Depends='c')
o.add(Package='c')
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."
    )

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.")
Exemple #15
0
# by z. Check that z refuses to install due to a-1.0 being held.

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.")
Exemple #16
0
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")
Exemple #17
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(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"):
Exemple #18
0
o = opk.OpkGroup()
o.add(Package="a", Provides="v", Depends="a1")
o.add(Package="b", Provides="v", Depends="b1")
o.add(Package="c", Depends="v")
o.add(Package="a1")
o.add(Package="b1")

o.write_opk()
o.write_list()

opkgcl.update()

# install ``a1`` directly
opkgcl.install("a1_1.0_all.opk")
if not opkgcl.is_installed("a1"):
	print(__file__, ": package ``a1'' not installed.")
	cleanup()
	exit(False)

# install ``c'' from repository
opkgcl.install("c")
if not opkgcl.is_installed("c"):
	print(__file__, ": package ``c'' not installed.")
	cleanup()
	exit(False)

if opkgcl.is_installed("b1"):
	print(__file__, ": package ``b1'' is installed, but should not be.")
	cleanup()
	exit(False)
Exemple #19
0
o.add(Package="b", Version="2.0", Architecture="all")
o.write_opk()
o.write_list()

# prime the status file so 'b' is not installed as a recommendation
status_filename = "{}/usr/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"):
	print(__file__, ": Package 'b' installed despite "
					"deinstall/hold status.")
	exit(False)

opkgcl.remove("a")
opkgcl.install("a")
if opkgcl.is_installed("b"):
	print(__file__, ": Package 'b' installed - deinstall/hold status "
					"not retained.")
	exit(False)

opkgcl.remove("a")
open(status_filename, "w").close()
Exemple #20
0
import os
import opk, cfg, opkgcl

opk.regress_init()

o = opk.OpkGroup()
o.add(Package="a", Version="1.0", Provides="b")
o.add(Package="x", Depends="a")
o.add(Package="y", Depends="b")
o.write_opk()
o.write_list()

opkgcl.update()

opkgcl.install("x")
if not opkgcl.is_installed("x"):
	opk.fail("Package 'x' failed to install.")

opkgcl.install("y")
if not opkgcl.is_installed("y"):
	opk.fail("Package 'y' failed to install.")

if not opkgcl.is_installed("a"):
	opk.fail("Package 'a' not installed despite being a dependency of installed packages.")

o = opk.OpkGroup()
o.add(Package="a", Version="2.0", Depends="b")
o.add(Package="b")
o.add(Package="x", Depends="a")
o.add(Package="y", Depends="b")
o.write_opk()
Exemple #21
0
opk.regress_init()

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.")
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.")