mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-15 18:02:05 +08:00
tool to create casync manifest (#32131)
* manifest tool * newline * add to jenkins
This commit is contained in:
Vendored
+1
@@ -152,6 +152,7 @@ def build_release(String channel_name) {
|
||||
"${channel_name} (casync)": {
|
||||
deviceStage("build casync", "tici-needs-can", [], [
|
||||
["build ${channel_name}", "RELEASE=1 OPENPILOT_CHANNEL=${channel_name} BUILD_DIR=/data/openpilot CASYNC_DIR=/data/casync $SOURCE_DIR/release/create_casync_build.sh"],
|
||||
["create manifest", "$SOURCE_DIR/release/create_release_manifest.py /data/manifest.json && cat /data/manifest.json"],
|
||||
//["upload ${channel_name}", "OPENPILOT_CHANNEL=${channel_name} $SOURCE_DIR/release/upload_casync_release.sh"],
|
||||
])
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import json
|
||||
import pathlib
|
||||
import tempfile
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.system.hardware.tici.agnos import StreamingDecompressor, unsparsify, noop
|
||||
from openpilot.system.hardware.tici.agnos import StreamingDecompressor, unsparsify, noop, AGNOS_MANIFEST_FILE
|
||||
from openpilot.system.updated.casync.common import create_casync_from_file
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ if __name__ == "__main__":
|
||||
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("--manifest", type=str, help="json manifest to create agnos release from", \
|
||||
default=str(pathlib.Path(BASEDIR) / "system/hardware/tici/agnos.json"))
|
||||
default=str(pathlib.Path(BASEDIR) / AGNOS_MANIFEST_FILE))
|
||||
args = parser.parse_args()
|
||||
|
||||
output_dir = pathlib.Path(args.output_dir)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import argparse
|
||||
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
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
def create_partition_manifest(agnos_version, partition):
|
||||
return {
|
||||
"type": "partition",
|
||||
"casync": {
|
||||
"caibx": f"{AGNOS_RELEASES}/agnos-{agnos_version}-{partition['name']}.caibx"
|
||||
},
|
||||
"name": partition["name"],
|
||||
"size": partition["size"],
|
||||
"full_check": partition["full_check"],
|
||||
"hash_raw": partition["hash_raw"]
|
||||
}
|
||||
|
||||
|
||||
def create_openpilot_manifest(build_metadata):
|
||||
return {
|
||||
"type": "path_tarred",
|
||||
"path": "/data/openpilot",
|
||||
"casync": {
|
||||
"caibx": f"{OPENPILOT_RELEASES}/{build_metadata.canonical}.caibx"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="creates a casync release")
|
||||
parser.add_argument("target_dir", type=str, help="directory of the channel to create manifest from")
|
||||
parser.add_argument("output_file", type=str, help="output file to put the manifest")
|
||||
args = parser.parse_args()
|
||||
|
||||
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_openpilot_manifest(build_metadata)
|
||||
]
|
||||
}
|
||||
|
||||
with open(args.output_file, "w") as f:
|
||||
f.write(json.dumps(ret, indent=2))
|
||||
@@ -15,6 +15,8 @@ import openpilot.system.updated.casync.casync as casync
|
||||
SPARSE_CHUNK_FMT = struct.Struct('H2xI4x')
|
||||
CAIBX_URL = "https://commadist.azureedge.net/agnosupdate/"
|
||||
|
||||
AGNOS_MANIFEST_FILE = "system/hardware/tici/agnos.json"
|
||||
|
||||
|
||||
class StreamingDecompressor:
|
||||
def __init__(self, url: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user