[csw-devel] SF.net SVN: gar:[14796] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Jun 12 22:39:31 CEST 2011
Revision: 14796
http://gar.svn.sourceforge.net/gar/?rev=14796&view=rev
Author: wahwah
Date: 2011-06-12 20:39:30 +0000 (Sun, 12 Jun 2011)
Log Message:
-----------
file-set-checker: Warn on bad filenames
Check that package file names end with .pkg or .pkg.gz.
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-06-12 20:38:20 UTC (rev 14795)
+++ csw/mgar/gar/v2/lib/python/file_set_checker.py 2011-06-12 20:39:30 UTC (rev 14796)
@@ -29,6 +29,16 @@
parsed_filename["vendortag"])))
return tags
+ def _CheckFilenames(self, files_with_metadata):
+ tags = []
+ for filename, parsed_filename in files_with_metadata:
+ if not filename.endswith(".pkg.gz") or not filename.endswith(".pkg"):
+ tags.append(tag.CheckpkgTag(
+ None,
+ "bad-filename",
+ "filename=%s" % filename))
+ return tags
+
def _CheckMissingArchs(self, files_with_metadata):
tags = []
catalognames_by_arch = {}
@@ -96,6 +106,7 @@
tags = []
tags.extend(self._CheckMissingArchs(files_with_metadata))
tags.extend(self._CheckUncommitted(files_with_metadata))
+ tags.extend(self._CheckFilenames(files_with_metadata))
return tags
Modified: csw/mgar/gar/v2/lib/python/file_set_checker_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/file_set_checker_test.py 2011-06-12 20:38:20 UTC (rev 14795)
+++ csw/mgar/gar/v2/lib/python/file_set_checker_test.py 2011-06-12 20:39:30 UTC (rev 14796)
@@ -73,6 +73,15 @@
self.assertEqual(expected, fc._CheckUncommitted(files_with_metadata))
self.assertEqual(expected_2, fc._CheckMissingArchs(files_with_metadata))
+ def testFilenames(self):
+ fc = file_set_checker.FileSetChecker()
+ expected = [
+ tag.CheckpkgTag(None, 'bad-filename', 'filename=csw-upload-pkg'),
+ ]
+ files = ['csw-upload-pkg']
+ files_with_metadata = fc._FilesWithMetadata(files)
+ self.assertEqual(expected, fc._CheckFilenames(files_with_metadata))
+
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