SF.net SVN: gar:[23911] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Aug 3 07:18:15 CEST 2014


Revision: 23911
          http://sourceforge.net/p/gar/code/23911
Author:   wahwah
Date:     2014-08-03 05:18:15 +0000 (Sun, 03 Aug 2014)
Log Message:
-----------
checkpkg: New packages should not depend on stubs

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg_lib.py
    csw/mgar/gar/v2/lib/python/package_checks.py
    csw/mgar/gar/v2/lib/python/package_checks_test.py
    csw/mgar/gar/v2/lib/python/rest.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2014-08-03 05:18:05 UTC (rev 23910)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2014-08-03 05:18:15 UTC (rev 23911)
@@ -445,6 +445,10 @@
       self.pkgs_by_path_cache[key] = pkgs
     return self.pkgs_by_path_cache[key]
 
+  def GetPkgByPkgname(self, pkgname):
+    return self.rest_client.Srv4ByCatalogAndPkgname(
+        self.catrel, self.arch, self.osrel, pkgname)
+
   def GetInstalledPackages(self):
     return self.catalog.GetInstalledPackages(
         self.osrel, self.arch, self.catrel)

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2014-08-03 05:18:05 UTC (rev 23910)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2014-08-03 05:18:15 UTC (rev 23911)
@@ -1320,3 +1320,40 @@
     "in the usual locations. "
     "Locations checked for 64-bit binaries: %s."
     % (binaries[0], paths_64_str))
+
+def CheckShouldNotDependOnStub(pkg_data, error_mgr, logger, messenger):
+  """Newly built packages should not declare stubs as dependencies.
+
+  Example data structure:
+  {
+      "arch": "sparc",
+      "basename": "bash-4.3.0,REV=2014.03.15-SunOS5.10-sparc-CSW.pkg.gz",
+      "catalogname": "bash",
+      "file_basename": "bash-4.3.0,REV=2014.03.15-SunOS5.10-sparc-CSW.pkg.gz",
+      "filename_arch": "sparc",
+      "maintainer_email": "yann at opencsw.org",
+      "maintainer_full_name": "Yann Rouillard",
+      "maintainer_id": 50,
+      "md5_sum": "5556f5bb4317267f5b3b4c51a9a13d25",
+      "mtime": "2014-03-15T21:05:47",
+      "osrel": "SunOS5.10",
+      "pkgname": "CSWbash",
+      "repository_url": "https://chninkel/Makefile",
+      "rev": "2014.03.15",
+      "size": 2323045,
+      "vendor_url": "http://tiswww.case.edu/php/chet/bash/bashtop.html",
+      "version": "4.3.0,REV=2014.03.15",
+      "version_string": "4.3.0,REV=2014.03.15"
+  }
+  """
+  for dep_pkgname, _ in pkg_data['depends']:
+    # This package better not be a stub.
+    # But how do we know it's a stub? We test for the presence of...
+    dep_data = error_mgr.GetPkgByPkgname(dep_pkgname)
+    if dep_data['catalogname'].endswith('_stub'):
+      error_mgr.ReportError(
+          'dependency-on-stub',
+          dep_data['catalogname'],
+          'Please not declare dependencies on stubs in newly built packages. '
+          'There is another dependency which you should use. '
+          'You need to find it in e.g. http://www.opencsw.org/packages/')

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2014-08-03 05:18:05 UTC (rev 23910)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2014-08-03 05:18:15 UTC (rev 23911)
@@ -15,8 +15,6 @@
 import os.path
 import pprint
 
-from lib.python.testdata.djvulibre_rt_stats import pkgstats as djvulibre_rt_stats
-
 from lib.python import checkpkg_lib
 from lib.python import fake_pkgstats_composer
 from lib.python import package_checks as pc
@@ -26,10 +24,7 @@
 from lib.python.testdata import stubs
 
 from lib.python.testdata.berkeleydb48_stats import pkgstats as bdb48_stats
-# from lib.python.testdata.cadaver_stats import pkgstats as cadaver_stats
-# from lib.python.testdata.ivtools_stats import pkgstats as ivtools_stats
-# from lib.python.testdata.javasvn_stats import pkgstats as javasvn_stats
-# from lib.python.testdata.mercurial_stats import pkgstats as mercurial_stats
+from lib.python.testdata.djvulibre_rt_stats import pkgstats as djvulibre_rt_stats
 from lib.python.testdata.neon_stats import pkgstats as neon_stats
 from lib.python.testdata.rsync_stats import pkgstats as rsync_stats
 from lib.python.testdata.sudo_stats import pkgstats as sudo_stats

Modified: csw/mgar/gar/v2/lib/python/rest.py
===================================================================
--- csw/mgar/gar/v2/lib/python/rest.py	2014-08-03 05:18:05 UTC (rev 23910)
+++ csw/mgar/gar/v2/lib/python/rest.py	2014-08-03 05:18:15 UTC (rev 23911)
@@ -70,7 +70,9 @@
     self.ValidateMd5(md5_sum)
     return self.GetBlob('pkgstats', md5_sum)
 
-  @retry_decorator.Retry(tries=DEFAULT_TRIES, exceptions=(RestCommunicationError, httplib.BadStatusLine))
+  @retry_decorator.Retry(tries=DEFAULT_TRIES,
+                         exceptions=(RestCommunicationError,
+                                     httplib.BadStatusLine))
   def GetCatalogData(self, md5_sum):
     self.ValidateMd5(md5_sum)
     url = self.pkgdb_url + "/srv4/%s/catalog-data/" % md5_sum

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