def fetch(self, output):
dl_path = self.get_latest_tarball()
raw_path, _ = urllib.urlretrieve(dl_path)
# The downloaded file is a gzip'd tarball.
extract_path = self._make_temp_directory("rootfetch-apple-extracted")
sh.tar("-xzv", "-f", raw_path, "-C", extract_path, strip_components=1)
# We now have a directory with all the apple files. We need to find the
# roots directory, parse out all the different formats, then generate a
# single file that has PEMs in it.
certificates_path = os.path.join(extract_path, "certificates", "roots")
for f in os.listdir(certificates_path):
full_path = os.path.join(certificates_path, f)
if not os.path.isfile(full_path):
continue
pem = self.make_pem(full_path)
output.write("# ")
output.write(f)
output.write("\n")
output.write("\n".join(pem))
output.write("\n\n")
评论列表
文章目录