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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Mar 30 09:55:31 CEST 2011


Revision: 14015
          http://gar.svn.sourceforge.net/gar/?rev=14015&view=rev
Author:   wahwah
Date:     2011-03-30 07:55:31 +0000 (Wed, 30 Mar 2011)

Log Message:
-----------
submitpkg: Throw an error on UNCOMMITTED

Examine the file set to be submitted and verify that the vendor tag is
correct ("CSW").  If not, throw an error.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py
    csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py

Modified: csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py
===================================================================
--- csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py	2011-03-30 03:20:37 UTC (rev 14014)
+++ csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py	2011-03-30 07:55:31 UTC (rev 14015)
@@ -104,15 +104,31 @@
 
 class FileSetChecker(object):
 
+  def _CheckUncommitted(self, files_with_metadata):
+    tags = []
+    expected_vendor_tag = "CSW"
+    for filename, parsed_filename in files_with_metadata:
+      if parsed_filename["vendortag"] != expected_vendor_tag:
+        tags.append(tag.CheckpkgTag(
+          None,
+          "bad-vendor-tag",
+          "%s expected=%s actual=%s"
+          % (parsed_filename["catalogname"],
+             expected_vendor_tag,
+             parsed_filename["vendortag"])))
+    return tags
+
   def CheckFiles(self, file_list):
     """Checks a set of files. Returns error tags."""
     catalognames_by_arch = {
         "i386": set(),
         "sparc": set(),
     }
+    files_with_metadata = []
     for file_path in file_list:
       pkg_path, basename = os.path.split(file_path)
       parsed = opencsw.ParsePackageFileName(basename)
+      files_with_metadata.append((basename, parsed))
       if parsed["arch"] == "all":
         for arch in ("i386", "sparc"):
           catalognames_by_arch[arch].add(parsed["catalogname"])
@@ -125,6 +141,7 @@
       tags.append(tag.CheckpkgTag(None, "sparc-arch-missing", catalogname))
     for catalogname in sparc.difference(i386):
       tags.append(tag.CheckpkgTag(None, "i386-arch-missing", catalogname))
+    tags.extend(self._CheckUncommitted(files_with_metadata))
     return tags
 
 

Modified: csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py	2011-03-30 03:20:37 UTC (rev 14014)
+++ csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py	2011-03-30 07:55:31 UTC (rev 14015)
@@ -22,5 +22,18 @@
     expected = [tag.CheckpkgTag(None, 'i386-arch-missing', 'libnspr4')]
     self.assertEqual(expected, fc.CheckFiles(SAMPLE_FILES))
 
+  def testUncommitted(self):
+    fc = stn.FileSetChecker()
+    expected = [
+        tag.CheckpkgTag(None, 'bad-vendor-tag', 'nspr_devel expected=CSW actual=UNCOMMITTED'),
+        tag.CheckpkgTag(None, 'bad-vendor-tag', 'nspr_devel expected=CSW actual=UNCOMMITTED'),
+    ]
+    files = ['/home/experimental/maciej/'
+             'nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-sparc-UNCOMMITTED.pkg.gz',
+             '/home/experimental/maciej/'
+             'nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-i386-UNCOMMITTED.pkg.gz']
+    self.assertEqual(expected, fc.CheckFiles(files))
+
+
 if __name__ == '__main__':
 	unittest.main()


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