Example #1
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")
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")
Example #3
0
opkgcl.upgrade("b")

# Check 'a' has not been upgraded
if opkgcl.is_installed("a", "1.1"):
    opk.xfail("[ok for 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"):
    opk.fail("Package 'a_second' 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 fail as it won't upgrade a_second
opkgcl.upgrade("a")

# 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"):
    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 --combine a a_second' should succeed and upgrade a, a_second and b
opkgcl.upgrade("--combine a a_second")
Example #4
0
a1.write(data_files=["foo"])

opkgcl.install("a_1.0_all.opk")

o = opk.OpkGroup()
a2 = opk.Opk(Package="a", Version="2.0", Depends="b")
a2.write()
b1 = opk.Opk(Package="b", Version="1.0")
b1.write(data_files=["foo"])
o.opk_list.append(a2)
o.opk_list.append(b1)
o.write_list()

os.unlink("foo")

opkgcl.update()
opkgcl.upgrade()

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.xfail("[libsolv] File 'foo' incorrectly orphaned.")

if not foo_fullpath in opkgcl.files("b"):
    opk.fail("Package 'b' does not own file 'foo'.")

opkgcl.remove("a")
opkgcl.remove("b")
Example #5
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.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")
Example #6
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.")