update_manager: disable repo binding

Remove hardcoded beta binding between Moonraker and Klipper.
This could result in a user getting stuck on a commit that requires
a future patch.

The original purpose of binding versions was to avoid a scenario
where Klipper introduces a feature incompatible with the current
Moonraker beta.  Rather than binding the  better solution is to
fix the incompatibility and tag a new beta.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-02-12 12:22:47 -05:00
parent 357276b1d9
commit ee8f77c8c6
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 1 additions and 80 deletions

View File

@ -296,10 +296,6 @@ class GitRepo:
self.fetch_timeout_handle: Optional[asyncio.Handle] = None
self.fetch_input_recd: bool = False
self.is_beta = channel == "beta"
self.bound_repo = None
if self.is_beta and self.alias == "klipper":
# Bind Klipper Updates Moonraker
self.bound_repo = "moonraker"
def restore_state(self, storage: Dict[str, Any]) -> None:
self.valid_git_repo: bool = storage.get('repo_valid', False)
@ -323,7 +319,6 @@ class GitRepo:
self.git_messages: List[str] = storage.get('git_messages', [])
self.commits_behind: List[Dict[str, Any]] = storage.get(
'commits_behind', [])
self.tag_data: Dict[str, Any] = storage.get('tag_data', {})
self.diverged: bool = storage.get("diverged", False)
self.repo_corrupt: bool = storage.get('corrupt', False)
self._check_warnings()
@ -347,7 +342,6 @@ class GitRepo:
'head_detached': self.head_detached,
'git_messages': self.git_messages,
'commits_behind': self.commits_behind,
'tag_data': self.tag_data,
'diverged': self.diverged,
'corrupt': self.repo_corrupt
}
@ -420,8 +414,7 @@ class GitRepo:
"--always --tags --long --dirty")
self.full_version_string = git_desc.strip()
self.dirty = git_desc.endswith("dirty")
self.tag_data = {}
if self.is_beta and self.bound_repo is None:
if self.is_beta:
await self._get_beta_versions(git_desc)
else:
await self._get_dev_versions(git_desc)
@ -528,8 +521,6 @@ class GitRepo:
tag_version = f"{tag}-{count}"
versions.append(tag_version)
self.current_version, self.upstream_version = versions
if self.bound_repo is not None:
await self._get_bound_versions(self.current_version)
async def _get_beta_versions(self, current_version: str) -> None:
upstream_commit, upstream_tag = await self._parse_latest_tag()
@ -547,52 +538,6 @@ class GitRepo:
self.upstream_commit = self.current_commit
self.current_version = current_tag
self.upstream_version = upstream_tag
# Check the tag for annotations
self.tag_data = await self.get_tag_data(upstream_tag)
if self.tag_data:
# TODO: need to force a repo update by resetting its refresh time?
logging.debug(
f"Git Repo {self.alias}: Found Tag Annotation: {self.tag_data}"
)
async def _get_bound_versions(self, current_version: str) -> None:
if self.bound_repo is None:
return
umdb = self.cmd_helper.get_umdb()
key = f"{self.bound_repo}.tag_data"
tag_data: Dict[str, Any] = await umdb.get(key, {})
if tag_data.get("repo", "") != self.alias:
logging.info(
f"Git Repo {self.alias}: Invalid bound tag data: "
f"{tag_data}"
)
return
if tag_data["branch"] != self.git_branch:
logging.info(f"Git Repo {self.alias}: Repo not on bound branch")
return
bound_vlist: List[int] = tag_data["version_as_list"]
current_vlist = self._convert_semver(current_version)
if self.full_version_string.endswith("shallow"):
# We need to recalculate the commit count for shallow clones
if current_vlist[:4] == bound_vlist[:4]:
commit = tag_data["commit"]
tag = current_version.split("-")[0]
try:
resp = await self.rev_list(f"{tag}..{commit} --count")
count = int(resp)
except Exception:
count = 0
bound_vlist[4] == count
if current_vlist < bound_vlist:
bound_ver_match = self.tag_r.match(tag_data["version"])
if bound_ver_match is not None:
self.upstream_commit = tag_data["commit"]
self.upstream_version = bound_ver_match.group()
else:
# The repo is currently ahead of the bound tag/commmit,
# so pin the version
self.upstream_commit = self.current_commit
self.upstream_version = self.current_version
async def _parse_latest_tag(self) -> Tuple[str, str]:
commit = tag = "?"
@ -713,8 +658,6 @@ class GitRepo:
f"Is Dirty: {self.dirty}\n"
f"Is Detached: {self.head_detached}\n"
f"Commits Behind: {len(self.commits_behind)}\n"
f"Tag Data: {self.tag_data}\n"
f"Bound Repo: {self.bound_repo}\n"
f"Diverged: {self.diverged}"
f"{warnings}"
)
@ -904,28 +847,6 @@ class GitRepo:
# Return tagged commits as SHA keys mapped to tag values
return tagged_commits
async def get_tag_data(self, tag: str) -> Dict[str, Any]:
self._verify_repo()
async with self.git_operation_lock:
cmd = f"tag -l --format='%(contents)' {tag}"
resp = (await self._run_git_cmd(cmd)).strip()
req_fields = ["repo", "branch", "version", "commit"]
tag_data: Dict[str, Any] = {}
for line in resp.split("\n"):
parts = line.strip().split(":", 1)
if len(parts) != 2:
continue
field, value = parts
field = field.strip()
if field not in req_fields:
continue
tag_data[field] = value.strip()
if len(tag_data) != len(req_fields):
return {}
vlist = self._convert_semver(tag_data["version"])
tag_data["version_as_list"] = vlist
return tag_data
def get_repo_status(self) -> Dict[str, Any]:
return {
'detected_type': "git_repo",