Path çakışması sorununu çözdük.

Çağlar, tekrar test edebilir misin?
This commit is contained in:
Barış Metin
2005-06-29 17:54:13 +00:00
parent b3b033fc3f
commit 3352e5f3b4
2 changed files with 26 additions and 22 deletions
+14 -21
View File
@@ -39,20 +39,18 @@ def getFileType(path, pinfoList):
ftype = pinfo.fileType
return ftype
def checkPathCollutions(spath, spkg, pkgList):
# check collution with other packages
# FIXME: BU ŞU ANDA İSTEDİĞİM GİBİ ÇALIŞMIYOR. EVE GİDİNCE
# DÜZELTECEĞİM VE BELGELEYECEĞİM.
def checkPathCollision(package, pkgList):
"""This function will check for collision of paths in a package with
the paths of packages in pkgList. The return value will be the
list containing the paths that collide."""
collutions = []
for package in pkgList:
if package is spkg:
continue
for path in package.paths:
if path.pathname.startswith(spath):
collutions.append(path.pathname)
for pinfo in package.paths:
for pkg in pkgList:
if pkg is package:
continue
for path in pkg.paths:
if path.pathname.startswith(pinfo.pathname):
collutions.append(path.pathname)
return collutions
@@ -205,16 +203,11 @@ class PisiBuild:
generated files by the build system."""
files = Files()
install_dir = self.ctx.pkg_install_dir()
collisions = checkPathCollision(package,
self.spec.packages)
for pinfo in package.paths:
collutions = checkPathCollutions(pinfo.pathname,
package,
self.spec.packages)
# don't add collutions to files.xml
if pinfo.pathname in collutions:
continue
path = install_dir + pinfo.pathname
for fpath, fhash in util.get_file_hashes(path):
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
frpath = util.removepathprefix(install_dir, fpath) # relative path
ftype = getFileType(frpath, package.paths)
try: # broken links can cause problem
+12 -1
View File
@@ -149,8 +149,19 @@ def copy_file(src,dest):
# fd.write(l)
shutil.copyfile(src, dest)
def get_file_hashes(top):
def get_file_hashes(top, excludePrefixes=None, removePrefix=None):
"""Generator function iterates over a toplevel path and gives the
(filePath, sha1Hash) tuple for all files. If excludePrefixes list
is given function will exclude the filePaths matching those
prefixes. The removePrefix string parameter will be used to remove
prefix from filePath while matching excludes, if given."""
for root, dirs, files in os.walk(top, topdown=False):
# check if root matches an exclude, and continue
if excludePrefixes and removePrefix:
p = remove_prefix(removePrefix, root)
if [e for e in excludePrefixes if p.startswith(e)]:
continue
for file in files:
f = os.path.join(root, file)
yield (f, sha1_file(f))