Example #1
0
 def setUp(self):
     super(Srv4FileStatsUnitTest, self).setUp()
     self.dbc.InitialDataImport()
     self.sqo_arch = models.Architecture.selectBy(id=1).getOne()
     self.sqo_osrel = models.OsRelease.selectBy(id=1).getOne()
     self.sqo_catrel = models.CatalogRelease.selectBy(id=1).getOne()
     self.pkginst = models.Pkginst(pkgname="CSWfoo")
     self.maintainer = models.Maintainer(email='*****@*****.**',
                                         full_name='Joe Bloggs')
     self.p = models.Srv4FileStats(
         arch=self.sqo_arch,
         basename="foo.pkg",
         catalogname="foo",
         data_obj=None,
         filename_arch=self.sqo_arch,
         latest=True,
         maintainer=self.maintainer,
         md5_sum="not a real one",
         size=1L,
         mtime=datetime.datetime.now(),
         os_rel=self.sqo_osrel,
         pkginst=self.pkginst,
         registered=True,
         use_to_generate_catalogs=True,
         rev="2011.01.01",
         stats_version=0,
         version_string="1.0,REV=2011.01.01",
     )
Example #2
0
 def _ImportPackages(self, data):
     logging.debug("_ImportPackages()")
     for pkgname, pkg_desc in data["pkginfo"].iteritems():
         sqo_pkg = None
         try:
             sqo_pkg = m.Pkginst.select(
                 m.Pkginst.q.pkgname == pkgname).getOne()
         except sqlobject.main.SQLObjectNotFound, e:
             sqo_pkg = m.Pkginst(pkgname=pkgname, pkg_desc=pkg_desc)
         self.pkginst_cache[pkgname] = sqo_pkg
Example #3
0
 def GetOrSetPkginst(cls, pkgname):
     try:
         pkginst = m.Pkginst.select(m.Pkginst.q.pkgname == pkgname).getOne()
     except sqlobject.main.SQLObjectNotFound, e:
         logging.debug(e)
         pkginst = m.Pkginst(pkgname=pkgname)