Exemplo n.º 1
0
 def test_ParseLineSymlink(self):
     pm = pkgmap.Pkgmap(PKGMAP_2.splitlines())
     line = (
         "1 s none "
         "/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5=libpq.so.5.3")
     # s none /opt/csw/lib/sparcv9/libpq.so.5=..//sparcv9/libpq.so.5
     # s none /opt/csw/lib/sparcv9/libpq.so.5.3=..//sparcv9/libpq.so.5.3
     line_to_add = (
         "/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5 --> "
         "libpq.so.5.3")
     entry = {
         'group':
         None,
         'target':
         '/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5.3',
         'user':
         None,
         'path':
         '/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5',
         'line': ('1 s none /opt/csw/lib/postgresql/9.0/lib/sparcv9/'
                  'libpq.so.5=libpq.so.5.3'),
         'type':
         's',
         'class':
         'none',
         'mode':
         None,
     }
     self.assertEqual((entry, line_to_add), pm._ParseLine(line))
Exemplo n.º 2
0
 def test_1(self):
     pm = pkgmap.Pkgmap(PKGMAP_1.splitlines())
     expected = [{
         'group': 'bin',
         'user': '******',
         'path': '/etc/opt/csw/cups/cupsd.conf.CSW',
         'line':
         '1 f cswcpsampleconf /etc/opt/csw/cups/cupsd.conf.CSW 0644 root bin 4053 20987 1264420689',
         'type': 'f',
         'class': 'cswcpsampleconf',
         'mode': '0644',
         'target': None,
     }]
     self.assertEqual(expected, pm.entries)
Exemplo n.º 3
0
 def GetPkgmap(self, analyze_permissions=False, strip=None):
     fd = open(os.path.join(self.directory, "pkgmap"), "r")
     basedir = self.GetBasedir()
     return pkgmap.Pkgmap(fd, analyze_permissions, strip, basedir)
Exemplo n.º 4
0
 def testPkgmapSortedByPaths(self):
     pm = pkgmap.Pkgmap(PKGMAP_2.splitlines())
     paths = [x["path"] for x in pm.entries]
     self.assertEquals(paths, sorted(paths))
Exemplo n.º 5
0
 def test_4(self):
     pm = pkgmap.Pkgmap(PKGMAP_3.splitlines())
     self.assertTrue("build" in pm.entries_by_class)
Exemplo n.º 6
0
 def test_3(self):
     pm = pkgmap.Pkgmap(PKGMAP_2.splitlines())
     self.assertTrue("cswcpsampleconf" in pm.entries_by_class)
Exemplo n.º 7
0
 def test_2(self):
     pm = pkgmap.Pkgmap(PKGMAP_2.splitlines())
     line = ": 1 18128"
     self.assertTrue(line in pm.entries_by_line)