summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2015-11-11 09:19:18 +0000
committerBaserock Gerrit <gerrit@baserock.org>2015-11-20 16:44:33 +0000
commitb549c36dd6359aa22f8636bee7204c4df338b4f6 (patch)
tree8b36eadbe404f4925637b1b0292c0523a1540a93
parentfad8048de66fe6aeaa0478864914bb773f51ed3e (diff)
downloadmorph-b549c36dd6359aa22f8636bee7204c4df338b4f6.tar.gz
Remove old cruft
Static analysis showed this code is not being used, and we can always bring it back if necessary through git. Change-Id: Id8bf7d73436b5c3d0dfe050befaae034a05afc86
-rw-r--r--morphlib/artifact_tests.py5
-rw-r--r--morphlib/buildcommand.py2
-rw-r--r--morphlib/builder_tests.py6
-rw-r--r--morphlib/fsutils.py16
-rw-r--r--morphlib/gitdir.py36
-rw-r--r--morphlib/localrepocache_tests.py3
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py20
-rw-r--r--morphlib/sourceresolver.py19
-rw-r--r--morphlib/stagingarea.py1
-rw-r--r--morphlib/stagingarea_tests.py1
-rw-r--r--morphlib/sysbranchdir.py3
-rw-r--r--morphlib/sysbranchdir_tests.py7
-rw-r--r--morphlib/util_tests.py1
-rw-r--r--scripts/python-check35
-rwxr-xr-xscripts/sparse-gunzip6
15 files changed, 0 insertions, 161 deletions
diff --git a/morphlib/artifact_tests.py b/morphlib/artifact_tests.py
index 106459c8..31e3ad7f 100644
--- a/morphlib/artifact_tests.py
+++ b/morphlib/artifact_tests.py
@@ -43,11 +43,6 @@ class ArtifactTests(unittest.TestCase):
'tree', morph)
self.artifact_name = 'chunk-runtime'
self.artifact = self.source.artifacts[self.artifact_name]
- self.other_source, = morphlib.source.make_sources('repo', 'ref',
- 'chunk.morph',
- 'sha1', 'tree',
- morph)
- self.other = self.other_source.artifacts[self.artifact_name]
def test_constructor_sets_source(self):
self.assertEqual(self.artifact.source, self.source)
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index a0922165..a2ad3301 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -45,8 +45,6 @@ class BuildCommand(object):
'''
def __init__(self, app, build_env = None):
- self.supports_local_build = True
-
self.app = app
self.lac, self.rac = self.new_artifact_caches()
self.lrc, self.rrc = self.new_repo_caches()
diff --git a/morphlib/builder_tests.py b/morphlib/builder_tests.py
index a571e3d0..9e465227 100644
--- a/morphlib/builder_tests.py
+++ b/morphlib/builder_tests.py
@@ -140,12 +140,6 @@ class BuilderBaseTests(unittest.TestCase):
def fake_runcmd(self, argv, *args, **kwargs):
self.commands_run.append(argv)
- def fake_open(self, filename, mode):
- self.open_filename = filename
- self.open_handle = StringIO.StringIO()
- self.open_handle.close = lambda: None
- return self.open_handle
-
def setUp(self):
self.commands_run = []
self.app = FakeApp(self.fake_runcmd)
diff --git a/morphlib/fsutils.py b/morphlib/fsutils.py
index a3b73bf6..fbc89688 100644
--- a/morphlib/fsutils.py
+++ b/morphlib/fsutils.py
@@ -15,18 +15,6 @@
import os
import re
-
-def create_image(runcmd, image_name, size): # pragma: no cover
- # FIXME a pure python implementation may be better
- runcmd(['dd', 'if=/dev/zero', 'of=' + image_name, 'bs=1',
- 'seek=%d' % size, 'count=0'])
-
-
-def partition_image(runcmd, image_name): # pragma: no cover
- # FIXME make this more flexible with partitioning options
- runcmd(['sfdisk', image_name], feed_stdin='1,,83,*\n')
-
-
def setup_device_mapping(runcmd, image_name): # pragma: no cover
findstart = re.compile(r"start=\s+(\d+),")
out = runcmd(['sfdisk', '-d', image_name])
@@ -42,10 +30,6 @@ def setup_device_mapping(runcmd, image_name): # pragma: no cover
return device.strip()
-def create_fs(runcmd, partition): # pragma: no cover
- runcmd(['mkfs.btrfs', '-L', 'baserock', partition])
-
-
def mount(runcmd, partition, mount_point, fstype=None): # pragma: no cover
if not os.path.exists(mount_point):
os.mkdir(mount_point)
diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py
index d1770275..59a4be51 100644
--- a/morphlib/gitdir.py
+++ b/morphlib/gitdir.py
@@ -498,19 +498,6 @@ class GitDirectory(object):
argv.append(base_ref)
morphlib.git.gitcmd(self._runcmd, *argv)
- def is_currently_checked_out(self, ref): # pragma: no cover
- '''Is ref currently checked out?'''
-
- # Try the ref name directly first. If that fails, prepend origin/
- # to it. (FIXME: That's a kludge, and should be fixed.)
- try:
- parsed_ref = morphlib.git.gitcmd(self._runcmd, 'rev-parse', ref)
- except cliapp.AppException:
- parsed_ref = morphlib.git.gitcmd(self._runcmd, 'rev-parse',
- 'origin/%s' % ref)
- parsed_head = morphlib.git.gitcmd(self._runcmd, 'rev-parse', 'HEAD')
- return parsed_ref.strip() == parsed_head.strip()
-
def get_file_from_ref(self, ref, filename): # pragma: no cover
'''Get file contents from git by ref and filename.
@@ -602,19 +589,6 @@ class GitDirectory(object):
except cliapp.AppException as e:
raise InvalidRefError(self, ref)
- def disambiguate_ref(self, ref): # pragma: no cover
- try:
- out = morphlib.git.gitcmd(self._runcmd, 'rev-parse',
- '--symbolic-full-name', ref)
- return out.strip()
- except cliapp.AppException: # ref not found
- if ref.startswith('refs/heads/'):
- return ref
- elif ref.startswith('heads/'):
- return 'refs/' + ref
- else:
- return 'refs/heads/' + ref
-
def get_upstream_of_branch(self, branch): # pragma: no cover
try:
out = morphlib.git.gitcmd(
@@ -721,16 +695,6 @@ class GitDirectory(object):
'''
return self._store_object(contents=blob_contents, type='blob')
- def store_commit(self, commit_contents): # pragma: no cover
- '''Hash `commit_contents`, store it in git and return the sha1.
-
- `commit_contents` must either be a string or a value suitable to
- pass to subprocess.Popen i.e. a file descriptor or file object
- with fileno() method.
-
- '''
- return self._store_object(contents=commit_contents, type='commit')
-
def _store_object(self, contents, type):
if isinstance(contents, basestring):
kwargs = {'feed_stdin': contents}
diff --git a/morphlib/localrepocache_tests.py b/morphlib/localrepocache_tests.py
index 898894db..c4ccdbab 100644
--- a/morphlib/localrepocache_tests.py
+++ b/morphlib/localrepocache_tests.py
@@ -50,7 +50,6 @@ class LocalRepoCacheTests(unittest.TestCase):
self.cache_path = '%s/%s' % (self.cachedir, escaped_url)
self.remotes = {}
self.fetched = []
- self.removed = []
self.lrc = morphlib.localrepocache.LocalRepoCache(
FakeApplication(), self.cachedir, repo_resolver, tarball_base_url)
self.lrc.fs = fs.memoryfs.MemoryFS()
@@ -137,8 +136,6 @@ class LocalRepoCacheTests(unittest.TestCase):
def test_fetches_tarball_when_it_exists(self):
self.lrc._fetch = lambda url, path: self.fetched.append(url)
- self.unpacked_tar = ""
- self.mkdir_path = ""
with morphlib.gitdir_tests.monkeypatch(
morphlib.cachedrepo.CachedRepo, 'update', lambda self: None):
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index ba4fab55..6513e2eb 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -252,26 +252,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
morph.dirty = False
logging.debug('Saving dirty morphologies: done')
- def _checkout(self, lrc, sb, repo_url, ref):
- logging.debug(
- 'Checking out %s (%s) into %s' %
- (repo_url, ref, sb.root_directory))
- cached_repo = lrc.get_updated_repo(repo_url)
- gd = sb.clone_cached_repo(cached_repo, ref)
- gd.update_submodules(self.app)
- gd.update_remotes()
-
- def _load_morphology_from_file(self, loader, dirname, filename):
- full_filename = os.path.join(dirname, filename)
- return loader.load_from_file(full_filename)
-
- def _load_morphology_from_git(self, loader, gd, ref, filename):
- try:
- text = gd.get_file_from_ref(ref, filename)
- except cliapp.AppException:
- text = gd.get_file_from_ref('origin/%s' % ref, filename)
- return loader.load_from_string(text, filename)
-
def show_system_branch(self, args):
'''Show the name of the current system branch.'''
diff --git a/morphlib/sourceresolver.py b/morphlib/sourceresolver.py
index 108adc14..a94ff66f 100644
--- a/morphlib/sourceresolver.py
+++ b/morphlib/sourceresolver.py
@@ -234,25 +234,6 @@ class SourceResolver(object):
logging.debug("Didn't find %s in definitions", filename)
return None
- def _get_file_contents(self, definitions_checkout_dir, definitions_repo,
- definitions_absref, reponame, sha1,
- filename):
- '''Read the file at the specified location.
-
- Returns None if the file does not exist in the specified commit.
-
- '''
- text = None
-
- if reponame == definitions_repo and \
- sha1 == definitions_absref:
- text = self._get_file_contents_from_definitions(
- definitions_checkout_dir, filename)
- else:
- text = self._get_file_contents_from_repo(reponame, sha1, filename)
-
- return text
-
def _check_version_file(self, definitions_checkout_dir):
version_text = self._get_file_contents_from_definitions(
definitions_checkout_dir, 'VERSION')
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index 6965252d..871b69b9 100644
--- a/morphlib/stagingarea.py
+++ b/morphlib/stagingarea.py
@@ -45,7 +45,6 @@ class StagingArea(object):
self._app = app
self.source = source
self.dirname = dirname
- self._bind_readonly_mount = None
self.use_chroot = use_chroot
self.env = build_env.env
diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py
index 12ea24b6..67b0c40a 100644
--- a/morphlib/stagingarea_tests.py
+++ b/morphlib/stagingarea_tests.py
@@ -70,7 +70,6 @@ class StagingAreaTests(unittest.TestCase):
os.mkdir(self.cachedir)
os.mkdir(os.path.join(self.cachedir, 'artifacts'))
self.staging = os.path.join(self.tempdir, 'staging')
- self.created_dirs = []
self.build_env = FakeBuildEnvironment()
self.sa = morphlib.stagingarea.StagingArea(
FakeApplication(self.cachedir, self.tempdir), self.source,
diff --git a/morphlib/sysbranchdir.py b/morphlib/sysbranchdir.py
index 25fc7f67..d466f065 100644
--- a/morphlib/sysbranchdir.py
+++ b/morphlib/sysbranchdir.py
@@ -121,9 +121,6 @@ class SystemBranchDirectory(object):
return os.path.join(self.root_directory, relative)
- def relative_to_root_repo(self, path): # pragma: no cover
- return self.definitions_repo.relative_path(path)
-
def get_git_directory_name(self, repo_url):
'''Return directory pathname for a given git repository.
diff --git a/morphlib/sysbranchdir_tests.py b/morphlib/sysbranchdir_tests.py
index 341fedca..6dd6fc6d 100644
--- a/morphlib/sysbranchdir_tests.py
+++ b/morphlib/sysbranchdir_tests.py
@@ -198,18 +198,11 @@ class SystemBranchDirectoryTests(unittest.TestCase):
def test_lists_git_directories(self):
- def fake_git_clone(dirname, url, branch):
- os.mkdir(dirname)
- subdir = os.path.join(dirname, '.git')
- os.mkdir(subdir)
-
sb = morphlib.sysbranchdir.create(
self.root_directory,
self.root_repository_url,
self.system_branch_name)
- sb._git_clone = fake_git_clone
-
cached_repo = self.create_fake_cached_repo()
sb.clone_cached_repo(cached_repo, 'master')
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py
index a43c9a60..736c9199 100644
--- a/morphlib/util_tests.py
+++ b/morphlib/util_tests.py
@@ -67,7 +67,6 @@ class FindParentOfTests(unittest.TestCase):
self.tempdir = tempfile.mkdtemp()
os.makedirs(os.path.join(self.tempdir, 'a', 'b', 'c'))
self.a = os.path.join(self.tempdir, 'a')
- self.b = os.path.join(self.tempdir, 'a', 'b')
self.c = os.path.join(self.tempdir, 'a', 'b', 'c')
def tearDown(self):
diff --git a/scripts/python-check b/scripts/python-check
deleted file mode 100644
index fc89023d..00000000
--- a/scripts/python-check
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2012-2013,2015 Codethink Limited
-#
-# 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; version 2 of the License.
-#
-# 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/>.
-
-# When sourced by scripts, if the python version is too old
-# fake the output and exit.
-
-if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null
-then
- outpath="$(dirname "$0")/$(basename "$0" .script).stdout"
- errpath="$(dirname "$0")/$(basename "$0" .script).stderr"
- exitpath="$(dirname "$0")/$(basename "$0" .script).exit"
- if [ -r "$outpath" ]; then
- cat "$outpath"
- fi
- if [ -r "$errpath" ]; then
- cat "$errpath" >&2
- fi
- if [ -r "$exitpath" ]; then
- exit "$(cat "$exitpath")"
- else
- exit 0
- fi
-fi
diff --git a/scripts/sparse-gunzip b/scripts/sparse-gunzip
deleted file mode 100755
index b6e1aa16..00000000
--- a/scripts/sparse-gunzip
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/python
-from morphlib.util import copyfileobj
-import gzip, sys
-infh = gzip.GzipFile(fileobj=sys.stdin)
-copyfileobj(infh, sys.stdout)
-infh.close()