[Piuparts-commits] rev 149 - in trunk: . debian

Lucas Nussbaum lucas at alioth.debian.org
Mon May 5 09:49:10 UTC 2008


Author: lucas
Date: 2008-05-05 09:49:09 +0000 (Mon, 05 May 2008)
New Revision: 149

Modified:
   trunk/debian/changelog
   trunk/piuparts.py
Log:
fix symlinks check

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-05-05 09:42:49 UTC (rev 148)
+++ trunk/debian/changelog	2008-05-05 09:49:09 UTC (rev 149)
@@ -10,8 +10,10 @@
     in the chroot. (Closes: #458922)
   * Doc fix: remove mention of pbuilder in how-to-use-piuparts.txt.
     Using -s to save the tarball is easier.
+  * Finally fixes the check for broken symlinks. Thanks go to
+    Tobias Grimm for the patch. Closes: #468157, 478587.
 
- -- Lucas Nussbaum <lucas at lucas-nussbaum.net>  Mon, 05 May 2008 11:42:13 +0200
+ -- Lucas Nussbaum <lucas at lucas-nussbaum.net>  Mon, 05 May 2008 11:44:55 +0200
 
 piuparts (0.30) unstable; urgency=low
 

Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py	2008-05-05 09:42:49 UTC (rev 148)
+++ trunk/piuparts.py	2008-05-05 09:49:09 UTC (rev 149)
@@ -448,7 +448,7 @@
         if os.path.isabs(target):
             pathname = os.path.join(root, target[1:]) # Assume Unix filenames
         else:
-            pathname = os.path.join(dirpath, target)
+            pathname = os.path.join(os.path.dirname(pathname), target)
 
     # The symlink chain, if any, has now been resolved. Does the target
     # exist?
@@ -477,9 +477,7 @@
         self.symlink("/absolute-works", "absolute-works-to-symlink")
         
     def tearDown(self):
-        for symlink in self.symlinks:
-            os.remove(symlink)
-        os.rmdir(self.testdir)
+        shutil.rmtree(self.testdir)
         
     def testRelativeBroken(self):
         self.failUnless(is_broken_symlink(self.testdir, self.testdir, 
@@ -513,7 +511,16 @@
         self.failIf(is_broken_symlink(self.testdir, self.testdir, 
                                       "absolute-works-to-symlink"))
 
+    def testMultiLevelNestedSymlinks(self):
+        # target/first-link -> ../target/second-link -> ../target
 
+        os.mkdir(os.path.join(self.testdir, "target"))
+        self.symlink("../target", "target/second-link")
+        self.symlink("../target/second-link", "target/first-link")
+        self.failIf(is_broken_symlink(self.testdir, self.testdir,
+                                      "target/first-link"))
+
+
 class Chroot:
 
     """A chroot for testing things in."""




More information about the Piuparts-commits mailing list