[jhbuild] Support xml attribute source-subdir in _wipedir (GNOME bug 670814)



commit f7403f1daed165eba85f5b622f84174dc9d02718
Author: Craig Keogh <cskeogh adam com au>
Date:   Tue Apr 17 15:12:40 2012 +0930

    Support xml attribute source-subdir in _wipedir (GNOME bug 670814)

 jhbuild/versioncontrol/__init__.py |   14 +++++++-------
 jhbuild/versioncontrol/tarball.py  |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/jhbuild/versioncontrol/__init__.py b/jhbuild/versioncontrol/__init__.py
index 683f6a1..6d7395f 100644
--- a/jhbuild/versioncontrol/__init__.py
+++ b/jhbuild/versioncontrol/__init__.py
@@ -118,7 +118,7 @@ class Branch:
         May raise CommandError or BuildStateError if a problem occurrs.
         """
         if self.checkout_mode in ('clobber', 'export'):
-            self._wipedir(buildscript)
+            self._wipedir(buildscript, self.srcdir)
             if self.checkout_mode == 'export':
                 try:
                     self._export(buildscript)
@@ -133,7 +133,7 @@ class Branch:
                 if os.path.exists(self.get_checkoutdir()):
                     self._update(buildscript, self.config.copy_dir)
                 else:
-                    self._wipedir(buildscript)
+                    self._wipedir(buildscript, self.srcdir)
                     self._checkout(buildscript, copydir)
                 self._copy(buildscript, copydir)
             else:
@@ -144,16 +144,16 @@ class Branch:
 
     def force_checkout(self, buildscript):
         """A more agressive version of checkout()."""
-        self._wipedir(buildscript)
+        self._wipedir(buildscript, self.srcdir)
         self.checkout(buildscript)
 
     def tree_id(self):
         """A string identifier for the state of the working tree."""
         raise NotImplementedError
 
-    def _wipedir(self, buildscript):
-        if os.path.exists(self.srcdir):
-            buildscript.execute(['rm', '-rf', self.srcdir])
+    def _wipedir(self, buildscript, dir):
+        if dir and dir != os.sep and os.path.exists(dir):
+            buildscript.execute(['rm', '-rf', dir])
 
     def _export(self, buildscript):
         raise NotImplementedError
@@ -165,7 +165,7 @@ class Branch:
          fromdir = os.path.join(copydir, os.path.basename(module))
          todir = os.path.join(self.config.checkoutroot, os.path.basename(module))
          if os.path.exists(todir):
-             self._wipedir(buildscript)
+             self._wipedir(buildscript, self.srcdir)
          buildscript.execute(['cp', '-R', fromdir, todir])
 
     def to_sxml(self):
diff --git a/jhbuild/versioncontrol/tarball.py b/jhbuild/versioncontrol/tarball.py
index e661cf7..f4733d8 100644
--- a/jhbuild/versioncontrol/tarball.py
+++ b/jhbuild/versioncontrol/tarball.py
@@ -313,7 +313,7 @@ class TarballBranch(Branch):
 
     def checkout(self, buildscript):
         if self.checkout_mode == 'clobber':
-            self._wipedir(buildscript)
+            self._wipedir(buildscript, self.raw_srcdir)
         if not os.path.exists(self.srcdir):
             self._download_and_unpack(buildscript)
         if self.quilt:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]