Allow source unpacking without a cleaning list

Use member values for source downloading functions
This commit is contained in:
Eloston
2016-07-20 21:17:59 -07:00
parent 52159ebb95
commit d521eeccc4
2 changed files with 16 additions and 11 deletions

View File

@@ -47,12 +47,14 @@ class DebianPlatform(generic.GenericPlatform):
def generate_debian_tar_xz(self, tar_xz_path):
pass
def setup_chromium_source(cleaning_list=pathlib.Path("cleaning_list"), debian_cleaning_list=(PLATFORM_RESOURCES / pathlib.Path("cleaning_list")), **kwargs):
def setup_chromium_source(self, cleaning_list=pathlib.Path("cleaning_list"), debian_cleaning_list=(PLATFORM_RESOURCES / pathlib.Path("cleaning_list")), **kwargs):
tmp = tempfile.SpooledTemporaryFile(mode="w+")
with cleaning_list.open() as f:
tmp.write(f.read())
with debian_cleaning_list.open() as f:
tmp.write(f.read())
if not cleaning_list is None:
with cleaning_list.open() as f:
tmp.write(f.read())
if not debian_cleaning_list is None:
with debian_cleaning_list.open() as f:
tmp.write(f.read())
tmp.seek(0)
tmp.open = lambda: tmp
super(DebianPlatform, self).setup_chromium_source(cleaning_list=tmp, **kwargs)

View File

@@ -88,19 +88,19 @@ class GenericPlatform:
else:
self.logger.warning("Hash algorithm '{}' not available. Skipping...".format(hash_line[0]))
def _download_source_archive(self, archive_path):
def _download_source_archive(self):
'''
Downloads the original Chromium source code in .tar.xz format
'''
download_url = "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-{version}.tar.xz".format(version=self.version)
with urllib.request.urlopen(download_url) as response:
with archive_path.open("wb") as f:
with self.sourcearchive.open("wb") as f:
shutil.copyfileobj(response, f)
def _download_source_hashes(self, hashes_path):
def _download_source_hashes(self):
hashes_url = "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-{version}.tar.xz.hashes".format(version=self.version)
with urllib.request.urlopen(hashes_url) as response:
with hashes_path.open("wb") as f:
with self.sourcearchive_hashes.open("wb") as f:
shutil.copyfileobj(response, f)
def _extract_source_archive(self, cleaning_list):
@@ -277,8 +277,11 @@ class GenericPlatform:
if extract_archive:
self.logger.info("Extracting source archive into building sandbox...")
with cleaning_list.open() as f:
self._extract_source_archive([x for x in f.read().splitlines() if x != ""])
if cleaning_list is None:
self._extract_source_archive(list())
else:
with cleaning_list.open() as f:
self._extract_source_archive([x for x in f.read().splitlines() if x != ""])
def setup_build_sandbox(self, run_domain_substitution=True, domain_regexes=pathlib.Path("domain_regex_list"), domain_sub_list=pathlib.Path("domain_substitution_list")):
'''