diff --git a/pym/update/update.py b/pym/update/update.py index 88cade2..8c0e8a1 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -246,7 +246,7 @@ class Update(MethodsInterface): info_outdated = True if info_outdated: self.raiseOutdate() - dv.Set('cl_update_outdate_set', 'on', force=True) + # dv.Set('cl_update_outdate_set', 'on', force=True) finally: self.unstash_cache(rpath, name) # TODO: debug1 @@ -1623,6 +1623,16 @@ class Update(MethodsInterface): return None return level - int(self.clVars.Get("update.cl_update_level")) + def check_if_no_branch_is_set(self): + #basically, if any of the branches are specified, we won't use migration + return any(x != "tag" for x in self.clVars.Get("cl_update_branch_name")) + + def turn_off_migration_if_needed(self): + check = self.check_if_no_branch_is_set() + if check: + self.clVars.Set("cl_check_update_level", Variable.Off) + return True + def check_current_binhost(self, binhost_url): """ @@ -1826,6 +1836,24 @@ class Update(MethodsInterface): self.printWARNING(str(e)) return True + # #TODO rename + # def action_to_do_when_migr_is_set(self): + # print("DEBUG") + # dv = self.clVars + # git = self.getGit() + # repname = "calculate"#TODO check if there's a var for this + # url, rpath, revision = ( + # dv.Select(["cl_update_rep_url", "cl_update_rep_path", + # "cl_update_rep_rev"], + # where="cl_update_rep_name", eq=repname, limit=1)) + # ref_type = git.reference_type(rpath, revision) + # tag_cr = git.getCommit(rpath, revision) + # cr = git.getCurrentCommit(rpath) + # if ref_type == Git.Reference.Branch: + # pass #TODO + + # return True + def save_portage_state_hash(self): """ Сохранить состояние @@ -1883,8 +1911,7 @@ class Update(MethodsInterface): Возвращает True если есть значение в calculate.env """ # isdigit - True if it can be interp-ed as a number >=0 - return self.clVars.Get('cl_update_level').isdigit() - + return self.clVars.Get('cl_update_level').isdigit() def pull_level_from_binhost(self, binhost): self._set_update_level(binhost.level) diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index d49985f..0052d3e 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -47,6 +47,11 @@ def get_synchronization_tasks(object_name): {'name': 'create_binhost_data', 'method': Object('create_binhost_data()') }, + { + 'name': 'check_if_update_by_branch', + 'method': Object('turn_off_migration_if_needed()'), + 'condition': lambda Get, GetBool: (Get('cl_check_update_level') == 'on') + }, # проверить валиден ли текущий хост {'name': 'check_current_binhost', 'message': __("Checking current binhost"),