コード例 #1
0
 def getSoftware(self):
     """ Get the packagenames and so on
     """
     groupDict = {}
     versionDict = {}
     summaryDict = {}
     descrDict = {}
     #
     # try to iterate over the pool
     try: 
         #
         # iterate over the pool
         for item in self.pool:
             #
             # only packages, no sources/patches
             if zypp.isKindPackage(item):
                 #
                 # name of the package
                 name = item.name()
                 #
                 # group of the package
                 group = zypp.asKindPackage(item).group()
                 descr = zypp.asKindPackage(item).description()
                 summary = zypp.asKindPackage(item).summary()
                 version = zypp.asKindPackage(item).edition()
                 #
                 # fill in tempdict
                 groupDict[name] = group
                 summaryDict[name] = summary
                 descrDict[name] = descr
                 versionDict[name] = version
         #
         # only use first part of Group  e.g.: System/network/x -> System
         for i,j in groupDict.iteritems():
             x = {}
             x["Group"] = j.partition("/")[0]
             self.softwareDict[i] = x
         for i,j in summaryDict.iteritems():
             self.softwareDict[i]["Summary"]=str(j)
         for i,j in descrDict.iteritems():
             self.softwareDict[i]["Description"]=str(j)
         for i,j in versionDict.iteritems():
             self.softwareDict[i]["Version"]=str(j)
         #
         # push to configDict
         self.configDict["softwareDict"]=self.softwareDict
     #
     # manage exceptions
     except: # print the exception
             e = sys.exc_info()[1]
             msg = u"Error:\n ".encode("utf-8")+str(e).encode("utf-8")+"\n".encode("utf-8")
             #
             # error popup
             WARNING_URL_GUI = GUI_warning_popup.GUI_warning_popup(self.factory, self.repositoryDialog.this, msg)
             WARNING_URL_GUI.handleEvent()
             #
             # exit test
             return False
     return True
コード例 #2
0
 def _castKind(self, poolitem):
     item = None
     if zypp.isKindPattern(poolitem):
         item = zypp.asKindPattern(poolitem)
     elif zypp.isKindPackage(poolitem):
         item = zypp.asKindPackage(poolitem)
     elif zypp.isKindResolvable(poolitem):
         item = zypp.asKindResolvable(poolitem)
     return item
コード例 #3
0
 def testpath(self):
   import zypp
   Z = zypp.ZYppFactory.instance().getZYpp()
   assert Z
   Z.initializeTarget( zypp.Pathname("/") )
   Z.target().load()
   installed_pkgs = Z.pool()
   for item in installed_pkgs:
       if zypp.isKindPackage(item):
           print("Repopath %s" % item.repoInfo().packagesPath())
           item = zypp.asKindPackage(item)
           print("Location filename %s" % item.location().filename())
           print("%s.%s %s:%d" % (item.name(), item.arch(), item.edition(), item.installSize()))
コード例 #4
0
 def testpath(self):
   import zypp
   Z = zypp.ZYppFactory.instance().getZYpp()
   assert Z
   Z.initializeTarget( zypp.Pathname("/") )
   Z.target().load()
   installed_pkgs = Z.pool()
   for item in installed_pkgs:
       if zypp.isKindPackage(item):
           print "Repopath %s" % item.repoInfo().packagesPath()
           item = zypp.asKindPackage(item)
           print "Location filename %s" % item.location().filename()
           print "%s.%s %s:%d" % (item.name(), item.arch(), item.edition(), item.installSize())
コード例 #5
0
Z = zypp.ZYppFactory_instance().getZYpp()
Z.initializeTarget( zypp.Pathname("/") )
Z.target().load();

repoManager = zypp.RepoManager()
repos = repoManager.knownRepositories()

for repo in repos:
    if not repo.enabled():
        continue
    if not repoManager.isCached( repo ):
        repoManager.buildCache( repo )
    repoManager.loadFromCache( repo );

print "Items: %d" % ( Z.pool().size() )

for item in Z.pool():
    if item.status().isInstalled():
      t = "i"
    else:
      t = "*"

    print "%s %s:%s-%s.%s\t(%s)" % ( t,
                                     item.kind(),
                                     item.name(),
                                     item.edition(),
                                     item.arch(),
                                     item.repoInfo().alias() )
    if zypp.isKindPackage( item ):
      print " Group: %s" %(zypp.asKindPackage( item ).group( ) )