[csw-devel] SF.net SVN: gar:[18237] csw/mgar/gar/v2

chninkel at users.sourceforge.net chninkel at users.sourceforge.net
Wed Jun 6 23:09:26 CEST 2012


Revision: 18237
          http://gar.svn.sourceforge.net/gar/?rev=18237&view=rev
Author:   chninkel
Date:     2012-06-06 21:09:26 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
v2: merged v2-solaris11 branch to have a working pkgdb under SunOS 5.11

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/common_constants.py
    csw/mgar/gar/v2/lib/python/system_pkgmap.py
    csw/mgar/gar/v2/lib/python/system_pkgmap_test.py

Property Changed:
----------------
    csw/mgar/gar/v2/


Property changes on: csw/mgar/gar/v2
___________________________________________________________________
Modified: svn:mergeinfo
   - /csw/mgar/gar/v2:4936-6678
/csw/mgar/gar/v2-bwalton:9784-10011
/csw/mgar/gar/v2-checkpkg:7722-7855
/csw/mgar/gar/v2-checkpkg-override-relocation:10585-10737
/csw/mgar/gar/v2-checkpkg-stats:8454-8649
/csw/mgar/gar/v2-collapsed-modulations:6895
/csw/mgar/gar/v2-defaultchange:13903-14022
/csw/mgar/gar/v2-dirpackage:8125-8180
/csw/mgar/gar/v2-fortran:10883-12516
/csw/mgar/gar/v2-git/v2-relocate:7617
/csw/mgar/gar/v2-migrateconf:7082-7211
/csw/mgar/gar/v2-noexternals:11592-11745
/csw/mgar/gar/v2-raised-buildlevel:15906-15949
/csw/mgar/gar/v2-relocate:5028-11738
/csw/mgar/gar/v2-skayser:6087-6132
/csw/mgar/gar/v2-sqlite:10434-10449
/csw/mgar/gar/v2-uwatch2:12141-13270
   + /csw/mgar/gar/v2:4936-6678
/csw/mgar/gar/v2-bwalton:9784-10011
/csw/mgar/gar/v2-checkpkg:7722-7855
/csw/mgar/gar/v2-checkpkg-override-relocation:10585-10737
/csw/mgar/gar/v2-checkpkg-stats:8454-8649
/csw/mgar/gar/v2-collapsed-modulations:6895
/csw/mgar/gar/v2-defaultchange:13903-14022
/csw/mgar/gar/v2-dirpackage:8125-8180
/csw/mgar/gar/v2-fortran:10883-12516
/csw/mgar/gar/v2-git/v2-relocate:7617
/csw/mgar/gar/v2-migrateconf:7082-7211
/csw/mgar/gar/v2-noexternals:11592-11745
/csw/mgar/gar/v2-raised-buildlevel:15906-15949
/csw/mgar/gar/v2-relocate:5028-11738
/csw/mgar/gar/v2-skayser:6087-6132
/csw/mgar/gar/v2-solaris11:18134-18236
/csw/mgar/gar/v2-sqlite:10434-10449
/csw/mgar/gar/v2-uwatch2:12141-13270

Modified: csw/mgar/gar/v2/lib/python/common_constants.py
===================================================================
--- csw/mgar/gar/v2/lib/python/common_constants.py	2012-06-06 13:18:44 UTC (rev 18236)
+++ csw/mgar/gar/v2/lib/python/common_constants.py	2012-06-06 21:09:26 UTC (rev 18237)
@@ -14,8 +14,16 @@
     OS_REL_511,
 )
 OBSOLETE_OS_RELS = (
-    u"SunOS5.8",
+    OS_REL_58,
 )
