diff --git a/pym/calculate/lib/utils/portage.py b/pym/calculate/lib/utils/portage.py index d038066..1c149a1 100644 --- a/pym/calculate/lib/utils/portage.py +++ b/pym/calculate/lib/utils/portage.py @@ -1164,6 +1164,14 @@ class EmergeLog(): if m: self._remove_list.append(m.group(2)) + def did_update_world_happen(self): + latest_log = '\n'.join(line for line in self._get_last_changes()) + reg_emerge = r"(?s)(?<=[\s|@]world\n).*?(?=terminating)" + reg_success = r"\w*(?=\: \*\*\* exiting successfully)" + matches = re.finditer(reg_emerge, latest_log) + match_successes = [re.search(reg_success, match.group()) for match in matches] + return any(match_successes) + def _set_marker(self, text_marker): with open(self.emerge_log, 'a') as f: f.write("{0:.0f}: {1}\n".format(time.time(), text_marker))