jhbuild r2328 - in trunk: . jhbuild



Author: fpeters
Date: Wed Sep  3 08:42:06 2008
New Revision: 2328
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2328&view=rev

Log:
* jhbuild/main.py, jhbuild/moduleset.py: display an informative message
to users editing their moduleset locally while missing
use_local_modulesets in their jhbuildrc.



Modified:
   trunk/ChangeLog
   trunk/jhbuild/main.py
   trunk/jhbuild/moduleset.py

Modified: trunk/jhbuild/main.py
==============================================================================
--- trunk/jhbuild/main.py	(original)
+++ trunk/jhbuild/main.py	Wed Sep  3 08:42:06 2008
@@ -31,6 +31,8 @@
 import jhbuild.config
 import jhbuild.commands
 from jhbuild.errors import UsageError, FatalError
+from jhbuild.utils.cmds import get_output
+from jhbuild.moduleset import warn_local_modulesets
 
 
 if sys.platform == 'darwin':
@@ -125,6 +127,8 @@
         command = args[0]
         args = args[1:]
 
+    warn_local_modulesets(config)
+
     try:
         rc = jhbuild.commands.run(command, config, args)
     except UsageError, exc:

Modified: trunk/jhbuild/moduleset.py
==============================================================================
--- trunk/jhbuild/moduleset.py	(original)
+++ trunk/jhbuild/moduleset.py	Wed Sep  3 08:42:06 2008
@@ -23,7 +23,7 @@
 import sys
 import urlparse
 
-from jhbuild.errors import UsageError, FatalError, DependencyCycleError
+from jhbuild.errors import UsageError, FatalError, DependencyCycleError, CommandError
 
 try:
     import xml.dom.minidom
@@ -33,6 +33,7 @@
 from jhbuild import modtypes
 from jhbuild.versioncontrol import get_repo_type
 from jhbuild.utils import httpcache
+from jhbuild.utils.cmds import get_output
 
 __all__ = ['load', 'load_tests']
 
@@ -366,3 +367,41 @@
             moduleset.add(module)
 
     return moduleset
+
+def warn_local_modulesets(config):
+    if config.use_local_modulesets:
+        return
+
+    moduleset_local_path = os.path.join(os.path.dirname(__file__), '..', 'modulesets')
+    if not os.path.exists(moduleset_local_path):
+        # moduleset-less checkout
+        return
+
+    if not os.path.exists(os.path.join(moduleset_local_path, '.svn')):
+        # checkout was not done via subversion
+        return
+
+    if type(config.moduleset) == type([]):
+        modulesets = config.moduleset
+    else:
+        modulesets = [ config.moduleset ]
+
+    if not [x for x in modulesets if x.find('/') == -1]:
+        # all modulesets have a slash; they are URI
+        return
+
+    try:
+        svn_status = get_output(['svn', 'status'], cwd=moduleset_local_path)
+    except CommandError:
+        # svn error, ignore
+        return
+
+    if not [x for x in svn_status.splitlines() if x.startswith('M')]:
+        # no locally modified moduleset
+        return
+
+    print >> sys.stderr, uencode(
+            _('I: modulesets were edited locally but jhbuild is configured '\
+              'to get them from subversion, perhaps you need to add '\
+              'use_local_modulesets = True to your .jhbuildrc.'))
+



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