+SVR4_OS_RELS = (
+    OS_REL_58,
+    OS_REL_59,
+    OS_REL_510,
+)
+IPS_OS_RELS = (
+    OS_REL_511,
+)
 
 SYSTEM_SYMLINKS = (
     ("/opt/csw/bdb4",     ("/opt/csw/bdb42",)),

Modified: csw/mgar/gar/v2/lib/python/system_pkgmap.py
===================================================================
--- csw/mgar/gar/v2/lib/python/system_pkgmap.py	2012-06-06 13:18:44 UTC (rev 18236)
+++ csw/mgar/gar/v2/lib/python/system_pkgmap.py	2012-06-06 21:09:26 UTC (rev 18237)
@@ -21,6 +21,7 @@
 import sys
 
 CONTENT_PKG_RE = r"^\*?(CSW|SUNW)[0-9a-zA-Z\-]?[0-9a-z\-]+$"
+ALPHANUMERIC_RE = r"[0-9a-zA-Z]+"
 
 class Error(Exception):
   pass
@@ -103,16 +104,69 @@
                   repr(self.infile_contents), repr(self.outfile), repr(self.osrel),
                   repr(self.arch))
 
-  def _ParsePkginfoLine(self, line):
+  def _ParseSrv4PkginfoLine(self, line):
     fields = re.split(c.WS_RE, line)
     pkgname = fields[1]
     pkg_desc = u" ".join(fields[2:])
     return pkgname, pkg_desc
 
-  def _ParsePkgmapLine(self, line):
+  def _ParseIpsPkgListLine(self, line):
+    fields = re.split(c.WS_RE, line)
+    pkgname = self._IpsNameToSrv4Name(fields[0])
+    desc_field_start = 1
+    # The optional publisher field is always between
+    # parenthesis, we skip it if necessary
+    if fields[desc_field_start].startswith("("):
+      desc_field_start += 1
+    pkg_desc = u" ".join(fields[desc_field_start:])
+    return pkgname, pkg_desc
+
+  def _ParseIpsPkgContentsLine(self, line):
+    """Parses one line of "pkg contents" output
+
+    Returns: A dictionary of fields, or None.
+    """
+    # we will map from IPS type to SVR4 type
+    type_mapping  = { "link": "s", "hardlink": "l", "file": "f", "dir": "d" }
+
+    parts = re.split(c.WS_RE, line.strip())
+    if len(parts) < 4:
+      raise ParsingError("Line does not have enough fields: %s"
+                         % repr(parts))
+    # paths are relative to "/" in pkg contents output
+    f_path = "/" + parts[0]
+    f_target = None
+    try:
+      f_type = type_mapping[parts[1]]
+    except:
+      raise ParsingError("Wrong file type: %s in %s"
+                         % (repr(parts[1]), repr(line)))
+    f_mode = None
+    f_owner = None
+    f_group = None
+    f_pkgname = None
+    pkgnames = [ self._IpsNameToSrv4Name(parts[2]) ]
+    if f_type in ("s", "l"):
+      f_target = parts[3]
+    else:
+      (f_mode, f_owner, f_group) = parts[3:6]
+
+    d = {
+        "path": f_path,
+        "target": f_target,
+        "type": f_type,
+        "mode": f_mode,
+        "owner": f_owner,
+        "group": f_group,
+        "pkgnames": pkgnames,
+        "line": line,
+    }
+    return d
+
+  def _ParseSrv4PkgmapLine(self, line):
     """Parses one line of /var/sadm/install/contents.
 
-    Returns: A dictionary of fields, or none.
+    Returns: A dictionary of fields, or None.
     """
     if line.startswith("#"):
       return None
@@ -207,8 +261,8 @@
     }
     return d
 
-  def _ParseInstallContents(self, stream, show_progress):
-    logging.debug("-> _ParseInstallContents()")
+  def _ParsePkgContents(self, stream, parser, show_progress):
+    logging.debug("-> _ParsePkgContents()")
     parsed_lines = []
     c = itertools.count()
     # Progressbar stuff can go here.
@@ -217,13 +271,13 @@
         if not c.next() % 1000:
           sys.stdout.write(".")
           sys.stdout.flush()
