mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 03:03:41 +08:00
Recognize official StarPilot startup channels
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
|
||||
from openpilot.common.version import build_metadata_from_dict
|
||||
|
||||
|
||||
@pytest.mark.parametrize("origin, channel, expected", [
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "stable", True),
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "testing", True),
|
||||
("https://github.com/firestar5683/StarPilot.git", "stable", True),
|
||||
("git@github.com:firestar5683/StarPilot.git", "testing", True),
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "StarPilot", True),
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "Dom", True),
|
||||
("https://github.com/firestar5683/StarPilot.git", "StarPilot", True),
|
||||
("https://github.com/firestar5683/StarPilot.git", "Dom", True),
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "feature", False),
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "HEAD", False),
|
||||
("https://github.com/other/StarPilot.git", "stable", False),
|
||||
("https://github.com/other/StarPilot.git", "testing", False),
|
||||
("https://github.com/commaai/openpilot.git", "release-tizi", True),
|
||||
("https://github.com/commaai/openpilot.git", "master", False),
|
||||
("https://github.com/StarPilotHQ/StarPilot.git", "replay", False),
|
||||
])
|
||||
def test_standard_startup(origin, channel, expected):
|
||||
metadata = build_metadata_from_dict({"channel": channel, "openpilot": {"git_origin": origin}})
|
||||
assert metadata.standard_startup is expected
|
||||
@@ -99,6 +99,13 @@ class BuildMetadata:
|
||||
def tested_channel(self) -> bool:
|
||||
return self.channel in TESTED_BRANCHES
|
||||
|
||||
@property
|
||||
def standard_startup(self) -> bool:
|
||||
starpilot_origins = ('github.com/starpilothq/starpilot', 'github.com/firestar5683/starpilot')
|
||||
if self.openpilot.git_normalized_origin.lower() in starpilot_origins:
|
||||
return self.channel in ('stable', 'StarPilot', 'Dom', 'testing')
|
||||
return self.openpilot.comma_remote and self.tested_channel
|
||||
|
||||
@property
|
||||
def release_channel(self) -> bool:
|
||||
return self.channel in RELEASE_BRANCHES
|
||||
|
||||
@@ -261,10 +261,7 @@ class SelfdriveD:
|
||||
# Observational only. Do not cache this qualification for authority decisions.
|
||||
|
||||
# Determine startup event
|
||||
official_starpilot = (build_metadata.openpilot.git_normalized_origin.lower() == 'github.com/starpilothq/starpilot' and
|
||||
build_metadata.channel in ('stable', 'testing'))
|
||||
standard_startup = official_starpilot or (build_metadata.openpilot.comma_remote and build_metadata.tested_channel)
|
||||
self.startup_event = EventName.startup if standard_startup else EventName.startupMaster
|
||||
self.startup_event = EventName.startup if build_metadata.standard_startup else EventName.startupMaster
|
||||
if HARDWARE.get_device_type() == 'mici':
|
||||
self.startup_event = None
|
||||
if not car_recognized:
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "fc856d30347f32f773ce6ff3230dcc19449de8b99248cd1efc92bbfe67f709d6", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "2ec6b85b75a5c9e05df8c0051340802186d2a8b03b2536d03d6e5cb0d44289f7", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user