Пример #1
0
 def test_repo_add(self):
   pool = satsolver.Pool()
   assert pool
   pool.set_arch("i686")
   repo = pool.add_solv( "../../testdata/os11-biarch.solv" )
   repo.set_name("test")
   assert repo.name() == "test"
Пример #2
0
 def test_repo_attr(self):
   pool = satsolver.Pool()
   assert pool
   pool.set_arch("i686")
   repo = pool.add_solv( "../../testdata/timestamp.solv" )
   print "Timestamp ", repo.attr("repository:timestamp")
   assert True
Пример #3
0
    def test_repodata(self):
        pool = satsolver.Pool()
        assert pool
        pool.set_arch("x86_64")
        repo = pool.add_solv("../../testdata/os11-biarch.solv")
        repo.set_name("openSUSE 11.0 Beta3 BiArch")
        print "Repo ", repo.name(), " loaded with ", repo.size(), " solvables"

        print "Repo has ", repo.datasize(), " Repodatas attached"
        assert repo.datasize() > 0
        assert repo.data(-1) == None
        assert repo.data(repo.datasize()) == None
        assert repo.data(repo.datasize() - 1)
        for d in repo.datas():
            assert d

        repodata = repo.data(0)
        assert repodata

        print "Repodata has ", repodata.size(), " keys"
        for k in repodata.keys():
            print "  Key ", k.name(), " is ", k.type().__str__(
            ), "[", k.type_id(), "] with ", k.size(), " bytes"

        i = 0
        for s in repo:
            print "Solvable %s: mediadir %s group %s, time %s, downloadsize %s, installsize %s" % (
                s, s.attr('solvable:mediadir'), s.attr('solvable:group'),
                s.attr('solvable:buildtime'), s.attr('solvable:downloadsize'),
                s.attr('solvable:installsize'))
            i += 1
            if i == 10:
                break
Пример #4
0
 def test_repo_create(self):
   pool = satsolver.Pool()
   assert pool
   repo = satsolver.Repo( pool, "test" )
   # equivalent: repo = pool.create_repo( "test" )
   assert repo
   assert repo.size() == 0
   assert repo.name() == "test"
Пример #5
0
 def setUp(self):
     self.pool = satsolver.Pool()
     assert self.pool
     self.repo = satsolver.Repo(self.pool, "test")
     assert self.repo
     self.pool.set_arch("i686")
     self.repo = self.pool.add_solv("os11-biarch.solv")
     assert self.repo.size() > 0
Пример #6
0
 def test_providers(self):
   pool = satsolver.Pool()
   assert pool
   pool.set_arch("i686")
   repo = pool.add_solv( "../../testdata/os11-biarch.solv" )
   print "Addedfileprovides ", repo.attr("repository:addedfileprovides")
   for s in pool.providers("glibc"):
     print s, "provides 'glibc'"
   assert True
Пример #7
0
 def test_repo_iterate(self):
   pool = satsolver.Pool()
   assert pool
   repoA = pool.create_repo( "testA" )
   repoB = pool.create_repo( "testB" )
   repoC = pool.create_repo( "testC" )
   repoD = pool.create_repo( "testD" )
   assert pool.count_repos() == 4
   for r in pool.repos():
       print r
   assert True
Пример #8
0
 def test_deps(self):
   pool = satsolver.Pool()
   assert pool
   pool.set_arch("i686")
   repo = pool.add_solv( "../../testdata/os11-biarch.solv" )
   i = 0
   for s in repo:
     i = i + 1
     if i > 10:
         break
     print s
   assert True
Пример #9
0
 def test_repo_search_files(self):
   pool = satsolver.Pool()
   assert pool
   pool.set_arch("i686")
   repo = pool.add_solv( "os11-biarch.solv" )
   repo.set_name("test")
   i = 0
   for d in repo.search("/usr/bin/python", satsolver.SEARCH_STRING|satsolver.SEARCH_FILES, None, "solvable:filelist"):
     print d.solvable(), "matches '/usr/bin/python' in ", d.keyname(), ":  ", d.value()
     i = i + 1
     if i > 10:
         break;
   assert True
Пример #10
0
 def test_repo_search(self):
   pool = satsolver.Pool()
   assert pool
   pool.set_arch("i686")
   repo = pool.add_solv( "os11-biarch.solv" )
   repo.set_name("test")
   i = 0
   for d in repo.search("yast2", satsolver.SEARCH_STRING):
     print d.solvable(), "matches 'yast2' in ", d.keyname(), ":  ", d.value()
     i = i + 1
     if i > 10:
         break;
   assert True
Пример #11
0
    def __init__(self, pakfire, arch):
        self.pakfire = pakfire

        # Initialize the pool and set the architecture.
        self.pool = satsolver.Pool()
        self.pool.set_arch(arch)

        #self.pool.add_solv("/home/satsolver/sat-solver-bindings/bindings/testdata/os11-biarch.solv")

        # Initialize all repositories.
        self.repos = self.init_repos()

        self.pool.prepare()

        print self.pool.size()
Пример #12
0
    def test_filelists(self):
        pool = satsolver.Pool()
        assert pool
        pool.set_arch("x86_64")
        repo = pool.add_solv("os11-biarch.solv")
        repo.set_name("openSUSE 11.0 Beta3 BiArch")
        i = 0
        for solv in pool:
            print "Filelist for ", i, " of ", pool.size(), solv
            if solv.attr_exists('solvable:filelist'):
                a = solv.attr('solvable:filelist')
                print a
            else:
                print "-"

            i = i + 1
Пример #13
0
    def __init__(self,
                 path="/",
                 config=None,
                 configs=None,
                 arch=None,
                 **kwargs):
        # Indicates if this instance has already been initialized.
        self.initialized = False

        # Check if we are operating as the root user.
        self.check_root_user()

        # The path where we are operating in.
        self.path = path

        # check if we are actually running on an ipfire system.
        if not self.mode and self.path == "/":
            self.check_is_ipfire()

        # Get the configuration.
        if config:
            self.config = config
        else:
            self.config = self._load_config(configs)

        # Update configuration with additional arguments.
        for section, settings in kwargs.items():
            self.config.update(section, settings)

        # Dump the configuration.
        self.config.dump()

        # Initialize the keyring.
        self.keyring = keyring.Keyring(self)

        # Get more information about the distribution we are running
        # or building
        self.distro = distro.Distribution(self.config.get_distro_conf())
        if arch:
            self.distro.arch = arch

        self.pool = satsolver.Pool(self.distro.arch)
        self.repos = repository.Repositories(self)
Пример #14
0
  def test_each_provider(self):
    pool = satsolver.Pool()
    assert pool
    pool.set_arch("x86_64")
    repo = pool.add_solv( "../../testdata/os11-biarch.solv" )
    repo.set_name( "openSUSE 11.0 Beta3 BiArch" )
    print "Repo ", repo.name(), " loaded with ", repo.size(), " solvables"
    system = pool.add_rpmdb( "/" )
    system.set_name("@system")
    print "Repo ", system.name(), " loaded with ", system.size(), " solvables"

    pool.prepare()

    i = 0
    for solv in pool.providers("ispell_dictionary"):
      print solv, " provides ispell_dictionary"

    rel = pool.create_relation( "ispell_english_dictionary", satsolver.REL_GT, "3.3.02-23" )
    for solv in pool.providers(rel):
      print solv, solv.repo().name()
Пример #15
0
    def test_rpmdb(self):
        pool = satsolver.Pool()
        assert pool
        pool.set_arch("i686")
        repo = pool.add_rpmdb("/")
        assert repo.size() > 0
        print repo.size(), " installed packages"

        i = 0
        name = None
        for s in pool:
            print s, " Vendor: ", s.vendor()
            if i == 7:
                name = s.name()
            i += 1
            if i > 10:
                break

        s = pool.find(name)
        print "Seventh: ", name, " -> ", s
Пример #16
0
 def setUp(self):
   self.pool = satsolver.Pool()
   assert self.pool
   self.pool.set_arch("i686")
   self.pool.add_solv( os.path.abspath(__file__+"/../../../testdata/os11-biarch.solv" ))
   assert self.pool.size() > 0
   
   
   self.installed = self.pool.create_repo( 'system' )
   assert self.installed
   self.installed.create_solvable( 'A', '0.0-0' )
   self.installed.create_solvable( 'B', '1.0-0' )
   self.installed.create_solvable( 'C', '2.0-0' )
   self.installed.create_solvable( 'D', '3.0-0' )
   
   self.repo = self.pool.create_repo( 'test' )
   assert self.repo
   self.repo.create_solvable( 'A', '1.0-0' )
   self.repo.create_solvable( 'B', '2.0-0' )
   self.repo.create_solvable( 'CC', '3.3-0' )
   self.repo.create_solvable( 'DD', '4.4-0' )
Пример #17
0
 def setUp(self):
     self.pool = satsolver.Pool()
     assert self.pool
     self.pool.set_arch("i686")
     self.pool.add_solv("../../testdata/os11-biarch.solv")
     assert self.pool.size() > 0
Пример #18
0
 def testpool(self):
     pool = satsolver.Pool()
     assert pool
     assert pool.count_repos() == 0
Пример #19
0
 def testpool1(self):
     pool = satsolver.Pool()
     assert pool
     pool.set_arch("i686")
Пример #20
0
 def testpool2(self):
     pool = satsolver.Pool("i686")
     assert pool