Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 96edbb0

Browse files
Bug 1631382 - Update the Gentoo |mach bootstrap| implementation r=glandium
This fixes multiple issues: * It switches mobile builds from the Oracle JDK to OpenJDK and removes all the logic needed to download the former * It only installs the build dependencies required for building Firefox and stores them in the world file Differential Revision: https://phabricator.services.mozilla.com/D71539
1 parent 206dbc8 commit 96edbb0

File tree

1 file changed

+17
-75
lines changed

1 file changed

+17
-75
lines changed

python/mozboot/mozboot/gentoo.py

Lines changed: 17 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
WasiSysrootInstall,
1717
)
1818

19-
try:
20-
from urllib2 import urlopen
21-
except ImportError:
22-
from urllib.request import urlopen
23-
24-
import re
25-
import subprocess
26-
2719

2820
class GentooBootstrapper(
2921
ClangStaticAnalysisInstall,
@@ -43,7 +35,7 @@ def __init__(self, version, dist_id, **kwargs):
4335
self.dist_id = dist_id
4436

4537
def install_system_packages(self):
46-
self.run_as_root(['emerge', '--noreplace', '--quiet', 'nodejs'])
38+
self.ensure_system_packages()
4739

4840
def install_browser_packages(self):
4941
self.ensure_browser_packages()
@@ -57,77 +49,27 @@ def install_mobile_android_packages(self):
5749
def install_mobile_android_artifact_mode_packages(self):
5850
self.ensure_mobile_android_packages(artifact_mode=True)
5951

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+
6058
def ensure_browser_packages(self, artifact_mode=False):
6159
# 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+
])
10369

10470
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
12871
self.run_as_root(['emerge', '--noreplace', '--quiet',
129-
'--autounmask-continue', '--ask',
130-
'dev-java/oracle-jdk-bin'])
72+
'dev-java/openjdk-bin'])
13173

13274
self.ensure_java()
13375
from mozboot import android

0 commit comments

Comments
 (0)