Beispiel #1
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()
Beispiel #2
0
opk.regress_init()

long_dir = 110*"a"
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, "
Beispiel #3
0
#
# Status: Accepted
#

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("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:
Beispiel #4
0
# Mark an installed package a-1.0 as on hold, make available a-2.0 depended on
# 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"):
Beispiel #5
0
#!/usr/bin/python3

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")
# Install version 1.0 of a package 'x' which PROVIDES and CONFLICTS 'v', then
# try to upgrade it.

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"
#! /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.")
Beispiel #8
0
#
# 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.")
Beispiel #9
0
#! /usr/bin/env python
#
# Create package 'a' which depends on 'b'
# Install 'a' with --nodeps and check that 'b' is 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()

# installing with --nodeps should not install deps
opkgcl.install("a", "--nodeps")
if not opkgcl.is_installed("a"):
        opk.fail("Package 'a' installed but reports as not installed")
if opkgcl.is_installed("b"):
        opk.fail("Package 'a' installed with --nodeps but dependency 'b' installed.")
Beispiel #10
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"):
Beispiel #11
0
#
# 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.")
Beispiel #12
0
b.preinst = '\n'.join([
    '#!/bin/sh',
    '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', '--force-postinstall') != 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.")
Beispiel #13
0
opk.regress_init()

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()
Beispiel #14
0
b.preinst = '\n'.join([
    '#!/bin/sh',
    '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', '--force-postinstall') != 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.")
Beispiel #15
0
#! /usr/bin/env python3
#
# Create package 'a' which depends on 'b'
# Install 'a' with --nodeps and check that 'b' is 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()

# installing with --nodeps should not install deps
opkgcl.install("a", "--nodeps")
if not opkgcl.is_installed("a"):
        opk.fail("Package 'a' installed but reports as not installed")
if opkgcl.is_installed("b"):
        opk.fail("Package 'a' installed with --nodeps but dependency 'b' installed.")
Beispiel #16
0
#!/usr/bin/python3

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"):
	print(__file__, ": Package 'a' not installed.")
	exit(False)

if not os.path.exists("{}/asdf".format(cfg.offline_root)):
	print(__file__, ": asdf not created.")
	exit(False)

opkgcl.install("b_1.0_all.opk", "--force-overwrite")

if "{}/asdf".format(cfg.offline_root) not in opkgcl.files("b"):
	print(__file__, ": asdf not claimed by ``b''.")
	exit(False)

if "{}/asdf".format(cfg.offline_root) in opkgcl.files("a"):
	print(__file__, ": asdf is still claimed by ``a''.")
Beispiel #17
0
import os
import opk, cfg, opkgcl

opk.regress_init()

o = opk.OpkGroup()

o.add(Package="x")
o.add(Package="a", Recommends="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 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] 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 'a'.")
Beispiel #18
0
# Test that --download-only flag doesn't change the state
# of the system during install/remove/upgrade operations
#

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")
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"):
Beispiel #19
0
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(
Beispiel #20
0
import os
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'):
Beispiel #21
0
#!/usr/bin/python3

import os
import opk, cfg, opkgcl

opk.regress_init()

open("foo", "w").close()
a1 = opk.Opk(Package="a", Version="1.0", Architecture="all")
a1.write(data_files=["foo"])
os.rename("a_1.0_all.opk", "a_with_foo.opk")

opkgcl.install("a_with_foo.opk")

# ----
opkgcl.install("a_with_foo.opk")

open("bar", "w").close()
o = opk.OpkGroup()
a2 = opk.Opk(Package="a", Version="1.0", Architecture="all")
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)
Beispiel #22
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"):
Beispiel #23
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()
Beispiel #24
0
#
# 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")
Beispiel #25
0
opk.regress_init()

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()
Beispiel #26
0
opk.regress_init()

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.")
Beispiel #27
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"):
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()

# NOTE: Install commands need to be quoted here, since we call subprocess
# with shell=True (meaning characters like '<' would get handled by the shell)
opkgcl.install("'a<=2.0'")
if not opkgcl.is_installed("a", "2.0"):
    opk.fail("Package 'a', Version '2.0', failed to install.")

opkgcl.upgrade("a")
if not opkgcl.is_installed("a", "3.0"):
    opk.fail("Package 'a' was not upgraded to Version '3.0'.")

opkgcl.install("'a<<2.0'", "--force-downgrade")
if not opkgcl.is_installed("a", "1.0"):
    opk.fail("Package 'a' was not downgraded to Version '1.0'.")

opkgcl.install("'a>=2.0'")
if not opkgcl.is_installed("a", "3.0"):
    opk.fail("Package 'a', Version '3.0', failed to install.")
Beispiel #29
0
o = opk.OpkGroup()

# 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)
Beispiel #30
0
# Open

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"):
    cleanup()
    opk.xfail("package ``c'' not installed.")

cleanup()
Beispiel #31
0
o = opk.OpkGroup()

# 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")
Beispiel #32
0
#! /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'.")
Beispiel #33
0
# 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.")
Beispiel #34
0
#
# 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.")
Beispiel #35
0
o = opk.OpkGroup()

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
Beispiel #36
0
opk.regress_init()

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")
Beispiel #37
0
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.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.")

opkgcl.upgrade("a")
if not opkgcl.is_installed("a", "3.0"):
	opk.fail("Package 'a' was not upgraded to Version '3.0'.")

opkgcl.install("a=2.0", "--force-downgrade")
if not opkgcl.is_installed("a", "2.0"):
	opk.fail("Package 'a' was not downgraded to Version '2.0'.")

opkgcl.install("a=2.0", "--force-reinstall")
if not opkgcl.is_installed("a", "2.0"):
	opk.fail("Package 'a', Version '2.0 was not re-installed.")
Beispiel #38
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()
Beispiel #39
0
# 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'.")
Beispiel #40
0
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.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.")
Beispiel #41
0
import os
import opk, cfg, opkgcl
import re

opk.regress_init()

o = opk.OpkGroup()
o.add(Package='a-b', Version='1.0')
o.add(Package='a-c', Version='1.0')
o.add(Package='b-a', Version='1.0')
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")
Beispiel #42
0
#
# Files /foo & /foo1 are expected to exist and be provided by packages b and c.
#
#

import os
import opk, cfg, opkgcl

opk.regress_init()

open("foo", "w").close()
open("foo1", "w").close()
a1 = opk.Opk(Package="a", Version="1.0")
a1.write(data_files=["foo", "foo1"])

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

o = opk.OpkGroup()
a2 = opk.Opk(Package="a", Version="2.0", Depends="b,c")
a2.write()
b1 = opk.Opk(Package="b",
             Version="1.0",
             Conflicts="a (<< 2.0)",
             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)
Beispiel #43
0
opk.regress_init()

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).")
import os
import opk, cfg, opkgcl

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'):
Beispiel #45
0
import opk, cfg, opkgcl

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
Beispiel #46
0
    '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.")
Beispiel #47
0
o = opk.OpkGroup()

# 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)
Beispiel #48
0
# ======
#
# Graham Gower:
# > Fixed with r538.

import os
import opk, cfg, opkgcl

opk.regress_init()

open("foo", "w").close()
a1 = opk.Opk(Package="a")
a1.write(data_files=["foo"])
os.rename("a_1.0_all.opk", "a_with_foo.opk")

opkgcl.install("a_with_foo.opk")

# ----
opkgcl.install("a_with_foo.opk")

open("bar", "w").close()
o = opk.OpkGroup()
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()
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.")