summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/plugins/update_gits_plugin.py83
-rwxr-xr-xtests/update-gits-chunk.script43
-rwxr-xr-xtests/update-gits-stratum.script43
-rwxr-xr-xtests/update-gits-submodules.script49
-rw-r--r--tests/update-gits-submodules.stdout3
-rw-r--r--without-test-modules1
6 files changed, 0 insertions, 222 deletions
diff --git a/morphlib/plugins/update_gits_plugin.py b/morphlib/plugins/update_gits_plugin.py
deleted file mode 100644
index 46686391..00000000
--- a/morphlib/plugins/update_gits_plugin.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (C) 2012-2013 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-import cliapp
-import os
-
-import morphlib
-
-
-class UpdateGitsPlugin(cliapp.Plugin):
-
- def enable(self):
- self.app.add_subcommand('update-gits',
- self.update_gits,
- arg_synopsis='(REPO REF MORPHOLOGY)...')
-
- def disable(self):
- pass
-
- def update_gits(self, args):
- '''Manually update cached git repositories for the given morphology
-
- Command line arguments:
-
- * `REPO` is a git repository URL.
- * `REF` is a git commit ref (sha1, branch, tag).
- * `MORPHOLOGY` is a morphology filename.
-
- This updates the local cached copy of a git repository, and any
- git repositories of components in the morphology (for system
- and stratum morphologies).
-
- You do not normally need to do this. Morph updates the cached
- repositories automatically anyway.
-
- '''
-
- app = self.app
- if not os.path.exists(app.settings['cachedir']):
- os.mkdir(app.settings['cachedir'])
- cachedir = os.path.join(app.settings['cachedir'], 'gits')
- repo_resolver = morphlib.repoaliasresolver.RepoAliasResolver(
- app.settings['repo-alias'])
- tarball_base_url = app.settings['tarball-server']
- cache = morphlib.localrepocache.LocalRepoCache(
- app, cachedir, repo_resolver, tarball_base_url)
-
- subs_to_process = set()
-
- def visit(reponame, ref, filename, absref, tree, morphology):
- app.status(msg='Updating %(repo_name)s %(ref)s %(filename)s',
- repo_name=reponame, ref=ref, filename=filename)
- assert cache.has_repo(reponame)
- cached_repo = cache.get_repo(reponame)
- try:
- submodules = morphlib.git.Submodules(app, cached_repo.path,
- absref)
- submodules.load()
- except morphlib.git.NoModulesFileError:
- pass
- else:
- for submod in submodules:
- subs_to_process.add((submod.url, submod.commit))
-
- app.traverse_morphs(app.itertriplets(args), cache, None,
- update=True, visit=visit)
-
- done = set()
- for url, ref in subs_to_process:
- app.cache_repo_and_submodules(cache, url, ref, done)
diff --git a/tests/update-gits-chunk.script b/tests/update-gits-chunk.script
deleted file mode 100755
index 49072419..00000000
--- a/tests/update-gits-chunk.script
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2012-2013 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-## Test that 'morph update-gits' updates every chunk listed on the
-## command line.
-
-set -eu
-
-# Local repos do not get cached, so we need to fake some remote repositories
-git daemon --port=9419 --pid-file="$DATADIR/git.pid" --reuseaddr \
- --export-all --base-path="$DATADIR" 2> /dev/null &
-trap 'kill $(cat "$DATADIR/git.pid")' INT TERM ERR
-REPO_ALIAS='test=git://127.0.0.1:9419/%s#git://127.0.0.1:9419/%s'
-
-# Create an empty commit in a chunk repository
-cd "$DATADIR/chunk-repo"
-git checkout --quiet farrokh
-git commit --quiet --allow-empty --allow-empty-message -m ""
-NEWREF="$(git rev-parse --verify farrokh)"
-
-"$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \
- test:chunk-repo farrokh hello
-
-kill $(cat "$DATADIR/git.pid")
-
-# Check the top commit of the cached repo's farrokh branch
-cd "$DATADIR/cache/gits/"*chunk?repo*
-test "$(git rev-parse --verify refs/heads/farrokh)" = "$NEWREF"
diff --git a/tests/update-gits-stratum.script b/tests/update-gits-stratum.script
deleted file mode 100755
index e4c79289..00000000
--- a/tests/update-gits-stratum.script
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2012-2013 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-## Test that 'morph update-gits' updates every chunk that depends on the
-## strata listed on the command line.
-
-set -eu
-
-# Local repos do not get cached, so we need to fake some remote repositories
-git daemon --port=9419 --pid-file="$DATADIR/git.pid" --reuseaddr \
- --export-all --base-path="$DATADIR" 2> /dev/null &
-trap 'kill $(cat "$DATADIR/git.pid")' INT TERM ERR
-REPO_ALIAS='test=git://127.0.0.1:9419/%s#git://127.0.0.1:9419/%s'
-
-# Create an empty commit in a chunk repository
-cd "$DATADIR/chunk-repo"
-git checkout --quiet farrokh
-git commit --quiet --allow-empty --allow-empty-message -m ""
-NEWREF="$(git show-ref --hash farrokh)"
-
-"$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \
- test:morphs-repo master hello-stratum
-
-kill $(cat "$DATADIR/git.pid")
-
-# Check the top commit of the cached repo's farrokh branch
-cd "$DATADIR/cache/gits/"*chunk?repo*
-test "$(git show-ref --hash refs/heads/farrokh)" = "$NEWREF"
diff --git a/tests/update-gits-submodules.script b/tests/update-gits-submodules.script
deleted file mode 100755
index 65958919..00000000
--- a/tests/update-gits-submodules.script
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2012-2013 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-## Test that 'morph update-gits' caches all the submodules needed by
-## a chunk.
-
-set -eu
-
-# Local repos do not get cached, so we need to fake some remote repositories
-git daemon --port=9419 --pid-file="$DATADIR/git.pid" --reuseaddr \
- --export-all --base-path="$DATADIR" 2> /dev/null &
-trap 'kill $(cat "$DATADIR/git.pid")' INT TERM ERR
-REPO_ALIAS='test=git://127.0.0.1:9419/%s#git://127.0.0.1:9419/%s'
-
-# Create a repo to use as a submodule
-submodule="$DATADIR/submodule-repo"
-"$SRCDIR/scripts/cmd-filter" git init --quiet "$submodule"
-"$SRCDIR/scripts/run-git-in" "$submodule" commit --quiet --allow-empty \
- --allow-empty-message -m ""
-# Create an empty commit in a chunk repository
-chunkrepo="$DATADIR/chunk-repo"
-"$SRCDIR/scripts/run-git-in" "$chunkrepo" checkout --quiet farrokh
-"$SRCDIR/scripts/run-git-in" "$chunkrepo" submodule --quiet add "$submodule" \
- > /dev/null
-"$SRCDIR/scripts/run-git-in" "$chunkrepo" commit --quiet -m "add submodule"
-
-"$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \
- test:morphs-repo master hello-stratum
-
-kill $(cat "$DATADIR/git.pid")
-
-test -d "$DATADIR/cache/gits/"*chunk?repo* && echo chunk-repo cached
-test -d "$DATADIR/cache/gits/"*morphs?repo* && echo morphs-repo cached
-test -d "$DATADIR/cache/gits/"*submodule?repo* && echo submodule-repo cached
diff --git a/tests/update-gits-submodules.stdout b/tests/update-gits-submodules.stdout
deleted file mode 100644
index 5b20a81e..00000000
--- a/tests/update-gits-submodules.stdout
+++ /dev/null
@@ -1,3 +0,0 @@
-chunk-repo cached
-morphs-repo cached
-submodule-repo cached
diff --git a/without-test-modules b/without-test-modules
index 61a97877..a3aedc45 100644
--- a/without-test-modules
+++ b/without-test-modules
@@ -16,7 +16,6 @@ morphlib/plugins/syslinux-disk-systembuilder_plugin.py
morphlib/plugins/disk-systembuilder_plugin.py
morphlib/plugins/tarball-systembuilder_plugin.py
morphlib/plugins/show_dependencies_plugin.py
-morphlib/plugins/update_gits_plugin.py
morphlib/plugins/branch_and_merge_plugin.py
morphlib/buildcommand.py
morphlib/plugins/build_plugin.py