diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-03-06 22:23:28 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-03-06 22:23:28 +0200 |
commit | adca6c6c1b5b4e3ae7841920c3eab37c5e6f7228 (patch) | |
tree | 19d3d3d7f3c0495127776f1e07f55e4b4bef086e | |
parent | 55c81e48fafede24307cf2914c072e8b7c4ba20c (diff) | |
download | ick-adca6c6c1b5b4e3ae7841920c3eab37c5e6f7228.tar.gz |
Move steps to find new commits to separate module
-rw-r--r-- | icklib/__init__.py | 5 | ||||
-rw-r--r-- | icklib/project.py | 59 | ||||
-rw-r--r-- | icklib/step_find_new_commit.py | 72 | ||||
-rw-r--r-- | without-tests | 1 |
4 files changed, 81 insertions, 56 deletions
diff --git a/icklib/__init__.py b/icklib/__init__.py index 49810ca..e88b5e0 100644 --- a/icklib/__init__.py +++ b/icklib/__init__.py @@ -25,6 +25,11 @@ from .pipeline import BuildPipeline from .os_release import parse_os_release, OsRelease, NoOsReleaseInformation from .step_build_info import CreateBuildInfo, FinishBuildInfo from .step_find_current_commit import FindCurrentGitCommits +from .step_find_new_commit import ( + FindNewCommitToBuildForShell, + FindNewCommitToBuildForLocalShell, + FindNewCommitToBuildForDebianCI, +) from .step_git_clone import CloneGits from .step_project_info import LoadProjectInfo, SaveProjectInfo from .project import create_projects_from_ick diff --git a/icklib/project.py b/icklib/project.py index adfc17e..27a5e73 100644 --- a/icklib/project.py +++ b/icklib/project.py @@ -223,59 +223,6 @@ class Project(object): remote_git_dir) -class FindNewCommitToBuildForShell(icklib.BuildStep): - - def build(self): - if self._needs_to_be_built(): - self.run_state.build_using_shell = True - else: - self.run_state.build_using_shell = False - self.run_state.logger.important( - 'No need to build {project_name}', - project_name=self.project.name) - - def _needs_to_be_built(self): - built_commits = self.run_state.project_info.built_commits - built = built_commits.get(self.run_state.pipeline.name, None) - return built != self.run_state.commits - - -class FindNewCommitToBuildForLocalShell(icklib.BuildStep): - - def build(self): - if self._needs_to_be_built(): - self.run_state.build_using_local_shell = True - else: - self.run_state.build_using_local_shell = False - self.run_state.logger.important( - 'No need to build {project_name}', - project_name=self.project.name) - - def _needs_to_be_built(self): - built_commits = self.run_state.project_info.built_commits - built = built_commits.get(self.run_state.pipeline.name, None) - return built != self.run_state.commits - - -class FindNewCommitToBuildForDebianCI(icklib.BuildStep): - - def build(self): - if self._needs_to_be_built(): - self.run_state.build_using_debian_ci = True - self.run_state.collect_debian_info = True - else: - self.run_state.build_using_debian_ci = False - self.run_state.collect_debian_info = False - self.run_state.logger.important( - 'No need to build {project_name}', - project_name=self.project.name) - - def _needs_to_be_built(self): - built_commits = self.run_state.project_info.built_commits - built = built_commits.get(self.run_state.pipeline.name, None) - return built != self.run_state.commits - - class FindTagsToBuildForDebianRelease(icklib.BuildStep): def build(self): @@ -974,7 +921,7 @@ def create_projects_from_ick(ick, wanted_names): icklib.LoadProjectInfo, icklib.CloneGits, icklib.FindCurrentGitCommits, - FindNewCommitToBuildForShell, + icklib.FindNewCommitToBuildForShell, icklib.CreateBuildInfo, RunShellCommandsOnEachTarget, icklib.FinishBuildInfo, @@ -984,7 +931,7 @@ def create_projects_from_ick(ick, wanted_names): icklib.LoadProjectInfo, icklib.CloneGits, icklib.FindCurrentGitCommits, - FindNewCommitToBuildForLocalShell, + icklib.FindNewCommitToBuildForLocalShell, icklib.CreateBuildInfo, RunLocalShellCommands, icklib.FinishBuildInfo, @@ -994,7 +941,7 @@ def create_projects_from_ick(ick, wanted_names): icklib.LoadProjectInfo, icklib.CloneGits, icklib.FindCurrentGitCommits, - FindNewCommitToBuildForDebianCI, + icklib.FindNewCommitToBuildForDebianCI, icklib.CreateBuildInfo, CollectDebianInfoAboutTargets, CreateCITarball, diff --git a/icklib/step_find_new_commit.py b/icklib/step_find_new_commit.py new file mode 100644 index 0000000..0d6e7d2 --- /dev/null +++ b/icklib/step_find_new_commit.py @@ -0,0 +1,72 @@ +# Copyright 2016 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# =*= License: GPL-3+ =*= + + +import icklib + + +class FindNewCommitToBuildForShell(icklib.BuildStep): + + def build(self): + if self._needs_to_be_built(): + self.run_state.build_using_shell = True + else: + self.run_state.build_using_shell = False + self.run_state.logger.important( + 'No need to build {project_name}', + project_name=self.project.name) + + def _needs_to_be_built(self): + built_commits = self.run_state.project_info.built_commits + built = built_commits.get(self.run_state.pipeline.name, None) + return built != self.run_state.commits + + +class FindNewCommitToBuildForLocalShell(icklib.BuildStep): + + def build(self): + if self._needs_to_be_built(): + self.run_state.build_using_local_shell = True + else: + self.run_state.build_using_local_shell = False + self.run_state.logger.important( + 'No need to build {project_name}', + project_name=self.project.name) + + def _needs_to_be_built(self): + built_commits = self.run_state.project_info.built_commits + built = built_commits.get(self.run_state.pipeline.name, None) + return built != self.run_state.commits + + +class FindNewCommitToBuildForDebianCI(icklib.BuildStep): + + def build(self): + if self._needs_to_be_built(): + self.run_state.build_using_debian_ci = True + self.run_state.collect_debian_info = True + else: + self.run_state.build_using_debian_ci = False + self.run_state.collect_debian_info = False + self.run_state.logger.important( + 'No need to build {project_name}', + project_name=self.project.name) + + def _needs_to_be_built(self): + built_commits = self.run_state.project_info.built_commits + built = built_commits.get(self.run_state.pipeline.name, None) + return built != self.run_state.commits diff --git a/without-tests b/without-tests index 848ca6e..e60438b 100644 --- a/without-tests +++ b/without-tests @@ -6,5 +6,6 @@ icklib/version.py icklib/progress.py icklib/step_build_info.py icklib/step_find_current_commit.py +icklib/step_find_new_commit.py icklib/step_git_clone.py icklib/step_project_info.py |