mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 23:33:58 +08:00
agnos casync script improvements (#32156)
* build agnos * include path * cleanup * rm this * test it * all agnos partitions are AB * fix that * correct * build agnos first * better temp dir * revert the order * try it on pc * test it * upload and fix * build * pass in environemnt variable * not in jenkins
This commit is contained in:
10
release/create_casync_agnos_release.py
Normal file → Executable file
10
release/create_casync_agnos_release.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import json
|
||||
import pathlib
|
||||
@@ -5,13 +6,15 @@ import tempfile
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.system.hardware.tici.agnos import StreamingDecompressor, unsparsify, noop, AGNOS_MANIFEST_FILE
|
||||
from openpilot.system.updated.casync.common import create_casync_from_file
|
||||
from openpilot.system.version import get_agnos_version
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="creates a casync release")
|
||||
parser.add_argument("output_dir", type=str, help="output directory for the channel")
|
||||
parser.add_argument("version", type=str, help="version of agnos this is")
|
||||
parser.add_argument("working_dir", type=str, help="working directory")
|
||||
parser.add_argument("--version", type=str, help="version of agnos this is", default=get_agnos_version())
|
||||
parser.add_argument("--manifest", type=str, help="json manifest to create agnos release from", \
|
||||
default=str(pathlib.Path(BASEDIR) / AGNOS_MANIFEST_FILE))
|
||||
args = parser.parse_args()
|
||||
@@ -19,9 +22,12 @@ if __name__ == "__main__":
|
||||
output_dir = pathlib.Path(args.output_dir)
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
working_dir = pathlib.Path(args.working_dir)
|
||||
working_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
manifest_file = pathlib.Path(args.manifest)
|
||||
|
||||
with tempfile.NamedTemporaryFile() as entry_file:
|
||||
with tempfile.NamedTemporaryFile(dir=str(working_dir)) as entry_file:
|
||||
entry_path = pathlib.Path(entry_file.name)
|
||||
|
||||
with open(manifest_file) as f:
|
||||
|
||||
@@ -4,17 +4,16 @@ import dataclasses
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
from openpilot.common.run import run_cmd
|
||||
from openpilot.system.hardware.tici.agnos import AGNOS_MANIFEST_FILE
|
||||
from openpilot.system.version import get_build_metadata
|
||||
from openpilot.system.hardware.tici.agnos import AGNOS_MANIFEST_FILE, get_partition_path
|
||||
from openpilot.system.version import get_build_metadata, get_agnos_version
|
||||
|
||||
|
||||
BASE_URL = "https://commadist.blob.core.windows.net"
|
||||
|
||||
CHANNEL_DATA = pathlib.Path(__file__).parent / "channel_data" / "agnos"
|
||||
|
||||
OPENPILOT_RELEASES = f"{BASE_URL}/openpilot-releases"
|
||||
AGNOS_RELEASES = f"{BASE_URL}/agnos-releases"
|
||||
OPENPILOT_RELEASES = f"{BASE_URL}/openpilot-releases/openpilot"
|
||||
AGNOS_RELEASES = f"{BASE_URL}/openpilot-releases/agnos"
|
||||
|
||||
|
||||
def create_partition_manifest(agnos_version, partition):
|
||||
@@ -23,10 +22,11 @@ def create_partition_manifest(agnos_version, partition):
|
||||
"casync": {
|
||||
"caibx": f"{AGNOS_RELEASES}/agnos-{agnos_version}-{partition['name']}.caibx"
|
||||
},
|
||||
"name": partition["name"],
|
||||
"path": get_partition_path(0, partition),
|
||||
"ab": True,
|
||||
"size": partition["size"],
|
||||
"full_check": partition["full_check"],
|
||||
"hash_raw": partition["hash_raw"]
|
||||
"hash_raw": partition["hash_raw"],
|
||||
}
|
||||
|
||||
|
||||
@@ -49,15 +49,12 @@ if __name__ == "__main__":
|
||||
with open(pathlib.Path(args.target_dir) / AGNOS_MANIFEST_FILE) as f:
|
||||
agnos_manifest = json.load(f)
|
||||
|
||||
agnos_version = run_cmd(["bash", "-c", r"unset AGNOS_VERSION && source launch_env.sh && \
|
||||
echo -n $AGNOS_VERSION"], args.target_dir).strip()
|
||||
|
||||
build_metadata = get_build_metadata(args.target_dir)
|
||||
|
||||
ret = {
|
||||
"build_metadata": dataclasses.asdict(build_metadata),
|
||||
"manifest": [
|
||||
*[create_partition_manifest(agnos_version, entry) for entry in agnos_manifest],
|
||||
*[create_partition_manifest(get_agnos_version(args.target_dir), entry) for entry in agnos_manifest],
|
||||
create_openpilot_manifest(build_metadata)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.common.utils import cache
|
||||
from openpilot.common.git import get_commit, get_origin, get_branch, get_short_branch, get_commit_date
|
||||
|
||||
from openpilot.common.run import run_cmd
|
||||
|
||||
RELEASE_BRANCHES = ['release3-staging', 'release3', 'nightly']
|
||||
TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging']
|
||||
@@ -157,6 +157,11 @@ def get_build_metadata(path: str = BASEDIR) -> BuildMetadata:
|
||||
raise Exception("invalid build metadata")
|
||||
|
||||
|
||||
def get_agnos_version(directory: str = BASEDIR) -> str:
|
||||
return run_cmd(["bash", "-c", r"unset AGNOS_VERSION && source launch_env.sh && \
|
||||
echo -n $AGNOS_VERSION"], cwd=directory).strip()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from openpilot.common.params import Params
|
||||
|
||||
|
||||
Reference in New Issue
Block a user