diff --git a/common/CI/package_checks.py b/common/CI/package_checks.py index 697700ecaa2f..408e17afe1f9 100755 --- a/common/CI/package_checks.py +++ b/common/CI/package_checks.py @@ -143,6 +143,9 @@ def commit_message(self, ref: str) -> str: def commit_refs(self, base: str, head: str) -> List[str]: return self.run_lines('log', '--no-merges', '--pretty=%H', base + '..' + head) + def commit_summary(self, ref: str) -> str: + return self.run('log', '-1', '--format=%s', ref) + def fetch(self, remote: List[str]) -> None: self.run('fetch', *remote) diff --git a/common/Scripts/publish_series.py b/common/Scripts/publish_series.py index a029863b602b..bf0ec6dc6a35 100755 --- a/common/Scripts/publish_series.py +++ b/common/Scripts/publish_series.py @@ -11,7 +11,7 @@ from datetime import datetime from dataclasses import dataclass -from typing import List, Optional +from typing import List, Optional, Tuple from xml.etree import ElementTree from urllib import request from email.utils import parsedate_to_datetime @@ -86,7 +86,7 @@ def run(self) -> bool: packages = {commit: self._packages(commit) for commit in commits} invalid = {commit: packages for commit, packages in packages.items() - if len(packages) != 1 or any(p is None for p in packages)} + if not self._change_is_valid(commit, packages)} if len(invalid) > 0: print('Found commits with an incorrect number of packages:') @@ -102,6 +102,10 @@ def run(self) -> bool: if self.render: self._render(commit) + if self._skip_commit(commit): + print(f'Skipping commit: {self.git.commit_summary(commit)}') + continue + comment = f'BUILD {i+1}/{len(commits)}' if self.title: comment = f'{self.title}\n{comment}' @@ -147,6 +151,18 @@ def _package_for_file(file: str) -> Optional[str]: return str(os.path.join(*parts[0:3])) + def _skip_commit(self, commit: str) -> bool: + msg = self.git.commit_summary(commit) + return msg.startswith('[NFC]') or \ + msg.startswith('common:') or \ + msg.startswith('packages:') or\ + msg.startswith('repo_data:') or\ + msg.lower().endswith(': deprecate') + + def _change_is_valid(self, commit: str, packages: List[str]) -> bool: + return self._skip_commit(commit) or \ + len(packages) == 1 and not any(p is None for p in packages) + def _git_push(self) -> None: print('Pushing to Git') if not self.noop: @@ -163,7 +179,7 @@ def _push_build(self, build: Build) -> int: return int(json.loads(output)['id']) - def _build_exists(self, build: Build) -> [bool, int]: + def _build_exists(self, build: Build) -> Tuple[bool, int]: try: found = next(b for b in Builds().all if b.tag == build.tag and b.status != 'FAILED')