[Gelistirici] [PATCH] fix checking of missing config files

S.Çağlar Onur caglar at pardus.org.tr
7 Şub 2008 Per 16:02:07 EET


caglar at zangetsu ~ $ sudo rm /etc/modules.d/alsa

Yamadan önce:

caglar at zangetsu ~ $ pisi check alsa-utils
* alsa-utils kontrol ediliyor... Tamam

Yamadan sonra:

caglar at zangetsu ~ $ pisi check alsa-utils
* alsa-utils kontrol ediliyor...
Missing file: /etc/modules.d/alsa

Paket alsa-utils bozuk.

Arada ("/" + f.path) kullanımı unicode safe ("/%s" % f.path) haline dönüştürüldü.

Bir de artık bu path isimlerinin başına / ekleme işinden kurtulmak için birşeyler yapsak (ne yapılması gerekiyor emin değilim)

Index: pisi/api.py
===================================================================
--- pisi/api.py	(revision 17048)
+++ pisi/api.py	(working copy)
@@ -432,17 +432,20 @@
     md, files = info(package, True)
     corrupt = []
     for f in files.list:
-        if f.hash and f.type != "config" \
-           and not os.path.islink('/' + f.path):
-            ctx.ui.info(_("Checking /%s ") % f.path, noln=True, verbose=True)
-            try:
-                if f.hash != pisi.util.sha1_file('/' + f.path):
-                    corrupt.append(f)
-                    ctx.ui.error(_("\nCorrupt file: %s") % f)
-                else:
-                    ctx.ui.info(_("OK"), verbose=True)
-            except pisi.util.FileError,e:
-                ctx.ui.error("\n%s" % e)
+        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):
+                try:
+                    if f.hash != pisi.util.sha1_file("/%s" % f.path):
+                        corrupt.append(f)
+                        ctx.ui.error(_("\nCorrupt file: %s") % ("/%s" %f.path))
+                    else:
+                        ctx.ui.info(_("OK"), verbose=True)
+                except pisi.util.FileError,e:
+                    ctx.ui.error("\n%s" % e)
+        else:
+            corrupt.append(f)
+            ctx.ui.error(_("\nMissing file: %s") % ("/%s" % f.path))
     return corrupt
 
 def index(dirs=None, output='pisi-index.xml', skip_sources=False, skip_signing=False):

-- 
S.Çağlar Onur <caglar at pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!



Gelistirici mesaj listesiyle ilgili daha fazla bilgi