Skip to content
Snippets Groups Projects

try to solve problems from server change: https, shorter URL, redirects

Merged Andre Sailer requested to merge sailer/lcgcmake:curlFollowRedirect into master
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
+ 4
4
@@ -164,7 +164,7 @@ class InstallProcess:
url = str(alturl)
if not checkURL(url):
raise RuntimeError("URL {0} not found.".format(url))
p = subprocess.Popen(['curl', '-s', url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(['curl', '-L', '-s', url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode == 0:
return stdout.strip()
@@ -181,7 +181,7 @@ class InstallProcess:
p = subprocess.Popen(['find', url.replace('file://', ''), '-type', 'f', '-name', 'LCG_*.txt'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
p = subprocess.Popen(['curl', '-s', url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(['curl', '-L', '-s', url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode == 0:
if "file://" in url:
@@ -301,7 +301,7 @@ class InstallProcess:
filename = os.path.join(self.alternativeurl, package.getPackageFilename())
if self.nightly and not checkURL(filename):
filename = os.path.join(ReleasesURL, package.getPackageFilename())
p = subprocess.Popen('curl -s {0} | tar {1} -C {2} -f -'.format(filename, opts, self.prefix),
p = subprocess.Popen('curl -L -s {0} | tar {1} -C {2} -f -'.format(filename, opts, self.prefix),
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = p.communicate()
@@ -320,7 +320,7 @@ class InstallProcess:
return True
else:
print " ERROR: cannot properly run the following command:"
print ' curl -s', filename, ' | tar', opts, '-C', self.prefix, '-f', '-'
print ' curl -L -s', filename, ' | tar', opts, '-C', self.prefix, '-f', '-'
print stderr
if len(stdout.strip()) != 0:
tarprefix = sorted(stdout.strip().split('\n'))[0]
Loading