mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-01 03:53:45 +08:00
build nightly casync build in jenkins (#31880)
* casync in jenkins * rename some stuff, add a readme * slightly better names * clean * more cleanup * cleaner * release3 staging too * always rm the signed version * cleanups * in build dir * better name * simpler * more * divider * built * build * and contains * add channel description * and git branches * and build required * move this up * these are terms * updates * 3/3x * bullets * wording * version metadata * git type * more channel -> release * more build * just release * more channel to release * also fix jenkins * use build_metadata * fix normailzed * also normalized * and here * use build_metadata * dont commit that * don't touch the git stuff * branch * don't need that * or that * improved names * build_metadata * use this instead * fix * build * test nightly build again * fix * fixes * Revert "test nightly build again" This reverts commit be5e7aa7089bfc0947c9b2b484d0277c109ee089.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import dataclasses
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
from openpilot.system.version import BUILD_METADATA_FILENAME, BuildMetadata
|
||||
|
||||
|
||||
CASYNC_ARGS = ["--with=symlinks", "--with=permissions"]
|
||||
CASYNC_FILES = [BUILD_METADATA_FILENAME, ".caexclude"]
|
||||
|
||||
|
||||
def run(cmd):
|
||||
return subprocess.check_output(cmd)
|
||||
|
||||
|
||||
def get_exclude_set(path) -> set[str]:
|
||||
exclude_set = set(CASYNC_FILES)
|
||||
|
||||
for file in path.rglob("*"):
|
||||
if file.is_file() or file.is_symlink():
|
||||
|
||||
while file.resolve() != path.resolve():
|
||||
exclude_set.add(str(file.relative_to(path)))
|
||||
|
||||
file = file.parent
|
||||
|
||||
return exclude_set
|
||||
|
||||
|
||||
def create_caexclude_file(path: pathlib.Path):
|
||||
with open(path / ".caexclude", "w") as f:
|
||||
# exclude everything except the paths already in the release
|
||||
f.write("*\n")
|
||||
f.write(".*\n")
|
||||
|
||||
for file in sorted(get_exclude_set(path)):
|
||||
f.write(f"!{file}\n")
|
||||
|
||||
|
||||
def create_build_metadata_file(path: pathlib.Path, build_metadata: BuildMetadata, channel: str):
|
||||
with open(path / BUILD_METADATA_FILENAME, "w") as f:
|
||||
build_metadata_dict = dataclasses.asdict(build_metadata)
|
||||
build_metadata_dict["channel"] = channel
|
||||
build_metadata_dict["openpilot"].pop("is_dirty") # this is determined at runtime
|
||||
f.write(json.dumps(build_metadata_dict))
|
||||
|
||||
|
||||
def create_casync_release(target_dir: pathlib.Path, output_dir: pathlib.Path, channel: str):
|
||||
caidx_file = output_dir / f"{channel}.caidx"
|
||||
run(["casync", "make", *CASYNC_ARGS, caidx_file, target_dir])
|
||||
digest = run(["casync", "digest", *CASYNC_ARGS, target_dir]).decode("utf-8").strip()
|
||||
return digest, caidx_file
|
||||
Reference in New Issue
Block a user