Mailinglist Archive: zypp-commit (185 mails)

< Previous Next >
[zypp-commit] r10751 - /trunk/sat-solver/bindings/python/tests/rpmdb.py
  • From: kkaempf@xxxxxxxxxxxxxxxx
  • Date: Tue, 05 Aug 2008 10:52:22 -0000
  • Message-id: <20080805105222.43CBF39C5E@xxxxxxxxxxxxxxxx>
Author: kkaempf
Date: Tue Aug 5 12:52:21 2008
New Revision: 10751

URL: http://svn.opensuse.org/viewcvs/zypp?rev=10751&view=rev
Log:
getting installed packages

Added:
trunk/sat-solver/bindings/python/tests/rpmdb.py

Added: trunk/sat-solver/bindings/python/tests/rpmdb.py
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/python/tests/rpmdb.py?rev=10751&view=auto
==============================================================================
--- trunk/sat-solver/bindings/python/tests/rpmdb.py (added)
+++ trunk/sat-solver/bindings/python/tests/rpmdb.py Tue Aug 5 12:52:21 2008
@@ -0,0 +1,45 @@
+#
+# Load repository from rpm database
+#
+# repo = pool.add_rpmdb( "/root/dir/of/system" )
+# will create an unnamed repository by reading the rpm database
+# and create a solvable for each installed package.
+# Use
+# repo.name = "..."
+# to name the repository
+#
+#
+
+import unittest
+
+import sys
+sys.path.insert(0, '../../../build/bindings/python')
+
+import satsolver
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ 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"
+
+ name = None
+ for i in range(0, pool.size()):
+ s = pool.get(i)
+ print s
+ if i == 7:
+ name = s.name()
+ i += 1
+ if i > 10:
+ break
+
+ s = pool.find( name )
+ print "Seventh: ", name, " -> ", s
+
+
+if __name__ == '__main__':
+ unittest.main()

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages