[csw-devel] SF.net SVN: gar:[20804] csw/mgar/gar/v2/lib

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Apr 18 17:19:05 CEST 2013


Revision: 20804
          http://gar.svn.sourceforge.net/gar/?rev=20804&view=rev
Author:   wahwah
Date:     2013-04-18 15:19:05 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
pkgdb: Move GetSqoTriad to the models module

It's used from there anyway, and pkgdb is not a good module to import.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/models.py
    csw/mgar/gar/v2/lib/python/pkgdb.py
    csw/mgar/gar/v2/lib/web/releases_web.py

Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py	2013-04-18 15:18:51 UTC (rev 20803)
+++ csw/mgar/gar/v2/lib/python/models.py	2013-04-18 15:19:05 UTC (rev 20804)
@@ -476,3 +476,9 @@
       join=join,
   ).orderBy('catalogname')
   return res
+
+def GetSqoTriad(osrel, arch, catrel):
+  sqo_osrel = OsRelease.selectBy(short_name=osrel).getOne()
+  sqo_arch = Architecture.selectBy(name=arch).getOne()
+  sqo_catrel = CatalogRelease.selectBy(name=catrel).getOne()
+  return sqo_osrel, sqo_arch, sqo_catrel

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2013-04-18 15:18:51 UTC (rev 20803)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2013-04-18 15:19:05 UTC (rev 20804)
@@ -366,13 +366,6 @@
     return os.path.join(base_dir, arch, short_osrel, "catalog")
 
 
-def GetSqoTriad(osrel, arch, catrel):
-  sqo_osrel = m.OsRelease.selectBy(short_name=osrel).getOne()
-  sqo_arch = m.Architecture.selectBy(name=arch).getOne()
-  sqo_catrel = m.CatalogRelease.selectBy(name=catrel).getOne()
-  return sqo_osrel, sqo_arch, sqo_catrel
-
-
 def main():
   parser = optparse.OptionParser(USAGE)
   parser.add_option("-d", "--debug", dest="debug",
@@ -595,7 +588,7 @@
     catrel, base_dir = args
     ci.SyncFromCatalogTree(catrel, base_dir, options.force_unpack)
   elif (command, subcommand) == ('show', 'cat'):
-    sqo_osrel, sqo_arch, sqo_catrel = GetSqoTriad(
+    sqo_osrel, sqo_arch, sqo_catrel = m.GetSqoTriad(
         options.osrel, options.arch, options.catrel)
     res = m.GetCatPackagesResult(sqo_osrel, sqo_arch, sqo_catrel)
     for obj in res:
@@ -630,7 +623,7 @@
     # TODO: Move this definition to a better place
     for osrel in ("SunOS5.%s" % x for x in (8, 9, 10, 11)):
       for arch in archs:
-        sqo_osrel, sqo_arch, sqo_catrel = GetSqoTriad(
+        sqo_osrel, sqo_arch, sqo_catrel = m.GetSqoTriad(
             osrel, arch, catrel)
         pkgs = list(m.GetCatPackagesResult(sqo_osrel, sqo_arch, sqo_catrel))
         logging.debug("The catalog contains %s packages" % len(pkgs))

Modified: csw/mgar/gar/v2/lib/web/releases_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/releases_web.py	2013-04-18 15:18:51 UTC (rev 20803)
+++ csw/mgar/gar/v2/lib/web/releases_web.py	2013-04-18 15:19:05 UTC (rev 20804)
@@ -125,7 +125,7 @@
   def GET(self, catrel_name, arch_name, osrel_name):
     """See if that package is in that catalog."""
     configuration.SetUpSqlobjectConnection()
-    sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
+    sqo_osrel, sqo_arch, sqo_catrel = models.GetSqoTriad(
         osrel_name, arch_name, catrel_name)
     srv4 = models.Srv4FileStats.selectBy(md5_sum=md5_sum).getOne()
     logging.debug("Srv4CatalogAssignment::GET srv4: %s", srv4.basename)
@@ -172,7 +172,7 @@
         package_stats.PackageStats.ImportPkg(stats, True)
         srv4 = models.Srv4FileStats.selectBy(md5_sum=md5_sum).getOne()
       c = checkpkg_lib.Catalog()
-      sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
+      sqo_osrel, sqo_arch, sqo_catrel = models.GetSqoTriad(
           osrel_name, arch_name, catrel_name)
       # See if there already is a package with that catalogname.
       res = c.GetConflictingSrv4ByCatalognameResult(

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list