Commit 12706228 authored by Yingjie Xu's avatar Yingjie Xu

Revert "Uses binary cache."

This reverts commit f18c3b61.
parent f18c3b61
......@@ -20,14 +20,6 @@ import re
import shutil
import urlparse
import traceback
import ctypes
from ctypes import util
SYS, _, KERNEL, _, ARCH = os.uname()
LIBC = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
LIBC_VERSION_FUN = LIBC.gnu_get_libc_version
LIBC_VERSION_FUN.restype = ctypes.c_char_p
LIBC_VERSION = "libc-%s" % LIBC_VERSION_FUN()
try:
try:
......@@ -84,7 +76,7 @@ def get_directory_key(url):
@fallback_call
def download_network_cached(dir_url, cache_url, path, url, logger,
signature_certificate_list, md5sum=None, binary_mode=False):
signature_certificate_list, md5sum=None):
"""Downloads from a network cache provider
If something fail (providor be offline, or hash_string fail), we ignore
......@@ -100,12 +92,8 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
if md5sum is None:
md5sum = _get_md5_from_url(url)
if binary_mode:
directory_key = "binary-%s-%s-%s" % \
(os.path.basename(path), SYS, ARCH)
else:
directory_key = get_directory_key(url)
directory_key = get_directory_key(url)
url = os.path.basename(url)
if len(signature_certificate_list) == 0:
......@@ -120,7 +108,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
logger.info('Downloading %s from network cache.' % url)
try:
file_descriptor = nc.select(directory_key, binary_mode=binary_mode)
file_descriptor = nc.select(directory_key)
f = open(path, 'w+b')
try:
......@@ -143,7 +131,7 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
@fallback_call
def upload_network_cached(dir_url, cache_url, external_url, path, logger,
signature_private_key_file, shacache_cert_file, shacache_key_file,
shadir_cert_file, shadir_key_file, binary_mode=False):
shadir_cert_file, shadir_key_file):
"""Upload file to a network cache server"""
if not LIBNETWORKCACHE_ENABLED:
return False
......@@ -153,19 +141,11 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
logger.info('Uploading %s into network cache.' % external_url)
if binary_mode:
file_name = get_filename_from_url(path)
directory_key = "binary-%s-%s-%s" % \
(file_name, SYS, ARCH)
kw = dict(file_name=file_name,
kernel=KERNEL,
libc_version=LIBC_VERSION,
urlmd5=hashlib.md5(external_url).hexdigest())
else:
file_name = get_filename_from_url(external_url)
directory_key = get_directory_key(external_url)
kw = dict(file_name=file_name,
urlmd5=hashlib.md5(external_url).hexdigest())
file_name = get_filename_from_url(external_url)
directory_key = get_directory_key(external_url)
kw = dict(file_name=file_name,
urlmd5=hashlib.md5(external_url).hexdigest())
f = open(path, 'r')
# convert '' into None in order to call nc nicely
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment