You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ke...@apache.org on 2012/11/10 00:29:08 UTC

svn commit: r1407692 - in /hive/trunk/testutils/ptest: Ssh.py hivetest.py

Author: kevinwilfong
Date: Fri Nov  9 23:29:08 2012
New Revision: 1407692

URL: http://svn.apache.org/viewvc?rev=1407692&view=rev
Log:
HIVE-3557. Access to external URLs in hivetest.py. (Ivan Gorbachev via kevinwilfong)

Modified:
    hive/trunk/testutils/ptest/Ssh.py
    hive/trunk/testutils/ptest/hivetest.py

Modified: hive/trunk/testutils/ptest/Ssh.py
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest/Ssh.py?rev=1407692&r1=1407691&r2=1407692&view=diff
==============================================================================
--- hive/trunk/testutils/ptest/Ssh.py (original)
+++ hive/trunk/testutils/ptest/Ssh.py Fri Nov  9 23:29:08 2012
@@ -42,7 +42,7 @@ class SSHConnection():
         pre = []
         pre.append('cd "{0}"'.format(self.pwd))
         for (e, v) in self.env.iteritems():
-            pre.append('export {0}="{1}"'.format(e, v))
+            pre.append('export {0}=\\"{1}\\"'.format(e, v))
         for p in self.path:
             pre.append('export PATH="{0}:${{PATH}}"'.format(p))
         pre.append(cmd)

Modified: hive/trunk/testutils/ptest/hivetest.py
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest/hivetest.py?rev=1407692&r1=1407691&r2=1407692&view=diff
==============================================================================
--- hive/trunk/testutils/ptest/hivetest.py (original)
+++ hive/trunk/testutils/ptest/hivetest.py Fri Nov  9 23:29:08 2012
@@ -99,6 +99,12 @@ def read_conf(config_file):
 
     # Setup of needed environmental variables and paths
 
+    # Proxy
+    if args.http_proxy is not None:
+      all_set.export('http_proxy', args.http_proxy + ':' + args.http_proxy_port)
+      all_set.export('https_proxy', args.http_proxy + ':' + args.http_proxy_port)
+      all_set.export('ANT_OPTS', get_ant_opts_proxy())
+
     # Ant
     all_set.export('ANT_HOME', ant_path)
     all_set.add_path(ant_path + '/bin')
@@ -114,6 +120,13 @@ def read_conf(config_file):
     remote_set.export('HIVE_HOME', host_code_path + '/build/dist')
     remote_set.add_path(host_code_path + '/build/dist/bin')
 
+def get_ant_opts_proxy():
+  cmd  = ' -Dhttp.proxyHost='  + args.http_proxy
+  cmd += ' -Dhttp.proxyPort='  + args.http_proxy_port
+  cmd += ' -Dhttps.proxyHost=' + args.http_proxy
+  cmd += ' -Dhttps.proxyPort=' + args.http_proxy_port
+  return cmd
+
 def get_ant():
     # Gets Ant 1.8.4 from one of Apache mirrors.
     print('\n-- Installing Ant 1.8.4\n')
@@ -133,19 +146,19 @@ def get_arc():
     if local.run('test -d "{0}"'.format(arc_path), warn_only = True,
             abandon_output = False) is None:
         local.run('mkdir -p "{0}"'.format(os.path.dirname(arc_path)))
-        local.run('git clone git://github.com/facebook/arcanist.git "{0}"'
+        local.run('git clone https://github.com/facebook/arcanist.git "{0}"'
                 .format(arc_path))
 
     if local.run('test -d "{0}"'.format(phutil_path), warn_only = True,
             abandon_output = False) is None:
         local.run('mkdir -p "{0}"'.format(os.path.dirname(phutil_path)))
-        local.run('git clone git://github.com/facebook/libphutil.git "{0}"'
+        local.run('git clone https://github.com/facebook/libphutil.git "{0}"'
                 .format(phutil_path))
 
     local.cd(arc_path)
-    local.run('git pull')
+    local.run('git pull https://github.com/facebook/arcanist.git')
     local.cd(phutil_path)
-    local.run('git pull')
+    local.run('git pull https://github.com/facebook/libphutil.git')
 
 def get_clean_hive():
     # Gets latest Hive from Apache Git repository and cleans the repository
@@ -153,15 +166,17 @@ def get_clean_hive():
     # `arc-setup` so the repo is ready to be used.
     print('\n-- Updating Hive repo\n')
 
+    local.cd(code_path)
     if local.run('test -d "{0}"'.format(code_path), warn_only = True,
-            abandon_output = False) is not None:
-      local.run('rm -rf "{0}"'.format(code_path))
-
-
-    local.run('mkdir -p "{0}"'.format(code_path))
-    local.run('svn checkout http://svn.apache.org/repos/asf/hive/trunk "{0}"'.format(code_path), quiet = True)
+            abandon_output = False) is None:
+      local.run('mkdir -p "{0}"'.format(os.path.dirname(code_path)))
+      local.run('git clone http://git.apache.org/hive.git "{0}"'.format(code_path))
+    else:
+      # Clean repo and checkout to t he last revision
+      local.run('git reset --hard HEAD')
+      local.run('git clean -dffx')
+      local.run('git pull')
     
-    local.cd(code_path)
     local.run('ant arc-setup')
 
 def copy_local_hive():
@@ -459,12 +474,13 @@ def overwrite_results():
 def save_svn_info():
   if args.svn_info:
     local.cd(master_base_path + '/trunk')
-    local.run('svn info > "{0}"'.format(report_path + '/svn-info'))
+    local.run('git show --summary > "{0}"'.format(report_path + '/svn-info'))
 
 def save_patch():
   if args.save_patch:
-    local.cd(master_base_path + '/trunk')
-    local.run('svn diff > "{0}"'.format(report_path + '/patch'))
+    local.cd(code_path)
+    local.run('git add --all')
+    local.run('git diff --no-prefix HEAD > "{0}"'.format(report_path + '/patch'))
   
 # -- Tasks that can be called from command line start here.
 
@@ -556,6 +572,10 @@ parser.add_argument('--svn-info', dest =
         help = 'Save result of `svn info` into ${report_path}/svn-info')
 parser.add_argument('--save-patch', dest = 'save_patch', action = 'store_true',
         help = 'Save applied patch into ${report_path}/patch')
+parser.add_argument('--http-proxy', dest = 'http_proxy',
+        help = 'Proxy host')
+parser.add_argument('--http-proxy-port', dest = 'http_proxy_port',
+        help = 'Proxy port')
 
 args = parser.parse_args()