-      d = self._ParsePkgmapLine(line)
+      d = parser(line)
       # d might be None if line was a comment
       if d:
         parsed_lines.append(d)
     if show_progress:
       sys.stdout.write("\n")
-    logging.debug("<- _ParseInstallContents()")
+    logging.debug("<- _ParsePkgContents()")
     return parsed_lines
 
   def _GetUname(self, uname_option=None):
@@ -246,9 +300,10 @@
 
   def _GetArch(self):
     return self._GetUname("-p")
-  
-  def GetDataStructure(self, contents_stream, pkginfo_stream, osrel, arch,
-                       show_progress=False):
+
+  def GetDataStructure(self, srv4_pkgcontent_stream, srv4_pkginfo_stream, 
+                       ips_pkgcontent_stream, ips_pkginfo_stream,
+                       osrel, arch, show_progress=False):
     """Gets the data structure to be pickled.
 
     Does not interact with the OS.
@@ -256,17 +311,30 @@
     data = {
         "osrel": osrel,
         "arch": arch,
-        "contents": self._ParseInstallContents(contents_stream, show_progress),
-        "pkginfo": self._ParsePkginfoOutput(pkginfo_stream, show_progress),
+        "contents": self._ParsePkgContents(srv4_pkgcontent_stream, self._ParseSrv4PkgmapLine, show_progress),
+        "pkginfo": self._ParsePkgInfos(srv4_pkginfo_stream, self._ParseSrv4PkginfoLine, show_progress),
     }
+    if ips_pkginfo_stream and ips_pkgcontent_stream:
+      data["contents"].extend(self._ParsePkgContents(ips_pkgcontent_stream, self._ParseIpsPkgContentsLine, show_progress))
+      data["pkginfo"].update(self._ParsePkgInfos(ips_pkgcontent_stream, self._ParseIpsPkgListLine, show_progress))
+
     return data
 
   def Index(self, show_progress=False):
     # This function interacts with the OS.
-    contents_stream = open(self.infile_contents, "r")
-    pkginfo_stream = self._GetPkginfoStream()
-    data = self.GetDataStructure(
-        contents_stream, pkginfo_stream, self.osrel, self.arch, show_progress)
+    srv4_pkgcontents_stream = self._GetSrv4PkgcontentStream()
+    srv4_pkginfos_stream = self._GetSrv4PkginfosStream()
+
+    if self.osrel in common_constants.IPS_OS_RELS:
+      ips_pkgcontents_stream = self._GetIpsPkgcontentStream()
+      ips_pkginfos_stream = self._GetIpsPkginfosStream()
+    else: 
+      ips_pkgcontents_stream = None
+      ips_pkginfos_stream = None
+      
+    data = self.GetDataStructure(srv4_pkgcontents_stream, srv4_pkginfos_stream, 
+                                 ips_pkgcontents_stream, ips_pkginfos_stream, 
+                                 self.osrel, self.arch, show_progress)
     return data
 
   def IndexAndSave(self):
@@ -277,27 +345,60 @@
     cPickle.dump(data, out_fd, cPickle.HIGHEST_PROTOCOL)
     logging.debug("IndexAndSave(): pickling done.")
 
-  def _GetPkginfoStream(self):
+  def _GetSrv4PkgcontentStream(self):
+    return (open(self.infile_contents, "r"))
+
+  def _GetIpsPkgcontentStream(self):
+    args = ["pkg", "contents", "-H", "-o",
+            "path,action.name,pkg.name,target,mode,owner,group",
+            "-t", "dir,file,hardlink,link"]
+    pkg_proc = subprocess.Popen(args, stdout=subprocess.PIPE)
+    stdout, stderr = pkg_proc.communicate()
+    ret = pkg_proc.wait()
+    return stdout.splitlines()
+
+  def _GetSrv4PkginfosStream(self):
     """Calls pkginfo if file is not specified."""
     if self.infile_pkginfo:
-      return open(self.infile_pkginfo, "r")
+      pkginfo_stream = open(self.infile_pkginfo, "r")
     else:
       args = ["pkginfo"]
       pkginfo_proc = subprocess.Popen(args, stdout=subprocess.PIPE)
       stdout, stderr = pkginfo_proc.communicate()
       ret = pkginfo_proc.wait()
       pkginfo_stream = stdout.splitlines()
-      return pkginfo_stream
+    
+    return pkginfo_stream
 
-  def _ParsePkginfoOutput(self, pkginfo_stream, unused_show_progress):
-    logging.debug("-> _ParsePkginfoOutput()")
+  def _GetIpsPkginfosStream(self):
+    args = ["pkg", "list", "-H", "-s"]
+    pkg_proc = subprocess.Popen(args, stdout=subprocess.PIPE)
+    stdout, stderr = pkg_proc.communicate()
+    ret = pkg_proc.wait()
+    pkglist_stream = stdout.splitlines()
+    return pkglist_stream
+
+  def _ParsePkgInfos(self, stream, parser, unused_show_progress):
+    """Parses informations about packages
+
+    Args:
+      stream: A stream that contains informations about packages
+      parser: The parse method used to retrieve information from the stream
+      unused_show_progress: Used to display a progress bar, which was removed.
+    Returns:
+      A dictionary from pkgnames to descriptions.
+    """
+    logging.debug("-> _ParsePkgInfos()")
     packages_by_pkgname = {}
-    for line in pkginfo_stream:
-      pkgname, pkg_desc = self._ParsePkginfoLine(line)
+    for line in stream:
+      pkgname, pkg_desc = parser(line)
       packages_by_pkgname.setdefault(pkgname, pkg_desc)
-    logging.debug("<- _ParsePkginfoOutput()")
+    logging.debug("<- _ParsePkgInfos()")
     return packages_by_pkgname
 
+  def _IpsNameToSrv4Name(self, ips_name):
+    """Create a fake Srv4 pkgname from an ips pkgname."""
+    return "SUNW" + "-".join(re.findall (ALPHANUMERIC_RE, ips_name))
 
 class InstallContentsImporter(object):
   """Responsible for importing a pickled file into the database."""
@@ -482,7 +583,7 @@
 
   def ComposeFakeSrv4Md5(self, pkgname, osrel, arch):
     """Returns a fake md5 sum of a fake srv4 package.
