This patch is updated according to Peter Felecan's suggestions - it links to the standards page covering package naming.
----------------------------------------------------------------------- Adding a check that throws an error of catalogname doesn't match the pkgname. It is loosely based on the standards page[1], and more specific. [1] http://www.opencsw.org/extend-it/contribute-packages/build-standards/package-creation/ --- gar/v2/lib/python/README | 4 +++- gar/v2/lib/python/package_checks.py | 18 ++++++++++++++++++ gar/v2/lib/python/package_checks_test.py | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletions(-) diff --git a/gar/v2/lib/python/README b/gar/v2/lib/python/README index 8a16b45..36849a5 100644 --- a/gar/v2/lib/python/README +++ b/gar/v2/lib/python/README @@ -3,7 +3,6 @@ This directory contains Python libraries, mostly related to checkpkg. ==Checkpkg== Checks to implement: - - foo_bar != CSWfoo-bar -> error - *dev(el)? -> error, suggest *-dev - *-?rt -> error, suggest specific library packages - empty package without 'transitional' in the name --> error, suggest @@ -14,6 +13,9 @@ Checks to implement: - Dependency on CSWcas-initsmf + rc* files --> error - A package must not be incompatible with itself +Checks implemented: + - foo_bar != CSWfoo-bar -> error + - outside /opt/csw, /etc/opt/csw, /var/opt/csw -> error Development plan for checkpkg: - Notify maintainers when their package is available from mirrors diff --git a/gar/v2/lib/python/package_checks.py b/gar/v2/lib/python/package_checks.py index 38f86af..c375814 100644 --- a/gar/v2/lib/python/package_checks.py +++ b/gar/v2/lib/python/package_checks.py @@ -26,6 +26,7 @@ import textwrap import dependency_checks as depchecks import configuration as c import sharedlib_utils as su +import struct_util from Cheetah import Template import common_constants import logging @@ -1223,6 +1224,23 @@ def CheckPrefixDirs(pkg_data, error_mgr, logger, messenger): "file=%s" % pkgmap_entry["path"]) +def CheckCatalognameMatchesPkgname(pkg_data, error_mgr, logger, messenger): + pkgname = pkg_data["basic_stats"]["pkgname"] + catalogname = pkg_data["basic_stats"]["catalogname"] + std_catalogname = struct_util.MakeCatalognameByPkgname(pkgname) + if catalogname != std_catalogname: + msg = ( + "The catalogname should match the pkgname. " + "For more information, see " + "http://www.opencsw.org/extend-it/contribute-packages/" + "build-standards/package-creation/") + messenger.Message(msg) + error_mgr.ReportError( + 'catalogname-does-not-match-pkgname', + 'pkgname=%s catalogname=%s expected-catalogname=%s' + % (pkgname, catalogname, std_catalogname)) + + def CheckSonameMustNotBeEqualToFileNameIfFilenameEndsWithSo( pkg_data, error_mgr, logger, messenger): for binary_info in pkg_data["binaries_dump_info"]: diff --git a/gar/v2/lib/python/package_checks_test.py b/gar/v2/lib/python/package_checks_test.py index 0aa16b2..fac51a1 100755 --- a/gar/v2/lib/python/package_checks_test.py +++ b/gar/v2/lib/python/package_checks_test.py @@ -1678,5 +1678,26 @@ class TestCheckPrefixDirs(CheckpkgUnitTestHelper, self.RunCheckpkgTest(self.CheckpkgTest2) +class TestCheckCatalognameMatchesPkgname(CheckpkgUnitTestHelper, + unittest.TestCase): + FUNCTION_NAME = 'CheckCatalognameMatchesPkgname' + + def CheckpkgTest(self): + self.pkg_data = copy.deepcopy(tree_stats[0]) + basic_stats = self.pkg_data["basic_stats"] + basic_stats["catalogname"] = "foo_bar" + basic_stats["pkgname"] = "CSWfoo-bar-baz" + self.error_mgr_mock.ReportError( + 'catalogname-does-not-match-pkgname', + 'pkgname=CSWfoo-bar-baz catalogname=foo_bar ' + 'expected-catalogname=foo_bar_baz') + + def CheckpkgTest2(self): + self.pkg_data = copy.deepcopy(tree_stats[0]) + + def testTwo(self): + self.RunCheckpkgTest(self.CheckpkgTest2) + + if __name__ == '__main__': unittest.main() -- 1.7.3.2 _______________________________________________ maintainers mailing list [email protected] https://lists.opencsw.org/mailman/listinfo/maintainers .:: This mailing list's archive is public. ::.
