From 06c9f39b9eb7e2683158a27eabbea799029fd9d1 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Fri, 21 Nov 2008 13:00:43 +0000 Subject: [PATCH] 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 --- pisi/api.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 6cd2e569..cfcc7724 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -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: