16
16
WasiSysrootInstall ,
17
17
)
18
18
19
- try :
20
- from urllib2 import urlopen
21
- except ImportError :
22
- from urllib .request import urlopen
23
-
24
- import re
25
- import subprocess
26
-
27
19
28
20
class GentooBootstrapper (
29
21
ClangStaticAnalysisInstall ,
@@ -43,7 +35,7 @@ def __init__(self, version, dist_id, **kwargs):
43
35
self .dist_id = dist_id
44
36
45
37
def install_system_packages (self ):
46
- self .run_as_root ([ 'emerge' , '--noreplace' , '--quiet' , 'nodejs' ] )
38
+ self .ensure_system_packages ( )
47
39
48
40
def install_browser_packages (self ):
49
41
self .ensure_browser_packages ()
@@ -57,77 +49,27 @@ def install_mobile_android_packages(self):
57
49
def install_mobile_android_artifact_mode_packages (self ):
58
50
self .ensure_mobile_android_packages (artifact_mode = True )
59
51
52
+ def ensure_system_packages (self ):
53
+ self .run_as_root (['emerge' , '--noreplace' , '--quiet' ,
54
+ 'app-arch/zip' ,
55
+ 'sys-devel/autoconf:2.1'
56
+ ])
57
+
60
58
def ensure_browser_packages (self , artifact_mode = False ):
61
59
# TODO: Figure out what not to install for artifact mode
62
- self .run_as_root (['emerge' , '--onlydeps' , '--quiet' , 'firefox' ])
63
- self .run_as_root (['emerge' , '--noreplace' , '--quiet' , 'gtk+' ])
64
-
65
- @staticmethod
66
- def _get_distdir ():
67
- # Obtain the path held in the DISTDIR portage variable
68
- output = subprocess .check_output (
69
- ['emerge' , '--info' ], universal_newlines = True )
70
- match = re .search ('^DISTDIR="(?P<distdir>.*)"$' , output , re .MULTILINE )
71
- return match .group ('distdir' )
72
-
73
- @staticmethod
74
- def _get_jdk_filename (emerge_output ):
75
- match = re .search (r'^ \* *(?P<tarball>jdk-.*-linux-.*.tar.gz)$' ,
76
- emerge_output , re .MULTILINE )
77
-
78
- return match .group ('tarball' )
79
-
80
- @staticmethod
81
- def _get_jdk_page_urls (emerge_output ):
82
- urls = re .findall (r'^ \* *(https?://.*\.html)$' , emerge_output ,
83
- re .MULTILINE )
84
- return [re .sub ('^http://' , 'https://' , url ) for url in urls ]
85
-
86
- @staticmethod
87
- def _get_jdk_url (filename , urls ):
88
- for url in urls :
89
- contents = urlopen (url ).read ()
90
- match = re .search ('.*(?P<url>https?://.*' + filename + ')' ,
91
- contents , re .MULTILINE )
92
- if match :
93
- url = match .group ('url' )
94
- return re .sub ('^http://' , 'https://' , url )
95
-
96
- raise Exception ("Could not find the JDK tarball URL" )
97
-
98
- def _fetch_jdk_tarball (self , filename , url ):
99
- distdir = self ._get_distdir ()
100
- cookie = 'Cookie: oraclelicense=accept-securebackup-cookie'
101
- self .run_as_root (['wget' , '--no-verbose' , '--show-progress' , '-c' , '-O' ,
102
- distdir + '/' + filename , '--header' , cookie , url ])
60
+ self .run_as_root (['emerge' ,
61
+ '--oneshot' , '--noreplace' , '--quiet' , '--newuse' ,
62
+ 'dev-lang/yasm' ,
63
+ 'dev-libs/dbus-glib' ,
64
+ 'media-sound/pulseaudio' ,
65
+ 'x11-libs/gtk+:2' ,
66
+ 'x11-libs/gtk+:3' ,
67
+ 'x11-libs/libXt'
68
+ ])
103
69
104
70
def ensure_mobile_android_packages (self , artifact_mode = False ):
105
- # For downloading the Oracle JDK, Android SDK and NDK.
106
- self .run_as_root (['emerge' , '--noreplace' , '--quiet' , 'wget' ])
107
-
108
- # Find the JDK file name and URL(s)
109
- try :
110
- output = self .check_output (['emerge' , '--pretend' , '--fetchonly' ,
111
- 'oracle-jdk-bin' ],
112
- env = None ,
113
- stderr = subprocess .STDOUT ,
114
- universal_newlines = True )
115
- except subprocess .CalledProcessError as e :
116
- output = e .output
117
-
118
- jdk_filename = self ._get_jdk_filename (output )
119
- jdk_page_urls = self ._get_jdk_page_urls (output )
120
- jdk_url = self ._get_jdk_url (jdk_filename , jdk_page_urls )
121
-
122
- # Fetch the Oracle JDK since portage can't fetch it on its own
123
- self ._fetch_jdk_tarball (jdk_filename , jdk_url )
124
-
125
- # Install the Oracle JDK. We explicitly prompt the user to accept the
126
- # changes because this command might need to modify the portage
127
- # configuration files and doing so without user supervision is dangerous
128
71
self .run_as_root (['emerge' , '--noreplace' , '--quiet' ,
129
- '--autounmask-continue' , '--ask' ,
130
- 'dev-java/oracle-jdk-bin' ])
72
+ 'dev-java/openjdk-bin' ])
131
73
132
74
self .ensure_java ()
133
75
from mozboot import android
0 commit comments