MCPcopy Index your code
hub / github.com/ClangBuiltLinux/boot-utils / download_and_extract_buildroot

Function download_and_extract_buildroot

buildroot/rebuild.py:80–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78
79
80def download_and_extract_buildroot():
81 if SRC_FOLDER.exists():
82 shutil.rmtree(SRC_FOLDER)
83 SRC_FOLDER.mkdir(parents=True)
84
85 tarball = Path(ROOT_FOLDER, f"buildroot-{BUILDROOT_VERSION}.tar.gz")
86 if not tarball.exists():
87 curl_cmd = [
88 'curl',
89 '-LSs',
90 '-o',
91 tarball,
92 f"https://buildroot.org/downloads/{tarball.name}",
93 ]
94 subprocess.run(curl_cmd, check=True)
95
96 sha256_cmd = ['sha256sum', '--quiet', '-c', f"{tarball.name}.sha256"]
97 subprocess.run(sha256_cmd, check=True, cwd=ROOT_FOLDER)
98
99 tar_cmd = ['tar', '-C', SRC_FOLDER, '--strip-components=1', '-axf', tarball]
100 subprocess.run(tar_cmd, check=True)
101
102 if patches := list(ROOT_FOLDER.glob('*.patch')):
103 for patch in patches:
104 patch_cmd = [
105 'patch',
106 '--directory',
107 SRC_FOLDER,
108 '--input',
109 patch,
110 '--strip',
111 '1',
112 ]
113 try:
114 subprocess.run(patch_cmd, check=True)
115 except subprocess.CalledProcessError as err:
116 msg = f"{patch} did not apply to Buildroot {BUILDROOT_VERSION}, does it need to be updated?"
117 raise RuntimeError(msg) from err
118
119
120def release_images():

Callers 1

mainFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected