[csw-devel] SF.net SVN: gar:[11314] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sat Oct 16 02:22:39 CEST 2010
Revision: 11314
http://gar.svn.sourceforge.net/gar/?rev=11314&view=rev
Author: wahwah
Date: 2010-10-16 00:22:38 +0000 (Sat, 16 Oct 2010)
Log Message:
-----------
submitpkg: Tags are reported, and tags can be compared.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py
csw/mgar/gar/v2/lib/python/tag.py
csw/mgar/gar/v2/lib/python/tag_test.py
Added Paths:
-----------
csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py
Property Changed:
----------------
csw/mgar/gar/v2/lib/python/tag_test.py
Modified: csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py
===================================================================
--- csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py 2010-10-16 00:21:41 UTC (rev 11313)
+++ csw/mgar/gar/v2/lib/python/submit_to_newpkgs.py 2010-10-16 00:22:38 UTC (rev 11314)
@@ -105,8 +105,27 @@
class FileSetChecker(object):
def CheckFiles(self, file_list):
- """Checks a set of files. Reports error tags."""
- pass
+ """Checks a set of files. Returns error tags."""
+ catalognames_by_arch = {
+ "i386": set(),
+ "sparc": set(),
+ }
+ for file_path in file_list:
+ pkg_path, basename = os.path.split(file_path)
+ parsed = opencsw.ParsePackageFileName(basename)
+ if parsed["arch"] == "all":
+ for arch in ("i386", "sparc"):
+ catalognames_by_arch[arch].add(parsed["catalogname"])
+ else:
+ catalognames_by_arch[parsed["arch"]].add(parsed["catalogname"])
+ i386 = catalognames_by_arch["i386"]
+ sparc = catalognames_by_arch["sparc"]
+ tags = []
+ for catalogname in i386.difference(sparc):
+ tags.append(tag.CheckpkgTag(None, "sparc-arch-missing", catalogname))
+ for catalogname in sparc.difference(i386):
+ tags.append(tag.CheckpkgTag(None, "i386-arch-missing", catalogname))
+ return tags
def main():
Added: csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py (rev 0)
+++ csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py 2010-10-16 00:22:38 UTC (rev 11314)
@@ -0,0 +1,26 @@
+#!/opt/csw/bin/python2.6
+
+import unittest
+import submit_to_newpkgs as stn
+import tag
+
+SAMPLE_FILES = [
+ # This file intentionally missing.
+ # '/home/experimental/maciej/libnspr4-4.8.6,REV=2010.10.16-SunOS5.9-i386-CSW.pkg.gz',
+ '/home/experimental/maciej/libnspr4-4.8.6,REV=2010.10.16-SunOS5.9-sparc-CSW.pkg.gz',
+ '/home/experimental/maciej/libnspr4_devel-4.8.6,REV=2010.10.16-SunOS5.9-i386-CSW.pkg.gz',
+ '/home/experimental/maciej/libnspr4_devel-4.8.6,REV=2010.10.16-SunOS5.9-sparc-CSW.pkg.gz',
+ '/home/experimental/maciej/nspr-4.8.6,REV=2010.10.16-SunOS5.9-all-CSW.pkg.gz',
+ '/home/experimental/maciej/nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-i386-CSW.pkg.gz',
+ '/home/experimental/maciej/nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-sparc-CSW.pkg.gz',
+]
+
+class FileSetCheckerUnitTest(unittest.TestCase):
+
+ def testNsprFiles(self):
+ fc = stn.FileSetChecker()
+ expected = [tag.CheckpkgTag(None, 'i386-arch-missing', 'libnspr4')]
+ self.assertEqual(expected, fc.CheckFiles(SAMPLE_FILES))
+
+if __name__ == '__main__':
+ unittest.main()
Property changes on: csw/mgar/gar/v2/lib/python/submit_to_newpkgs_test.py
___________________________________________________________________
Added: svn:executable
+ *
Modified: csw/mgar/gar/v2/lib/python/tag.py
===================================================================
--- csw/mgar/gar/v2/lib/python/tag.py 2010-10-16 00:21:41 UTC (rev 11313)
+++ csw/mgar/gar/v2/lib/python/tag.py 2010-10-16 00:22:38 UTC (rev 11314)
@@ -35,7 +35,20 @@
% (self.pkgname, self.tag_name, tag_postfix))
return "\n".join(msg_lines)
+ def __eq__(self, other):
+ value = (
+ self.pkgname == other.pkgname
+ and
+ self.tag_name == other.tag_name
+ and
+ self.tag_info == other.tag_info
+ and
+ self.severity == other.severity
+ and
+ self.msg == other.msg)
+ return value
+
def ParseTagLine(line):
"""Parses a line from the tag.${module} file.
Modified: csw/mgar/gar/v2/lib/python/tag_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/tag_test.py 2010-10-16 00:21:41 UTC (rev 11313)
+++ csw/mgar/gar/v2/lib/python/tag_test.py 2010-10-16 00:22:38 UTC (rev 11314)
@@ -1,3 +1,4 @@
+#!/opt/csw/bin/python2.6
# $Id$
# coding=utf-8
@@ -19,7 +20,12 @@
t = tag.CheckpkgTag("CSWfoo", "bar", "a b c")
self.assertEquals(u'CHECKPKG_OVERRIDES_CSWfoo += bar|a|b|c', t.ToGarSyntax())
+ def testComparison(self):
+ t1 = tag.CheckpkgTag("CSWfoo", "bar", "a b c")
+ t2 = tag.CheckpkgTag("CSWfoo", "bar", "a b c")
+ self.assertEquals(t1, t2)
+
class ParseTagLineUnitTest(unittest.TestCase):
def testParseTagLine1(self):
Property changes on: csw/mgar/gar/v2/lib/python/tag_test.py
___________________________________________________________________
Added: svn:executable
+ *
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