[jhbuild] make update possible when no-network is passed but a dvcs mirror dir is used



commit 931aefa8ff44bf268e705c3557028f71d35e0039
Author: Frédéric Péters <fpeters 0d be>
Date:   Thu Jun 11 22:29:53 2009 +0200

    make update possible when no-network is passed but a dvcs mirror dir is used
    
    (GNOME bug 583969)

 jhbuild/modtypes/__init__.py       |    2 +-
 jhbuild/versioncontrol/__init__.py |    4 ++++
 jhbuild/versioncontrol/git.py      |   12 ++++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index b8e4637..bb90506 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -208,7 +208,7 @@ class Package:
 
     def skip_checkout(self, buildscript, last_phase):
         # skip the checkout stage if the nonetwork flag is set
-        if buildscript.config.nonetwork:
+        if not self.branch.may_checkout(buildscript):
             if self.check_build_policy(buildscript) == self.PHASE_DONE:
                 raise SkipToEnd()
             return True
diff --git a/jhbuild/versioncontrol/__init__.py b/jhbuild/versioncontrol/__init__.py
index 5e1f5df..87de336 100644
--- a/jhbuild/versioncontrol/__init__.py
+++ b/jhbuild/versioncontrol/__init__.py
@@ -104,6 +104,10 @@ class Branch:
         else:
             return os.path.join(self.checkoutroot, os.path.basename(self.module))
 
+    def may_checkout(self, buildscript):
+        if buildscript.config.nonetwork:
+            return False
+        return True
 
     def checkout(self, buildscript):
         """Checkout or update the given source directory.
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index b2db93a..8c6c89f 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -203,6 +203,8 @@ class GitBranch(Branch):
     def update_dvcs_mirror(self, buildscript):
         if not self.config.dvcs_mirror_dir:
             return
+        if self.config.nonetwork:
+            return
 
         mirror_dir = os.path.join(self.config.dvcs_mirror_dir,
                 os.path.basename(self.module) + '.git')
@@ -308,6 +310,10 @@ class GitBranch(Branch):
 
         self._update_submodules(buildscript)
 
+    def may_checkout(self, buildscript):
+        if buildscript.config.nonetwork and not buildscript.config.dvcs_mirror_dir:
+            return False
+        return True
 
     def checkout(self, buildscript):
         if not inpath('git', os.environ['PATH'].split(os.pathsep)):
@@ -342,6 +348,9 @@ class GitSvnBranch(GitBranch):
         GitBranch.__init__(self, repository, module, "", checkoutdir, branch="git-svn")
         self.revision = revision
 
+    def may_checkout(self, buildscript):
+        return Branch.may_checkout(self, buildscript)
+
     def _get_externals(self, buildscript, branch="git-svn"):
         cwd = self.get_checkoutdir()
         try:
@@ -493,6 +502,9 @@ class GitCvsBranch(GitBranch):
         GitBranch.__init__(self, repository, module, "", checkoutdir)
         self.revision = revision
 
+    def may_checkout(self, buildscript):
+        return Branch.may_checkout(self, buildscript)
+
     def branchname(self):
         for b in ['remotes/' + str(self.branch), self.branch, 'trunk', 'master']:
             if self.branch_exist(b):



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