- 
+
     For the purposes of fake srv4 packages for SUNW stuff.
     """
     key = pkgname + osrel + arch

Modified: csw/mgar/gar/v2/lib/python/system_pkgmap_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/system_pkgmap_test.py	2012-06-06 13:18:44 UTC (rev 18236)
+++ csw/mgar/gar/v2/lib/python/system_pkgmap_test.py	2012-06-06 21:09:26 UTC (rev 18237)
@@ -7,6 +7,14 @@
 import logging
 import common_constants
 
+PKGINFO_LINE_1 = ("system      SUNWwpau                Wireless WPA Supplicant, (Usr)")
+PKGINFO_LINE_2 = ("system      SUNWpcan                Cisco-Aironet 802.11b driver")
+
+PKGLIST_LINE_1 = ("developer/versioning/sccs "
+                  "                              Source Code Control System")
+PKGLIST_LINE_2 = ("developer/solarisstudio-122/c++ (solarisstudio) "
+                  "        C++ Compilers")
+
 PKGMAP_LINE_1 = ("/usr/lib/sparcv9/libpthread.so.1 f none "
                  "0755 root bin 41296 28258 1018129099 SUNWcslx")
 PKGMAP_LINE_2 = ("/usr/lib/libCrun.so.1 f none "
@@ -28,11 +36,27 @@
                  "f none 0644 root bin 5557 10685 1068611657 !CSWmozilla")
 PKGMAP_LINE_8 = ("/etc/scn/scn_aa_read p none 0600 root sys SUNWscn-agentfacade-r")
 
+PKGCONTENT_LINE_1 = ("bin\tlink\tsystem/core-os\t./usr/bin")
+PKGCONTENT_LINE_2 = ("dev\tdir\tsystem/core-os\t\t0755\troot\tsys")
+PKGCONTENT_LINE_3 = ("etc/svc/profile/platform_SUNW,UltraSPARC-IIe-NetraCT-40.xml\thardlink\t"
+                     "system/core-os\t./platform_SUNW,UltraSPARC-IIi-Netract.xml")
+PKGCONTENT_LINE_4 = ("lib/libc.so.1\tfile\tsystem/library\t\t0755\troot\tbin")
 
+
 class IndexerUnitTest(unittest.TestCase):
 
-  def test_ParsePkgmapLineFile(self):
+  def test_ParseSrv4PkginfoLine(self):
     spi = system_pkgmap.Indexer()
+    expected = ('SUNWwpau', 'Wireless WPA Supplicant, (Usr)')
+    self.assertEqual(expected, spi._ParseSrv4PkginfoLine(PKGINFO_LINE_1))
+ 
+  def test_ParseIpsPkgListLine(self):
+    spi = system_pkgmap.Indexer()
+    expected = ('SUNWdeveloper-versioning-sccs', 'Source Code Control System')
+    self.assertEqual(expected, spi._ParseIpsPkgListLine(PKGLIST_LINE_1))
+
+  def test_ParseSrv4PkgmapLineFile(self):
+    spi = system_pkgmap.Indexer()
     expected = {
         'cksum': '28258',
         'class': 'none',
@@ -48,9 +72,9 @@
         'target': None,
         'type': 'f',
         'line': PKGMAP_LINE_1}
-    self.assertEqual(expected, spi._ParsePkgmapLine(PKGMAP_LINE_1))
+    self.assertEqual(expected, spi._ParseSrv4PkgmapLine(PKGMAP_LINE_1))
 
-  def test_ParsePkgmapLineTypeSymlink(self):
+  def test_ParseSrv4PkgmapLineTypeSymlink(self):
     spi = system_pkgmap.Indexer()
     expected = {
         'cksum': None,
@@ -68,9 +92,9 @@
         'type': 's',
         'line': PKGMAP_LINE_3,
     }
-    self.assertEqual(expected, spi._ParsePkgmapLine(PKGMAP_LINE_3))
+    self.assertEqual(expected, spi._ParseSrv4PkgmapLine(PKGMAP_LINE_3))
 
-  def test_ParsePkgmapLineTypeQuestionMark(self):
+  def test_ParseSrv4PkgmapLineTypeQuestionMark(self):
     """A question mark is not a valid type, but we have to cope with it."""
     spi = system_pkgmap.Indexer()
     expected = {
@@ -84,9 +108,9 @@
         'mode': None, 'type': 'd',
         'minor': None,
     }
-    self.assertEqual(expected, spi._ParsePkgmapLine(PKGMAP_LINE_5))
+    self.assertEqual(expected, spi._ParseSrv4PkgmapLine(PKGMAP_LINE_5))
 
-  def test_ParsePkgmapLineTypePipe(self):
+  def test_ParseSrv4PkgmapLineTypePipe(self):
     """A pipe is a valid type and we have to cope with it."""
     spi = system_pkgmap.Indexer()
     expected = {
@@ -105,9 +129,9 @@
         'type': 'p',
         'minor': None,
     }
-    self.assertEqual(expected, spi._ParsePkgmapLine(PKGMAP_LINE_8))
+    self.assertEqual(expected, spi._ParseSrv4PkgmapLine(PKGMAP_LINE_8))
 
-  def test_ParsePkgmapLibc(self):
+  def test_ParseSrv4PkgmapLibc(self):
     """A question mark is not a valid type, but we have to cope with it."""
     spi = system_pkgmap.Indexer()
     expected = {
@@ -126,30 +150,157 @@
         'type': 'f',
         'minor': None,
     }
-    self.assertEqual(expected, spi._ParsePkgmapLine(PKGMAP_LINE_6))
+    self.assertEqual(expected, spi._ParseSrv4PkgmapLine(PKGMAP_LINE_6))
 
-  def test_ParsePkgmapExclamationMark(self):
+  def test_ParseSrv4PkgmapExclamationMark(self):
     spi = system_pkgmap.Indexer()
     self.assertEqual(
         ["!CSWmozilla"],
-        spi._ParsePkgmapLine(PKGMAP_LINE_7)["pkgnames"])
+        spi._ParseSrv4PkgmapLine(PKGMAP_LINE_7)["pkgnames"])
 
-  def test_ParsePkgmapLineTypeWrongSyntax(self):
+  def test_ParseSrv4PkgmapLineTypeWrongSyntax(self):
     spi = system_pkgmap.Indexer()
     self.assertRaises(
         system_pkgmap.ParsingError,
-        spi._ParsePkgmapLine, "/")
+        spi._ParseSrv4PkgmapLine, "/")
 
-  def test_ParseInstallContents(self):
+  def test_ParseIpsPkgContentsLineLink(self):
     spi = system_pkgmap.Indexer()
-    data = (
-        PKGMAP_LINE_1,
-        PKGMAP_LINE_2,
-        PKGMAP_LINE_3,
-        PKGMAP_LINE_4)
-    self.assertEqual(4, len(spi._ParseInstallContents(data, False)))
+    line = PKGCONTENT_LINE_1
+    expected = {
+        'pkgnames': ['SUNWsystem-core-os'],
+        'group': None,
+        'target': './usr/bin',
+        'owner': None,
+        'path': '/bin',
+        'line': PKGCONTENT_LINE_1,
+        'type': 's',
+        'mode': None,
+    }
+    self.assertEquals(
+        expected,
+        spi._ParseIpsPkgContentsLine(line))
 
+  def test_ParseIpsPkgContentsLineDir(self):
+    spi = system_pkgmap.Indexer()
+    line = PKGCONTENT_LINE_2
+    expected = {
+        'pkgnames': ['SUNWsystem-core-os'],
+        'group': 'sys',
+        'target': None,
+        'owner': 'root',
+        'path': '/dev',
+        'line': PKGCONTENT_LINE_2,
+        'type': 'd',
+        'mode': '0755',
+    }
+    self.assertEquals(
+        expected,
+        spi._ParseIpsPkgContentsLine(line))
 
+  def test_ParseIpsPkgContentsLineHardlink(self):
+    spi = system_pkgmap.Indexer()
+    line = PKGCONTENT_LINE_3
+    expected = {
+        'pkgnames': ['SUNWsystem-core-os'],
+        'group': None,
+        'target': './platform_SUNW,UltraSPARC-IIi-Netract.xml',
+        'owner': None,
+        'path': '/etc/svc/profile/platform_SUNW,UltraSPARC-IIe-NetraCT-40.xml',
+        'line': PKGCONTENT_LINE_3,
+        'type': 'l',
+        'mode': None,
+    }
+    self.assertEquals(
+        expected,
+        spi._ParseIpsPkgContentsLine(line))
+
+  def test_ParseIpsPkgContentsLineFile(self):
+    spi = system_pkgmap.Indexer()
+    line = PKGCONTENT_LINE_4
+    expected = {
+        'pkgnames': ['SUNWsystem-library'],
+        'group': 'bin',
+        'target': None,
+        'owner': 'root',
+        'path': '/lib/libc.so.1',
+        'line': PKGCONTENT_LINE_4,
+        'type': 'f',
+        'mode': '0755',
+    }
+    self.assertEquals(
+        expected,
+        spi._ParseIpsPkgContentsLine(line))
+
+  def test_IpsNameToSrv4Name(self):
+    spi = system_pkgmap.Indexer()
+    self.assertEquals(
+        'SUNWsystem-core-os',
+        spi._IpsNameToSrv4Name("system/core-os"))
+
+
+  def test_ParsePkgContents(self):
+    spi = system_pkgmap.Indexer()
+    srv4_stream = (
+          PKGMAP_LINE_1,
+          PKGMAP_LINE_2,
+          PKGMAP_LINE_3,
+          PKGMAP_LINE_4
+    )
+    ips_stream = (
+          PKGCONTENT_LINE_1,
+          PKGCONTENT_LINE_2,
+          PKGCONTENT_LINE_3,
+          PKGCONTENT_LINE_4
+    )
+    self.assertEqual(4, len(spi._ParsePkgContents(srv4_stream, spi._ParseSrv4PkgmapLine, False)))
+    self.assertEqual(4, len(spi._ParsePkgContents(ips_stream, spi._ParseIpsPkgContentsLine, False)))
+
+  def test_GetDataStructure(self):
+    spi = system_pkgmap.Indexer()
+    expected = {'arch': 'sparc', 'osrel': 'SunOS5.11',
+                'contents': [
+                 {'cksum': '28258', 'class': 'none', 'group': 'bin', 
+                  'line': '/usr/lib/sparcv9/libpthread.so.1 f none 0755 root bin 41296 28258 1018129099 SUNWcslx',
+                   'major': None, 'minor': None, 'mode': '0755', 'modtime': '1018129099', 'owner': 'root',
+                   'path': '/usr/lib/sparcv9/libpthread.so.1', 'pkgnames': ['SUNWcslx'], 'size': '41296', 
+                   'target': None, 'type': 'f'},
+                 {'cksum': '6287', 'class': 'none', 'group': 'bin',
+                  'line': '/usr/lib/libCrun.so.1 f none 0755 root bin 63588 6287 1256043984 SUNWlibC',
+                  'major': None, 'minor': None, 'mode': '0755', 'modtime': '1256043984', 'owner': 'root',
+                  'path': '/usr/lib/libCrun.so.1', 'pkgnames': ['SUNWlibC'], 'size': '63588',
+                  'target': None, 'type': 'f'},
+                 {'group': None, 'line': 'bin\tlink\tsystem/core-os\t./usr/bin', 'mode': None, 'owner': None,
+                  'path': '/bin', 'pkgnames': ['SUNWsystem-core-os'], 'target': './usr/bin', 'type': 's'},
+                 {'group': 'sys', 'line': 'dev\tdir\tsystem/core-os\t\t0755\troot\tsys', 'mode': '0755', 'owner': 'root',
+                  'path': '/dev', 'pkgnames': ['SUNWsystem-core-os'], 'target': None, 'type': 'd'}],
+                'pkginfo': {'SUNWbin': u'link system/core-os ./usr/bin',
+                            'SUNWdev': u'dir system/core-os 0755 root sys',
+                            'SUNWpcan': u'Cisco-Aironet 802.11b driver',
+                            'SUNWwpau': u'Wireless WPA Supplicant, (Usr)'}
+               }
+    srv4_pkginfos_stream = (
+          PKGINFO_LINE_1,
+          PKGINFO_LINE_2,
+    )
+    ips_pkginfos_stream = (
+          PKGLIST_LINE_1,
+          PKGLIST_LINE_2,
+    )
+    srv4_pkgcontents_stream = (
+          PKGMAP_LINE_1,
+          PKGMAP_LINE_2,
+    )
+    ips_pkgcontents_stream = (
+          PKGCONTENT_LINE_1,
+          PKGCONTENT_LINE_2,
+    )
+    self.assertEqual(expected, spi.GetDataStructure(srv4_pkgcontents_stream, srv4_pkginfos_stream,
+                                                    ips_pkgcontents_stream, ips_pkginfos_stream,
+                                                    'SunOS5.11', 'sparc', False))
+
+
+
 class InstallContentsImporterUnitTest(test_base.SqlObjectTestMixin,
                                       unittest.TestCase):
 

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