annotate bin/listcachedb.py @ 567:9d44d4da3411

commands from config files may contain arguments therefore commandparse must split also kw args
author Bjoern Ricks <bricks@intevation.de>
date Fri, 02 Sep 2011 11:04:07 +0000
parents b0179962ce26
children
rev   line source
425
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
2 # Copyright (C) 2010 by Intevation GmbH
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
3 # Authors:
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
4 # Bjoern Ricks <bjoern.ricks@intevation.de>
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
5 #
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
8
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
9 from optparse import OptionParser
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
10
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
11 import treepkgcmd
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
12 from treepkg.info.data import CacheDb
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
13
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
14 def main():
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
15 parser = OptionParser()
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
16 parser.add_option("--db", help=("path to the CacheDb"))
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
17 options, args = parser.parse_args()
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
18
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
19 cachedb = CacheDb(options.db)
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
20 packages = cachedb.get_packages()
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
21 for package in packages:
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
22 print "============================="
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
23 print "name: %s" % package.name
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
24 print "============================="
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
25 print "binary: %s" % package.filename
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
26 print "source: %s" % package.sourcepath
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
27 print "arch: %s" % package.arch
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
28 print "md5sum: %s" % package.md5sum
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
29
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
30 if __name__ == "__main__":
b0179962ce26 add helper tool to list content of a cache db
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
31 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)