-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreset_source.py
More file actions
83 lines (66 loc) · 2.62 KB
/
reset_source.py
File metadata and controls
83 lines (66 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
import glob
import os
import shutil
import subprocess
import sys
import omp
patches = {
('jdk8', 112): 'memory-profiling-jdk8-u112',
('jdk8', 122): 'memory-profiling-jdk8-u112',
('jdk8', 152): 'memory-profiling-jdk8-u112',
}
HGRCPATH = ':'.join([
os.path.abspath('jdk-hgrc'),
os.path.expanduser('~/.hgrc'),
])
def _env(**kwargs):
envcopy = os.environ.copy()
envcopy.update(kwargs)
return envcopy
def _hg(directory, command):
print(' '.join(['hg'] + command))
subprocess.check_output(['hg'] + command, cwd=directory, env=_env(HGRCPATH=HGRCPATH))
def _hgforest(directory, command):
print(' '.join(['./common/bin/hgforest.sh'] + command))
subprocess.check_output(['sh', './common/bin/hgforest.sh'] + command, cwd=directory, env=_env(HGRCPATH=HGRCPATH))
def _git(directory, command):
print(' '.join(['git'] + command))
subprocess.check_output(['git'] + command, cwd=directory)
def reset_openjdk(jdkv, jdku, jdkb):
patch = patches.get((jdkv, jdku), None)
if patch == None:
raise Exception('No patch for %su%s' % (jdkv, jdku))
base_revision = '%su%d-b%02d' % (jdkv, jdku, jdkb)
_hgforest('jdk8u', ['qpop', '-a'])
_hgforest('jdk8u', ['update', '-r', base_revision, '-C'])
_hgforest('jdk8u', ['purge'])
_hg('jdk8u/hotspot', ['qpush', patch])
if not os.path.exists('jdk8u/hotspot/.hg/patches'):
os.symlink(os.path.abspath('hotspot-patches'),
'jdk8u/hotspot/.hg/patches')
def reset_honest_profiler(base_revision):
_git('honest-profiler', ['reset', '--hard', base_revision])
_git('honest-profiler', ['clean', '-X', '-d', '-f'])
_git('honest-profiler', ['am'] + sorted(os.path.abspath(patch) for patch in glob.glob('honest-profiler-patches/*.patch')))
def write_configuration(jdvk, jdku, jdkb, bits):
conf = omp.configuration.Configuration()
conf.jdk = (jdvk, jdku, jdkb)
conf.bits = bits
conf.write('configuration.ini')
def clean_build_files(jdkv):
for directory in ['jdk8u/build',
'honest-profiler/build',
'honest-profiler/target',
'test/agent/target',
'test/honest-profiler/target']:
if os.path.exists(directory):
shutil.rmtree(directory)
if __name__ == '__main__':
(jdkv, jdku, jdkb) = (sys.argv[1], int(sys.argv[2]), int(sys.argv[3]))
write_configuration(jdkv, jdku, jdkb, 64)
reset_openjdk(jdkv, jdku, jdkb)
reset_honest_profiler('120e141aff9fada99fb6d423b512b6effae01a48')
print("Cleaning build artifacts")
clean_build_files(jdkv)
sys.exit(0)