[csw-devel] SF.net SVN: gar:[13319] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue Feb 15 09:57:55 CET 2011
Revision: 13319
http://gar.svn.sourceforge.net/gar/?rev=13319&view=rev
Author: wahwah
Date: 2011-02-15 08:57:55 +0000 (Tue, 15 Feb 2011)
Log Message:
-----------
csw-upload-pkg: Upload bugfix
Fix a bug in logic, when uploading a new package. Trigger package upload not
only when the version is the same, but also if the package is not in the
catalog.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/csw_upload_pkg.py
csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py
Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg.py 2011-02-15 08:57:20 UTC (rev 13318)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg.py 2011-02-15 08:57:55 UTC (rev 13319)
@@ -155,11 +155,10 @@
catalogs = []
for arch in archs:
for osrel in osrels:
+ logging.debug("%s %s %s", catrel, arch, osrel)
srv4_in_catalog = self._rest_client.Srv4ByCatalogAndCatalogname(
catrel, arch, osrel, catalogname)
- if not srv4_in_catalog:
- continue
- if srv4_in_catalog["osrel"] == srv4_osrel:
+ if not srv4_in_catalog or srv4_in_catalog["osrel"] == srv4_osrel:
# The same architecture as our package, meaning that we can insert
# the same architecture into the catalog.
if (not self.os_release
Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py 2011-02-15 08:57:20 UTC (rev 13318)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py 2011-02-15 08:57:55 UTC (rev 13319)
@@ -104,6 +104,29 @@
)
self.assertEquals(expected, result)
+ def test_MatchSrv4ToCatalogsAbsentFromAll(self):
+ rest_client_mock = self.mox.CreateMock(rest.RestClient)
+ self.mox.StubOutWithMock(rest, "RestClient")
+ rest.RestClient().AndReturn(rest_client_mock)
+ rest_client_mock.Srv4ByCatalogAndCatalogname(
+ 'unstable', 'sparc', u'SunOS5.9', 'gdb').AndReturn(None)
+ rest_client_mock.Srv4ByCatalogAndCatalogname(
+ 'unstable', 'sparc', u'SunOS5.10', 'gdb').AndReturn(None)
+ rest_client_mock.Srv4ByCatalogAndCatalogname(
+ 'unstable', 'sparc', u'SunOS5.11', 'gdb').AndReturn(None)
+ self.mox.ReplayAll()
+ su = csw_upload_pkg.Srv4Uploader(None)
+ result = su._MatchSrv4ToCatalogs(
+ "gdb-7.2,REV=2011.01.21-SunOS5.9-sparc-CSW.pkg.gz",
+ "unstable", "sparc", "SunOS5.9",
+ "deadbeef61b53638d7813407fab4765b")
+ expected = (
+ ("unstable", "sparc", "SunOS5.9"),
+ ("unstable", "sparc", "SunOS5.10"),
+ ("unstable", "sparc", "SunOS5.11"),
+ )
+ self.assertEquals(expected, result)
+
def test_MatchSrv4ToCatalogsSameSpecificOsrelAlreadyPresent(self):
rest_client_mock = self.mox.CreateMock(rest.RestClient)
self.mox.StubOutWithMock(rest, "RestClient")
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