diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/' DBRToolsDev
authorMattD <mattd@symbian.org>
Sun, 13 Jun 2010 20:39:03 +0100
branchDBRToolsDev
changeset 285 6a928cf9e181
parent 284 0792141abac7
diffenv - Added some basic support for diffing with zipped builds over http (such as the internal foundation builds). for example: dbr diffenv 'http://builds.symbian.org/SF_builds/symbian3/builds/FCL/symbian3_FCL.single.555/'
dbrtools/dbr/dbrenv.py
dbrtools/dbr/dbrutils.py
dbrtools/dbr/diffenv.py
--- a/dbrtools/dbr/dbrenv.py	Sun Jun 13 18:33:42 2010 +0100
+++ b/dbrtools/dbr/dbrenv.py	Sun Jun 13 20:39:03 2010 +0100
@@ -16,6 +16,7 @@
 #I'm using the existing stuff as helpers until things get relocated...
 import os.path
 import glob
+import re
 
 import dbrutils
 import dbrbaseline
@@ -35,6 +36,9 @@
   if(os.path.exists(os.path.join(location,'build_md5.zip'))):
     print 'loading zipped environment'
     return DBRZippedEnv(location)
+  if(re.match('http://.+',location, re.IGNORECASE)):  
+    print 'loading remote zipped environment'
+    return DBRZippedEnv(location)
   if(os.path.exists(os.path.join(location,dbrutils.patch_path_internal()))): #should do something more fun with creating a basleine if we have MD5s
     print 'loading new env...warning: this is only here for compatibility'
     return DBRNewLocalEnv(location)
--- a/dbrtools/dbr/dbrutils.py	Sun Jun 13 18:33:42 2010 +0100
+++ b/dbrtools/dbr/dbrutils.py	Sun Jun 13 20:39:03 2010 +0100
@@ -19,6 +19,9 @@
 import string
 import shutil
 import time
+import urllib
+from urlparse import urljoin
+
 from os.path import join, isfile, stat
 from stat import *
 
@@ -99,16 +102,20 @@
 
 def getzippedDB(location):
     db = dict()
+    temp_dir = tempfile.mkdtemp()
     md5zip = os.path.join(location,'build_md5.zip')
+    if(re.match('^http',location, re.IGNORECASE)):
+      md5zip = os.path.join(temp_dir,'build_md5.zip')
+      url = '%s%s' % (location,'build_md5.zip')
+      res = urllib.urlretrieve(url,md5zip) 
     print md5zip 
-    temp_dir = tempfile.mkdtemp()
     print temp_dir 
     if(os.path.exists(md5zip)):
       files = set();
       files.add('*')
       extractfromzip(files,md5zip,temp_dir)
       globsearch = os.path.join(temp_dir, os.path.join(patch_path_internal(),'*.md5'))
-      print globsearch 
+#      print globsearch 
       hashes = glob.glob(globsearch)
       for file in hashes:
 #          print 'Reading: %s\n' % file
--- a/dbrtools/dbr/diffenv.py	Sun Jun 13 18:33:42 2010 +0100
+++ b/dbrtools/dbr/diffenv.py	Sun Jun 13 20:39:03 2010 +0100
@@ -37,8 +37,10 @@
       
 def help():
   print "Compares two environments"
+  print "Locations can be local environments or zipped environments available via UNC or http paths."
   print "Usage:"
-  print "\tdbr diffenv <drive1> (<drive2>)"
+  print "\tdbr diffenv <location1> (<location2>)"
+  
     
   
 def summary():