[csw-devel] SF.net SVN: gar:[15949] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Fri Oct 21 10:08:51 CEST 2011
Revision: 15949
http://gar.svn.sourceforge.net/gar/?rev=15949&view=rev
Author: wahwah
Date: 2011-10-21 08:08:51 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
checkpkg: Raising the architecture for SunOS5.10
>From October 2011, it's okay, in Solaris 10, for pentium_pro and
sparcv8+ binaries to be in the /opt/csw/bin and /opt/csw/lib
directories.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/checkpkg.py
csw/mgar/gar/v2/lib/python/common_constants.py
csw/mgar/gar/v2/lib/python/package_checks.py
csw/mgar/gar/v2/lib/python/package_checks_test.py
csw/mgar/gar/v2/lib/python/sharedlib_utils.py
Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py 2011-10-21 08:08:15 UTC (rev 15948)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py 2011-10-21 08:08:51 UTC (rev 15949)
@@ -51,6 +51,10 @@
pass
+class InternalDataError(Error):
+ """Problem with internal checkpkg data structures."""
+
+
def ExtractDescription(pkginfo):
desc_re = re.compile(DESCRIPTION_RE)
m = re.match(desc_re, pkginfo["NAME"])
Modified: csw/mgar/gar/v2/lib/python/common_constants.py
===================================================================
--- csw/mgar/gar/v2/lib/python/common_constants.py 2011-10-21 08:08:15 UTC (rev 15948)
+++ csw/mgar/gar/v2/lib/python/common_constants.py 2011-10-21 08:08:51 UTC (rev 15949)
@@ -3,11 +3,15 @@
ARCH_ALL = "all"
PHYSICAL_ARCHITECTURES = [ARCH_SPARC, ARCH_i386]
ARCHITECTURES = PHYSICAL_ARCHITECTURES + [ARCH_ALL]
+OS_REL_58 = u"SunOS5.8"
+OS_REL_59 = u"SunOS5.9"
+OS_REL_510 = u"SunOS5.10"
+OS_REL_511 = u"SunOS5.11"
OS_RELS = (
- u"SunOS5.8",
- u"SunOS5.9",
- u"SunOS5.10",
- u"SunOS5.11",
+ OS_REL_58,
+ OS_REL_59,
+ OS_REL_510,
+ OS_REL_511,
)
OBSOLETE_OS_RELS = (
u"SunOS5.8",
Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py 2011-10-21 08:08:15 UTC (rev 15948)
+++ csw/mgar/gar/v2/lib/python/package_checks.py 2011-10-21 08:08:51 UTC (rev 15949)
@@ -119,41 +119,84 @@
# Valid URLs in the VENDOR field in pkginfo
VENDORURL_RE = r"^(http|ftp)s?\://.+\..+$"
+# Settings for binary placements: which architectures can live in which
+# directories.
BASE_BINARY_PATHS = ('bin', 'sbin', 'lib', 'libexec', 'cgi-bin')
HACHOIR_MACHINES = {
# id: (name, allowed_paths, disallowed_paths)
-1: {"name": "Unknown",
- "allowed": (), "disallowed": (),
+ "allowed": {
+ common_constants.OS_REL_58: (),
+ common_constants.OS_REL_59: (),
+ common_constants.OS_REL_510: (),
+ common_constants.OS_REL_511: (),
+ }, "disallowed": (),
"type": "unknown"},
2: {"name": "sparcv8",
"type": common_constants.ARCH_SPARC,
- "allowed": BASE_BINARY_PATHS + su.SPARCV8_PATHS,
+ "allowed": {
+ common_constants.OS_REL_58: BASE_BINARY_PATHS + su.SPARCV8_PATHS,
+ common_constants.OS_REL_59: BASE_BINARY_PATHS + su.SPARCV8_PATHS,
+ common_constants.OS_REL_510: BASE_BINARY_PATHS + su.SPARCV8_PATHS,
+ common_constants.OS_REL_511: BASE_BINARY_PATHS + su.SPARCV8_PATHS,
+ },
"disallowed": su.SPARCV9_PATHS + su.INTEL_386_PATHS + su.AMD64_PATHS,
},
+ # pentium_pro binaries are also identified as 3.
3: {"name": "i386",
"type": common_constants.ARCH_i386,
- "allowed": BASE_BINARY_PATHS + su.INTEL_386_PATHS,
- "disallowed": su.SPARCV8_PATHS + su.SPARCV8PLUS_PATHS + su.SPARCV9_PATHS + su.AMD64_PATHS,
+ "allowed": {
+ common_constants.OS_REL_58: BASE_BINARY_PATHS + su.INTEL_386_PATHS,
+ common_constants.OS_REL_59: BASE_BINARY_PATHS + su.INTEL_386_PATHS,
+ common_constants.OS_REL_510: BASE_BINARY_PATHS + su.INTEL_386_PATHS,
+ common_constants.OS_REL_511: BASE_BINARY_PATHS + su.INTEL_386_PATHS,
+ },
+ "disallowed": su.SPARCV8_PATHS + su.SPARCV8PLUS_PATHS +
+ su.SPARCV9_PATHS + su.AMD64_PATHS,
},
6: {"name": "i486",
"type": common_constants.ARCH_i386,
- "allowed": su.INTEL_386_PATHS,
- "disallowed": su.SPARCV8_PATHS + su.SPARCV8PLUS_PATHS + su.SPARCV9_PATHS + su.AMD64_PATHS,
+ "allowed": {
+ common_constants.OS_REL_58: su.INTEL_386_PATHS,
+ common_constants.OS_REL_59: su.INTEL_386_PATHS,
+ common_constants.OS_REL_510: su.INTEL_386_PATHS,
+ common_constants.OS_REL_511: su.INTEL_386_PATHS,
},
+ "disallowed": su.SPARCV8_PATHS + su.SPARCV8PLUS_PATHS +
+ su.SPARCV9_PATHS + su.AMD64_PATHS,
+ },
18: {"name": "sparcv8+",
"type": common_constants.ARCH_SPARC,
- "allowed": su.SPARCV8PLUS_PATHS,
- "disallowed": su.SPARCV8_PATHS + su.SPARCV9_PATHS + su.AMD64_PATHS + su.INTEL_386_PATHS,
+ "allowed": {
+ common_constants.OS_REL_58: su.SPARCV8PLUS_PATHS,
+ common_constants.OS_REL_59: su.SPARCV8PLUS_PATHS,
+ # We allow sparcv8+ as the base architecture on Solaris 10+.
+ common_constants.OS_REL_510: BASE_BINARY_PATHS + su.SPARCV8PLUS_PATHS,
+ common_constants.OS_REL_511: BASE_BINARY_PATHS + su.SPARCV8PLUS_PATHS,
+ },
+ "disallowed": su.SPARCV8_PATHS + su.SPARCV9_PATHS +
+ su.AMD64_PATHS + su.INTEL_386_PATHS,
},
43: {"name": "sparcv9",
"type": common_constants.ARCH_SPARC,
- "allowed": su.SPARCV9_PATHS,
+ "allowed": {
+ common_constants.OS_REL_58: su.SPARCV9_PATHS,
+ common_constants.OS_REL_59: su.SPARCV9_PATHS,
+ common_constants.OS_REL_510: su.SPARCV9_PATHS,
+ common_constants.OS_REL_511: su.SPARCV9_PATHS,
+ },
"disallowed": su.INTEL_386_PATHS + su.AMD64_PATHS,
},
62: {"name": "amd64",
"type": common_constants.ARCH_i386,
- "allowed": su.AMD64_PATHS,
- "disallowed": su.SPARCV8_PATHS + su.SPARCV8PLUS_PATHS + su.SPARCV9_PATHS,
+ "allowed": {
+ common_constants.OS_REL_58: su.AMD64_PATHS,
+ common_constants.OS_REL_59: su.AMD64_PATHS,
+ common_constants.OS_REL_510: su.AMD64_PATHS,
+ common_constants.OS_REL_511: su.AMD64_PATHS,
+ },
+ "disallowed": su.SPARCV8_PATHS + su.SPARCV8PLUS_PATHS +
+ su.SPARCV9_PATHS,
},
}
@@ -910,7 +953,13 @@
logger.debug("CheckArchitecture(): %s", metadata)
machine_data = HACHOIR_MACHINES[metadata["machine_id"]]
cpu_type = machine_data["name"]
- allowed_paths = set(machine_data["allowed"])
+ # allowed_paths needs to depend on the OS release. The OS release is
+ # only available from the file name.
+ os_release = pkg_data["basic_stats"]["parsed_basename"]["osrel"]
+ if os_release not in machine_data["allowed"]:
+ raise checkpkg.InternalDataError(
+ "%s not found in machine_data" % os_release)
+ allowed_paths = set(machine_data["allowed"][os_release])
disallowed_paths = set(machine_data["disallowed"])
path_parts = set(metadata["path"].split(os.path.sep))
if not path_parts.intersection(allowed_paths):
Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py 2011-10-21 08:08:15 UTC (rev 15948)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py 2011-10-21 08:08:51 UTC (rev 15949)
@@ -264,7 +264,7 @@
mox.IsA(str), mox.IsA(str), mox.IsA(str))
-class TestCheckArchitecture(CheckTestHelper, unittest.TestCase):
+class TestCheckArchitectureSanity(CheckTestHelper, unittest.TestCase):
FUNCTION_NAME = 'CheckArchitectureSanity'
def testSimple(self):
self.pkg_data["pkginfo"]["ARCH"] = "i386"
@@ -272,7 +272,7 @@
'srv4-filename-architecture-mismatch',
'pkginfo=i386 filename=rsync-3.0.7,REV=2010.02.17-SunOS5.8-sparc-CSW.pkg.gz')
-class TestCheckArchitecture(CheckTestHelper, unittest.TestCase):
+class TestCheckArchitectureVsContents(CheckTestHelper, unittest.TestCase):
FUNCTION_NAME = 'CheckArchitectureVsContents'
def testArchallDevel(self):
@@ -901,6 +901,24 @@
'path': 'opt/csw/bin/sparcv8plus/tree'},
]
+ def testGoodSparcv8PlusInBin(self):
+ # From October 2011 on, the sparcv8+ binaries can be in bin on
+ # Solaris 10.
+ parsed_basename = self.pkg_data["basic_stats"]["parsed_basename"]
+ parsed_basename["osrel"] = "SunOS5.10"
+ self.pkg_data["files_metadata"] = [
+ {'endian': 'Big endian',
+ 'machine_id': 18,
+ 'mime_type': 'application/x-executable; charset=binary',
+ 'mime_type_by_hachoir': u'application/x-executable',
+ 'path': 'opt/csw/bin/tree'},
+ ]
+ # No error here.
+
+ # A similar test can't be written for i386, because pentium_pro and
+ # i386 have the same machine_id, so we can't distinguish between the
+ # two.
+
def testGoodBinary(self):
self.pkg_data["files_metadata"] = [
{'endian': 'Big endian',
Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils.py 2011-10-21 08:08:15 UTC (rev 15948)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils.py 2011-10-21 08:08:51 UTC (rev 15949)
@@ -7,13 +7,28 @@
# TODO: Merge with common_constants
-SPARCV8_PATHS = ('sparcv8', 'sparcv8-fsmuld',
- 'sparcv7', 'sparc')
-SPARCV8PLUS_PATHS = ('sparcv8plus+vis2', 'sparcv8plus+vis', 'sparcv8plus')
-SPARCV9_PATHS = ('sparcv9+vis2', 'sparcv9+vis', 'sparcv9')
-INTEL_386_PATHS = ('pentium_pro+mmx', 'pentium_pro',
- 'pentium+mmx', 'pentium',
- 'i486', 'i386', 'i86')
+SPARCV8_PATHS = (
+ 'sparcv8',
+ 'sparcv8-fsmuld',
+ 'sparcv7',
+ 'sparc')
+SPARCV8PLUS_PATHS = (
+ 'sparcv8plus+vis2',
+ 'sparcv8plus+vis',
+ 'sparcv8plus')
+SPARCV9_PATHS = (
+ 'sparcv9+vis2',
+ 'sparcv9+vis',
+ 'sparcv9')
+INTEL_386_PATHS = (
+ 'i486',
+ 'i386',
+ 'i86')
+INTEL_PENTIUM_PATHS = (
+ 'pentium_pro+mmx',
+ 'pentium_pro',
+ 'pentium+mmx',
+ 'pentium')
AMD64_PATHS = ('amd64',)
LEGIT_CHAR_RE = re.compile(r"[a-zA-Z0-9\+]+")
SONAME_VERSION_RE = re.compile("^(?P<name>.*)\.so\.(?P<version>[\d\.]+)$")
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