update_manager: deprecate zip beta type
Use the "channel" option to specify a beta. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
f965ce8fd8
commit
58ea3cfdc7
|
@ -25,10 +25,9 @@ if TYPE_CHECKING:
|
|||
from .update_manager import CommandHelper
|
||||
from ..machine import Machine
|
||||
|
||||
CHANNEL_TO_TYPE = {
|
||||
"stable": "zip",
|
||||
"beta": "git_repo",
|
||||
"dev": "git_repo"
|
||||
SUPPORTED_CHANNELS = {
|
||||
"zip": ["stable", "beta"],
|
||||
"git_repo": ["dev", "beta"]
|
||||
}
|
||||
TYPE_TO_CHANNEL = {
|
||||
"zip": "stable",
|
||||
|
@ -41,17 +40,30 @@ class AppDeploy(BaseDeploy):
|
|||
super().__init__(config, cmd_helper, prefix="Application")
|
||||
self.config = config
|
||||
self.debug = self.cmd_helper.is_debug_enabled()
|
||||
self.type = config.get('type')
|
||||
type_choices = list(TYPE_TO_CHANNEL.keys())
|
||||
self.type = config.get('type').lower()
|
||||
if self.type not in type_choices:
|
||||
raise config.error(
|
||||
f"Config Error: Section [{config.get_name()}], Option "
|
||||
f"'type: {self.type}': value must be one "
|
||||
f"of the following choices: {type_choices}"
|
||||
)
|
||||
self.channel = config.get(
|
||||
"channel", TYPE_TO_CHANNEL[self.type]
|
||||
)
|
||||
if self.type == "zip_beta":
|
||||
self.server.add_warning(
|
||||
f"Config Section [{config.get_name()}], Option 'type: "
|
||||
"zip_beta', value 'zip_beta' is deprecated. Set 'type' "
|
||||
"to zip and 'channel' to 'beta'")
|
||||
self.type = "zip"
|
||||
self.path = pathlib.Path(
|
||||
config.get('path')).expanduser().resolve()
|
||||
executable = config.get('env', None)
|
||||
if self.channel not in CHANNEL_TO_TYPE.keys():
|
||||
if self.channel not in SUPPORTED_CHANNELS[self.type]:
|
||||
raise config.error(
|
||||
f"Invalid Channel '{self.channel}' for config "
|
||||
f"section [{config.get_name()}]")
|
||||
f"section [{config.get_name()}], type: {self.type}")
|
||||
self._verify_path(config, 'path', self.path)
|
||||
self.executable: Optional[pathlib.Path] = None
|
||||
self.pip_exe: Optional[pathlib.Path] = None
|
||||
|
|
|
@ -37,6 +37,7 @@ RINFO_KEYS = [
|
|||
class ZipDeploy(AppDeploy):
|
||||
def __init__(self, config: ConfigHelper, cmd_helper: CommandHelper) -> None:
|
||||
super().__init__(config, cmd_helper)
|
||||
self.need_channel_update = self.type != "zip"
|
||||
self.official_repo: str = "?"
|
||||
self.owner: str = "?"
|
||||
# Extract repo from origin for validation
|
||||
|
@ -62,7 +63,6 @@ class ZipDeploy(AppDeploy):
|
|||
|
||||
async def initialize(self) -> Dict[str, Any]:
|
||||
storage = await super().initialize()
|
||||
self.detected_type: str = storage.get('detected_type', "?")
|
||||
self.source_checksum: str = storage.get("source_checksum", "?")
|
||||
self.pristine = storage.get('pristine', False)
|
||||
self.verified = storage.get('verified', False)
|
||||
|
@ -81,7 +81,6 @@ class ZipDeploy(AppDeploy):
|
|||
def get_persistent_data(self) -> Dict[str, Any]:
|
||||
storage = super().get_persistent_data()
|
||||
storage.update({
|
||||
'detected_type': self.detected_type,
|
||||
'source_checksum': self.source_checksum,
|
||||
'pristine': self.pristine,
|
||||
'verified': self.verified,
|
||||
|
@ -135,15 +134,10 @@ class ZipDeploy(AppDeploy):
|
|||
for key in RINFO_KEYS:
|
||||
if key not in release_info:
|
||||
self._add_error(f"Missing release info item: {key}")
|
||||
self.detected_type = "?"
|
||||
self.need_channel_update = self.channel == "dev"
|
||||
if 'channel' in release_info:
|
||||
local_channel = release_info['channel']
|
||||
if self.channel == "stable" and local_channel == "beta":
|
||||
self.need_channel_update = True
|
||||
self.detected_type = "zip"
|
||||
if local_channel == "beta":
|
||||
self.detected_type = "zip_beta"
|
||||
self.full_version = release_info.get('long_version', "?")
|
||||
self.short_version = self._get_tag_version(
|
||||
release_info.get('git_version', ""))
|
||||
|
@ -419,7 +413,7 @@ class ZipDeploy(AppDeploy):
|
|||
# client functionality. In the future it would be
|
||||
# good to report values that are specifc
|
||||
status.update({
|
||||
'detected_type': self.detected_type,
|
||||
'detected_type': "zip",
|
||||
'remote_alias': "origin",
|
||||
'branch': "master",
|
||||
'owner': self.owner,
|
||||
|
|
Loading…
Reference in New Issue