[Collab-qa-commits] r2495 - multi-arch

Jakub Wilk jwilk at alioth.debian.org
Wed Sep 26 10:57:11 UTC 2012


Author: jwilk
Date: 2012-09-26 10:57:10 +0000 (Wed, 26 Sep 2012)
New Revision: 2495

Modified:
   multi-arch/report-multiarch-bug
Log:
report-multiarch-bug: compare symlinks, too.


Modified: multi-arch/report-multiarch-bug
===================================================================
--- multi-arch/report-multiarch-bug	2012-09-26 10:31:50 UTC (rev 2494)
+++ multi-arch/report-multiarch-bug	2012-09-26 10:57:10 UTC (rev 2495)
@@ -7,6 +7,7 @@
 
 import argparse
 import collections
+import errno
 import os
 import pwd
 import re
@@ -76,6 +77,20 @@
 class NotMultiArchSame(UserError):
     pass
 
+def regulate_symlinks(root='.'):
+    fsencoding = sys.getfilesystemencoding()
+    for root, dirnames, filenames in os.walk(root):
+        for filename in filenames + dirnames:
+            filename = os.path.join(root, filename)
+            try:
+                link = os.readlink(filename)
+            except OSError as exc:
+                if exc.errno == errno.EINVAL:
+                    continue
+            os.remove(filename)
+            with open(filename, 'wt', encoding=fsencoding) as file:
+                file.write(link)
+
 def main(options):
     cache = apt.Cache()
     packages = cache[options.package].versions
@@ -121,6 +136,7 @@
             strip_deb_suffix(filename)
         ]
         ipc.check_call(commandline)
+    regulate_symlinks()
     diff_commandline = ['diff', '-ur'] + [strip_deb_suffix(f) for f in files.keys()]
     child = ipc.Popen(diff_commandline, stdout=ipc.PIPE)
     (archdiff, stderr) = child.communicate()




More information about the Collab-qa-commits mailing list