Add Pkg.readfile() for dereferencing PkgFile symlinks.

git-svn-id: svn+ssh://rpmlint.zarb.org/home/projects/rpmlint/svn/trunk@1847 9bc8b190-ac0f-0410-8968-dc7d1f502856
This commit is contained in:
Ville Skyttä 2011-04-06 20:21:41 +00:00
parent 6faf113f7b
commit 74f897ae4f
1 changed files with 11 additions and 0 deletions

11
Pkg.py
View File

@ -17,6 +17,7 @@ import sys
import tempfile
import types
import subprocess
import urlparse
try:
import magic
@ -648,6 +649,16 @@ class Pkg:
pkgfile.filecaps = filecaps[idx]
self._files[pkgfile.name] = pkgfile
def readlink(self, pkgfile):
"""Resolve symlinks for the given PkgFile, return the dereferenced
PkgFile if it is found in this package, None if not."""
result = pkgfile
while result and result.linkto:
linkpath = urlparse.urljoin(result.name, result.linkto)
linkpath = safe_normpath(linkpath)
result = self.files().get(linkpath)
return result
# API to access dependency information
def obsoletes(self):
"""Get package Obsoletes as list of