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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Apr 11 11:14:56 CEST 2011


Revision: 14124
          http://gar.svn.sourceforge.net/gar/?rev=14124&view=rev
Author:   wahwah
Date:     2011-04-11 09:14:55 +0000 (Mon, 11 Apr 2011)

Log Message:
-----------
csw-upload-pkg: Deal with badly formed filenames

If a file name given is not parseable, don't fret, return an error tag
instead.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/file_set_checker.py
    csw/mgar/gar/v2/lib/python/file_set_checker_test.py

Modified: csw/mgar/gar/v2/lib/python/file_set_checker.py
===================================================================
--- csw/mgar/gar/v2/lib/python/file_set_checker.py	2011-04-11 09:14:07 UTC (rev 14123)
+++ csw/mgar/gar/v2/lib/python/file_set_checker.py	2011-04-11 09:14:55 UTC (rev 14124)
@@ -52,7 +52,14 @@
       osrel = file_metadata["osrel"]
       for arch in archs:
         key = arch, osrel
-        catalognames_by_arch[key].add(catalogname)
+        if key in catalognames_by_arch:
+          catalognames_by_arch[key].add(catalogname)
+        else:
+          tags.append(
+              tag.CheckpkgTag(None,
+                              "bad-arch-or-os-release",
+                              "%s arch=%s osrel=%s" % (file_path, arch, osrel))
+          )
     missing = {}
     for key1, set1 in catalognames_by_arch.iteritems():
       for catalogname in set1:

Modified: csw/mgar/gar/v2/lib/python/file_set_checker_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/file_set_checker_test.py	2011-04-11 09:14:07 UTC (rev 14123)
+++ csw/mgar/gar/v2/lib/python/file_set_checker_test.py	2011-04-11 09:14:55 UTC (rev 14124)
@@ -53,6 +53,15 @@
              'nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-i386-UNCOMMITTED.pkg.gz']
     self.assertEqual(expected, fc.CheckFiles(files))
 
+  def testBadInput(self):
+    fc = file_set_checker.FileSetChecker()
+    expected = [
+        tag.CheckpkgTag(None, 'bad-arch-or-os-release', 'csw-upload-pkg arch=pkg osrel=unspecified'),
+        tag.CheckpkgTag(None, 'bad-vendor-tag', 'csw expected=CSW actual=UNKN'),
+    ]
+    files = ['csw-upload-pkg']
+    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