Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
), "Bad signature for cheksums"
# openwrt-imagebuilder-ath79-generic.Linux-x86_64.tar.xz
ib_search = re.search(
r"^(.{64}) \*(openwrt-imagebuilder-.+?\.Linux-x86_64\.tar\.xz)$",
sums_file.read_text(),
re.MULTILINE,
)
assert ib_search, "No ImageBuilder in checksums found"
ib_hash, ib_archive = ib_search.groups()
download_file(ib_archive)
assert ib_hash == get_file_hash(
cache / ib_archive
), "Wrong ImageBuilder archive checksum"
(cache / subtarget).mkdir(parents=True, exist_ok=True)
extract_archive = subprocess.run(
["tar", "--strip-components=1", "-xf", ib_archive, "-C", subtarget],
cwd=cache,
)
assert not extract_archive.returncode, "Extracting ImageBuilder archive failed"
log.debug(f"Extracted TAR {ib_archive}")
(cache / ib_archive).unlink()
extra_repos = request["version_data"].get("extra_repos")