Just return 0 for the size of a symlink.
This commit is contained in:
+2
-5
@@ -25,11 +25,8 @@ exception confusion. These two functions should be a lot simpler.
|
||||
* get_file_hashes is overly complex and contains strange code like:
|
||||
for r, d, f in os.walk(parent, topdown=False): pass
|
||||
|
||||
* dir_size tries to calculate symlink lengths, this is probably not very
|
||||
helpful, since in most cases, they fit in the inode, and wont take any
|
||||
extra space at all. We can keep the number of file in the index though.
|
||||
That way we can calculate package size + (nr of files * inode size of fs)
|
||||
to give a more correct required disk size.
|
||||
* To estimate required disk size for the packages more accurately we can
|
||||
calculate package size + (nr of files * inode size of fs).
|
||||
|
||||
* Why in a world like this there exists *parse_package* util functions? These must be all methods of package class
|
||||
|
||||
|
||||
+4
-4
@@ -296,13 +296,13 @@ def dir_size(dir):
|
||||
return getsize(dir)
|
||||
|
||||
if islink(dir):
|
||||
return long(len(os.readlink(dir)))
|
||||
return 0
|
||||
|
||||
def sizes():
|
||||
for root, dirs, files in os.walk(dir):
|
||||
yield sum([getsize(join(root, name)) for name in files if not islink(join(root,name))])
|
||||
yield sum([long(len(os.readlink((join(root, name))))) for name in files if islink(join(root,name))])
|
||||
return sum( sizes() )
|
||||
yield sum([getsize(join(root, name)) for name in files if not islink(join(root, name))])
|
||||
yield sum([long(len(os.readlink((join(root, name))))) for name in files if islink(join(root, name))])
|
||||
return sum(sizes())
|
||||
|
||||
def copy_file(src,dest):
|
||||
"""Copy source file to the destination file."""
|
||||
|
||||
Reference in New Issue
Block a user