summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-03-06 22:18:18 +0200
committerLars Wirzenius <liw@liw.fi>2016-03-06 22:18:18 +0200
commit269b408eea5c9c6eedb27078a99a55cfc5d32621 (patch)
tree345f9d7c567d716f401a0b1e173d5e68351e1962
parentcdf8374246ac6b9ed91ef79b46a4aac99f104d52 (diff)
downloadick-269b408eea5c9c6eedb27078a99a55cfc5d32621.tar.gz
Move CloneGits into a separate module
-rw-r--r--icklib/__init__.py1
-rw-r--r--icklib/project.py37
-rw-r--r--icklib/step_git_clone.py50
-rw-r--r--without-tests1
4 files changed, 56 insertions, 33 deletions
diff --git a/icklib/__init__.py b/icklib/__init__.py
index 9cc5e62..85668be 100644
--- a/icklib/__init__.py
+++ b/icklib/__init__.py
@@ -24,6 +24,7 @@ from .run_state import RunState
from .pipeline import BuildPipeline
from .os_release import parse_os_release, OsRelease, NoOsReleaseInformation
from .step_build_info import CreateBuildInfo, FinishBuildInfo
+from .step_git_clone import CloneGits
from .step_project_info import LoadProjectInfo, SaveProjectInfo
from .project import create_projects_from_ick
from .git import GitClone
diff --git a/icklib/project.py b/icklib/project.py
index 3e4b609..8b680dc 100644
--- a/icklib/project.py
+++ b/icklib/project.py
@@ -223,35 +223,6 @@ class Project(object):
remote_git_dir)
-class CloneGits(icklib.BuildStep):
-
- def build(self):
- top_git_dir = self.statedir.get_git_directory(self.project.name)
- clones = []
- for git_spec in self.project.git_specs:
- dirname = os.path.normpath(
- os.path.join(top_git_dir, git_spec.subdir))
- self.run_state.progress['step'] = (
- 'Cloning/updating git {}'.format(git_spec.url))
- self.run_state.logger.important(
- 'git cloning {url} to {dir}',
- url=git_spec.url, dir=dirname)
-
- clone = self._clone_one(dirname, git_spec)
- clone.set_subdir(git_spec.subdir)
- clones.append(clone)
-
- self.run_state.clones = clones
-
- def _clone_one(self, dirname, git_spec):
- clone = icklib.GitClone()
- clone.set_dirname(dirname)
- clone.set_url(git_spec.url)
- clone.sync_from_url()
- clone.checkout(git_spec.branch)
- return clone
-
-
class FindCurrentGitCommits(icklib.BuildStep):
def build(self):
@@ -1010,7 +981,7 @@ def create_projects_from_ick(ick, wanted_names):
pipelines = {
'shell': [
icklib.LoadProjectInfo,
- CloneGits,
+ icklib.CloneGits,
FindCurrentGitCommits,
FindNewCommitToBuildForShell,
icklib.CreateBuildInfo,
@@ -1020,7 +991,7 @@ def create_projects_from_ick(ick, wanted_names):
],
'local-shell': [
icklib.LoadProjectInfo,
- CloneGits,
+ icklib.CloneGits,
FindCurrentGitCommits,
FindNewCommitToBuildForLocalShell,
icklib.CreateBuildInfo,
@@ -1030,7 +1001,7 @@ def create_projects_from_ick(ick, wanted_names):
],
'debian-ci': [
icklib.LoadProjectInfo,
- CloneGits,
+ icklib.CloneGits,
FindCurrentGitCommits,
FindNewCommitToBuildForDebianCI,
icklib.CreateBuildInfo,
@@ -1046,7 +1017,7 @@ def create_projects_from_ick(ick, wanted_names):
],
'debian-release': [
icklib.LoadProjectInfo,
- CloneGits,
+ icklib.CloneGits,
FindCurrentGitCommits,
FindTagsToBuildForDebianRelease,
icklib.CreateBuildInfo,
diff --git a/icklib/step_git_clone.py b/icklib/step_git_clone.py
new file mode 100644
index 0000000..1259610
--- /dev/null
+++ b/icklib/step_git_clone.py
@@ -0,0 +1,50 @@
+# 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 os
+
+import icklib
+
+
+class CloneGits(icklib.BuildStep):
+
+ def build(self):
+ top_git_dir = self.statedir.get_git_directory(self.project.name)
+ clones = []
+ for git_spec in self.project.git_specs:
+ dirname = os.path.normpath(
+ os.path.join(top_git_dir, git_spec.subdir))
+ self.run_state.progress['step'] = (
+ 'Cloning/updating git {}'.format(git_spec.url))
+ self.run_state.logger.important(
+ 'git cloning {url} to {dir}',
+ url=git_spec.url, dir=dirname)
+
+ clone = self._clone_one(dirname, git_spec)
+ clone.set_subdir(git_spec.subdir)
+ clones.append(clone)
+
+ self.run_state.clones = clones
+
+ def _clone_one(self, dirname, git_spec):
+ clone = icklib.GitClone()
+ clone.set_dirname(dirname)
+ clone.set_url(git_spec.url)
+ clone.sync_from_url()
+ clone.checkout(git_spec.branch)
+ return clone
diff --git a/without-tests b/without-tests
index 4765ff4..611291c 100644
--- a/without-tests
+++ b/without-tests
@@ -5,4 +5,5 @@ icklib/info.py
icklib/version.py
icklib/progress.py
icklib/step_build_info.py
+icklib/step_git_clone.py
icklib/step_project_info.py