comparison mx/mx_graal.py @ 16599:89be7c4db12c

made sha1 signatures mandatory for libraries; made libraries for all downloading performed by commands in mx_graal
author Doug Simon <doug.simon@oracle.com>
date Mon, 28 Jul 2014 13:55:33 +0200
parents a0f3688ce052
children 6e7311d571ff
comparison
equal deleted inserted replaced
16598:edf653f51521 16599:89be7c4db12c
1479 if mx.get_os() == 'windows': 1479 if mx.get_os() == 'windows':
1480 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe') 1480 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe')
1481 else: 1481 else:
1482 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer') 1482 executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer')
1483 1483
1484 archive = join(libpath, 'c1visualizer_2014-04-22.zip') 1484 # Check whether the current C1Visualizer installation is the up-to-date
1485 if not exists(executable) or not exists(archive): 1485 if exists(executable) and not exists(mx.library('C1VISUALIZER_DIST').get_path(resolve=False)):
1486 if not exists(archive): 1486 mx.log('Updating C1Visualizer')
1487 mx.download(archive, ['https://java.net/downloads/c1visualizer/c1visualizer_2014-04-22.zip']) 1487 shutil.rmtree(join(libpath, 'c1visualizer'))
1488
1489 archive = mx.library('C1VISUALIZER_DIST').get_path(resolve=True)
1490
1491 if not exists(executable):
1488 zf = zipfile.ZipFile(archive, 'r') 1492 zf = zipfile.ZipFile(archive, 'r')
1489 zf.extractall(libpath) 1493 zf.extractall(libpath)
1490 1494
1491 if not exists(executable): 1495 if not exists(executable):
1492 mx.abort('C1Visualizer binary does not exist: ' + executable) 1496 mx.abort('C1Visualizer binary does not exist: ' + executable)
1825 flavor = 'intel' 1829 flavor = 'intel'
1826 if 'att' in args: 1830 if 'att' in args:
1827 flavor = 'att' 1831 flavor = 'att'
1828 lib = mx.add_lib_suffix('hsdis-' + _arch()) 1832 lib = mx.add_lib_suffix('hsdis-' + _arch())
1829 path = join(_graal_home, 'lib', lib) 1833 path = join(_graal_home, 'lib', lib)
1834
1835 sha1s = {
1836 'att/hsdis-amd64.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72',
1837 'att/hsdis-amd64.so' : '58919ba085d4ef7a513f25bae75e7e54ee73c049',
1838 'intel/hsdis-amd64.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30',
1839 'intel/hsdis-amd64.so' : '844ed9ffed64fe9599638f29a8450c50140e3192',
1840 'intel/hsdis-amd64.dylib' : 'fdb13ef0d7d23d93dacaae9c98837bea0d4fc5a2',
1841 }
1842
1830 if not exists(path): 1843 if not exists(path):
1831 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) 1844 flavoredLib = flavor + "/" + lib
1845 sha1 = sha1s[flavoredLib]
1846 sha1path = path + '.sha1'
1847 mx.download_file_with_sha1('hsdis', path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavoredLib], sha1, sha1path, True, True, sources=False)
1832 if copyToDir is not None and exists(copyToDir): 1848 if copyToDir is not None and exists(copyToDir):
1833 shutil.copy(path, copyToDir) 1849 shutil.copy(path, copyToDir)
1834 1850
1835 def hcfdis(args): 1851 def hcfdis(args):
1836 """disassemble HexCodeFiles embedded in text files 1852 """disassemble HexCodeFiles embedded in text files
1842 parser.add_argument('-m', '--map', help='address to symbol map applied to disassembler output') 1858 parser.add_argument('-m', '--map', help='address to symbol map applied to disassembler output')
1843 parser.add_argument('files', nargs=REMAINDER, metavar='files...') 1859 parser.add_argument('files', nargs=REMAINDER, metavar='files...')
1844 1860
1845 args = parser.parse_args(args) 1861 args = parser.parse_args(args)
1846 1862
1847 path = join(_graal_home, 'lib', 'hcfdis-1.jar') 1863 path = mx.library('HCFDIS').get_path(resolve=True)
1848 if not exists(path): 1864 mx.run_java(['-cp', path, 'com.oracle.max.hcfdis.HexCodeFileDis'] + args.files)
1849 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-2.jar'])
1850 mx.run_java(['-jar', path] + args.files)
1851 1865
1852 if args.map is not None: 1866 if args.map is not None:
1853 addressRE = re.compile(r'0[xX]([A-Fa-f0-9]+)') 1867 addressRE = re.compile(r'0[xX]([A-Fa-f0-9]+)')
1854 with open(args.map) as fp: 1868 with open(args.map) as fp:
1855 lines = fp.read().splitlines() 1869 lines = fp.read().splitlines()
1902 def isGraalEnabled(vm): 1916 def isGraalEnabled(vm):
1903 return vm != 'original' and not vm.endswith('nograal') 1917 return vm != 'original' and not vm.endswith('nograal')
1904 1918
1905 def jol(args): 1919 def jol(args):
1906 """Java Object Layout""" 1920 """Java Object Layout"""
1907 jolurl = "http://lafo.ssw.uni-linz.ac.at/truffle/jol/jol-internals.jar" 1921 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True)
1908 joljar = "lib/jol-internals.jar"
1909 if not exists(joljar):
1910 mx.download(joljar, [jolurl])
1911
1912 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) 1922 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s))
1913 if len(candidates) > 10: 1923 if len(candidates) > 10:
1914 print "Found %d candidates. Please be more precise." % (len(candidates)) 1924 print "Found %d candidates. Please be more precise." % (len(candidates))
1915 return 1925 return
1916 1926
2052 else: 2062 else:
2053 findbugsLib = join(_graal_home, 'lib', 'findbugs-3.0.0') 2063 findbugsLib = join(_graal_home, 'lib', 'findbugs-3.0.0')
2054 if not exists(findbugsLib): 2064 if not exists(findbugsLib):
2055 tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=_graal_home) 2065 tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=_graal_home)
2056 try: 2066 try:
2057 findbugsDist = join(tmp, 'findbugs.zip') 2067 findbugsDist = mx.library('FINDBUGS_DIST').get_path(resolve=True)
2058 mx.download(findbugsDist, ['http://lafo.ssw.uni-linz.ac.at/graal-external-deps/findbugs-3.0.0.zip', 'http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0.zip'])
2059 with zipfile.ZipFile(findbugsDist) as zf: 2068 with zipfile.ZipFile(findbugsDist) as zf:
2060 candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')] 2069 candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')]
2061 assert len(candidates) == 1, candidates 2070 assert len(candidates) == 1, candidates
2062 libDirInZip = os.path.dirname(candidates[0]) 2071 libDirInZip = os.path.dirname(candidates[0])
2063 zf.extractall(tmp) 2072 zf.extractall(tmp)