Use lexist to return True for broken links. We check the existence of the file (here symlink file) only.

And then check the sha1sum of the file. For symlinks this is the path string's sha1sum.

BUG:FIXED:7336
This commit is contained in:
Faik Uygur
2008-11-21 13:00:43 +00:00
parent 59078b0982
commit 06c9f39b9e
+7 -3
View File
@@ -583,10 +583,14 @@ def check(package):
corrupt = []
for f in files.list:
ctx.ui.info(_("Checking /%s ") % f.path, noln=True, verbose=True)
if os.path.exists("/%s" % f.path):
if f.hash and f.type != "config" and not os.path.islink("/%s" % f.path):
if os.path.lexists("/%s" % f.path):
if f.hash and f.type != "config":
try:
if f.hash != pisi.util.sha1_file("/%s" % f.path):
if os.path.islink("/%s" % f.path):
if f.hash != pisi.util.sha1_data(os.readlink("/%s" % f.path)):
corrupt.append(f)
ctx.ui.error(_("\nCorrupt file: %s") % ("/%s" %f.path))
elif f.hash != pisi.util.sha1_file("/%s" % f.path):
corrupt.append(f)
ctx.ui.error(_("\nCorrupt file: %s") % ("/%s" %f.path))
else: