* patch dailywtf code
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
__version__ = "1.0"
|
__version__ = "1.0"
|
||||||
|
|
||||||
__dbversion__ = "1.0.1"
|
__dbversion__ = "1.0.2"
|
||||||
|
|
||||||
__all__ = [ 'api', 'config', 'packagedb', 'installdb', 'search' ]
|
__all__ = [ 'api', 'config', 'packagedb', 'installdb', 'search' ]
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -44,10 +44,13 @@ class Error(pisi.Error):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# this DAILYWTF approach will be removed in the next release.
|
||||||
|
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
def get_file_type(path, pinfoList):
|
def get_file_type(path, pinfoList):
|
||||||
"""Return the file type of a path according to the given PathInfo
|
"""Return the file type of a path according to the given PathInfo
|
||||||
list"""
|
list"""
|
||||||
|
# not only confusing but totally non-deterministic behavior -- exa
|
||||||
# The usage of depth is somewhat confusing. It is used for finding
|
# The usage of depth is somewhat confusing. It is used for finding
|
||||||
# the best match to paths(in pinfolist). For an example, if paths
|
# the best match to paths(in pinfolist). For an example, if paths
|
||||||
# contain ['/usr/share','/usr/share/doc'] and path is
|
# contain ['/usr/share','/usr/share/doc'] and path is
|
||||||
@@ -55,6 +58,7 @@ def get_file_type(path, pinfoList):
|
|||||||
# the second item.
|
# the second item.
|
||||||
depth = 0
|
depth = 0
|
||||||
ftype = ""
|
ftype = ""
|
||||||
|
permanent = False
|
||||||
path = "/"+path # we need a real path.
|
path = "/"+path # we need a real path.
|
||||||
for pinfo in pinfoList:
|
for pinfo in pinfoList:
|
||||||
if util.subpath(pinfo.path, path):
|
if util.subpath(pinfo.path, path):
|
||||||
@@ -62,7 +66,8 @@ def get_file_type(path, pinfoList):
|
|||||||
if depth < length:
|
if depth < length:
|
||||||
depth = length
|
depth = length
|
||||||
ftype = pinfo.fileType
|
ftype = pinfo.fileType
|
||||||
return ftype
|
permanent = pinfo.permanent
|
||||||
|
return ftype, permanent
|
||||||
|
|
||||||
def check_path_collision(package, pkgList):
|
def check_path_collision(package, pkgList):
|
||||||
"""This function will check for collision of paths in a package with
|
"""This function will check for collision of paths in a package with
|
||||||
@@ -482,12 +487,13 @@ class Builder:
|
|||||||
# add the files under material path
|
# add the files under material path
|
||||||
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
|
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir):
|
||||||
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
||||||
ftype = get_file_type(frpath, package.files)
|
ftype, permanent = get_file_type(frpath, package.files)
|
||||||
try: # broken links and empty dirs can cause problem
|
try: # broken links and empty dirs can cause problem
|
||||||
fsize = os.path.getsize(fpath)
|
fsize = os.path.getsize(fpath)
|
||||||
except OSError:
|
except OSError:
|
||||||
fsize = None
|
fsize = None
|
||||||
d[frpath] = FileInfo(path=frpath, type=ftype, size=fsize, hash=fhash)
|
d[frpath] = FileInfo(path=frpath, type=ftype, permanent=permanent,
|
||||||
|
size=fsize, hash=fhash)
|
||||||
|
|
||||||
for pinfo in package.files:
|
for pinfo in package.files:
|
||||||
wildcard_path = util.join_path(install_dir, pinfo.path)
|
wildcard_path = util.join_path(install_dir, pinfo.path)
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class Path:
|
|||||||
|
|
||||||
s_Path = [autoxml.String, autoxml.mandatory]
|
s_Path = [autoxml.String, autoxml.mandatory]
|
||||||
a_fileType = [autoxml.String, autoxml.optional]
|
a_fileType = [autoxml.String, autoxml.optional]
|
||||||
|
a_permanent = [autoxml.String, autoxml.optional]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = self.path
|
s = self.path
|
||||||
|
|||||||
Reference in New Issue
Block a user