[csw-devel] SF.net SVN: gar:[12110] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Wed Dec 29 01:09:13 CET 2010
Revision: 12110
http://gar.svn.sourceforge.net/gar/?rev=12110&view=rev
Author: wahwah
Date: 2010-12-29 00:09:13 +0000 (Wed, 29 Dec 2010)
Log Message:
-----------
checkpkg: Storing link targets
When parsing package pkgmaps, calculate link targets and store them in the
database. This information can be later used to find dangling symlinks in
packages (e.g. libxcb).
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/package_stats.py
csw/mgar/gar/v2/lib/python/pkgmap.py
csw/mgar/gar/v2/lib/python/pkgmap_test.py
Modified: csw/mgar/gar/v2/lib/python/package_stats.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_stats.py 2010-12-29 00:08:39 UTC (rev 12109)
+++ csw/mgar/gar/v2/lib/python/package_stats.py 2010-12-29 00:09:13 UTC (rev 12110)
@@ -22,7 +22,7 @@
from sqlobject import sqlbuilder
-PACKAGE_STATS_VERSION = 9L
+PACKAGE_STATS_VERSION = 10L
BAD_CONTENT_REGEXES = (
# Slightly obfuscating these by using the default concatenation of
# strings.
Modified: csw/mgar/gar/v2/lib/python/pkgmap.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgmap.py 2010-12-29 00:08:39 UTC (rev 12109)
+++ csw/mgar/gar/v2/lib/python/pkgmap.py 2010-12-29 00:09:13 UTC (rev 12110)
@@ -2,6 +2,7 @@
import re
import struct_util
+import os
class Pkgmap(object):
"""Represents the pkgmap of the package.
@@ -58,6 +59,7 @@
mode = None
user = None
group = None
+ target = None
if len(fields) < 2:
return None
elif line_type in ('f', 'd'):
@@ -78,6 +80,8 @@
link_from, link_to = fields[3].split("=")
installed_path = link_from
line_to_add = "%s --> %s" % (link_from, link_to)
+ target = os.path.normpath(
+ os.path.join(os.path.dirname(link_from), link_to))
prototype_class = fields[2]
if line_to_add:
self.paths.add(line_to_add)
@@ -90,7 +94,7 @@
entry["mode"] = mode
entry["user"] = user
entry["group"] = group
- # entry["target"] = group
+ entry["target"] = target
return entry, line_to_add
def GetClasses(self):
Modified: csw/mgar/gar/v2/lib/python/pkgmap_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgmap_test.py 2010-12-29 00:08:39 UTC (rev 12109)
+++ csw/mgar/gar/v2/lib/python/pkgmap_test.py 2010-12-29 00:09:13 UTC (rev 12110)
@@ -37,7 +37,8 @@
'line': '1 f cswcpsampleconf /etc/opt/csw/cups/cupsd.conf.CSW 0644 root bin 4053 20987 1264420689',
'type': 'f',
'class': 'cswcpsampleconf',
- 'mode': '0644'
+ 'mode': '0644',
+ 'target': None,
}
]
self.assertEqual(expected, pm.entries)
@@ -60,6 +61,26 @@
paths = [x["path"] for x in pm.entries]
self.assertEquals(paths, sorted(paths))
+ 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))
if __name__ == '__main__':
unittest.main()
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