From 6409218928104071d0da101b94edbf31c409cba7 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 5 Jul 2013 10:14:57 +0000 Subject: Remove "morph make-patch" since it doesn't work In addition, when we start using tbdiff for upgrades, all of this will need to be re-designed and re-implemented anyway. The current plugin is dead code. Note that the test suite had already been disabled. --- morphlib/plugins/trebuchet_plugin.py | 98 ------------------------------------ tests.as-root/make-patch.script | 93 ---------------------------------- tests.as-root/make-patch.stdout | 5 -- without-test-modules | 1 - 4 files changed, 197 deletions(-) delete mode 100644 morphlib/plugins/trebuchet_plugin.py delete mode 100755 tests.as-root/make-patch.script delete mode 100644 tests.as-root/make-patch.stdout diff --git a/morphlib/plugins/trebuchet_plugin.py b/morphlib/plugins/trebuchet_plugin.py deleted file mode 100644 index 036fec50..00000000 --- a/morphlib/plugins/trebuchet_plugin.py +++ /dev/null @@ -1,98 +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 tempfile -import gzip - -import morphlib - -from morphlib.mountableimage import MountableImage - - -class TrebuchetPlugin(cliapp.Plugin): - - def enable(self): - self.app.add_subcommand('make-patch', - self.make_patch, - arg_synopsis='PATH SRC_TRIPLE TGT_TRIPLE') - - def disable(self): - pass - - def make_patch(self, args): - '''Create a Trebuchet patch between two system images.''' - - if len(args) != 7: - raise cliapp.AppException('make-patch requires arguments: ' - 'name of output file plus two triplets') - - output = args[0] - repo_name1, ref1, filename1 = args[1:4] - repo_name2, ref2, filename2 = args[4:7] - - app = self.app - lac, rac = morphlib.util.new_artifact_caches(app.settings) - lrc, rrc = morphlib.util.new_repo_caches(app) - - def get_system_source(repo_name, ref, filename): - srcpool = app.create_source_pool( - lrc, rrc, (repo_name, ref, filename)) - src = srcpool.lookup(repo_name, ref, filename) - return srcpool, src.morphology['arch'] - - srcpool1, arch1 = get_system_source(repo_name1, ref1, filename1) - srcpool2, arch2 = get_system_source(repo_name2, ref2, filename2) - - if arch1 != arch2: - raise cliapp.AppException('System architectures do not match: ' - '%s vs. %s' % (arch1, arch2)) - - build_env = morphlib.buildenvironment.BuildEnvironment( - app.settings, arch1) - ckc = morphlib.cachekeycomputer.CacheKeyComputer(build_env) - - def the_one(source, repo_name, ref, filename): - return (source.repo_name == repo_name and - source.original_ref == ref and - source.filename == filename) - - def get_artifact(srcpool, repo_name, ref, filename): - ar = morphlib.artifactresolver.ArtifactResolver() - artifacts = ar.resolve_artifacts(srcpool) - for artifact in artifacts: - artifact.cache_key = ckc.compute_key(artifact) - if the_one(artifact.source, repo_name, ref, filename): - a = morphlib.artifact.Artifact( - artifact.source, - artifact.source.morphology['name'] + '-rootfs') - a.cache_key = artifact.cache_key - return a - - artifact1 = get_artifact(srcpool1, repo_name1, ref1, filename1) - artifact2 = get_artifact(srcpool2, repo_name2, ref2, filename2) - - image_path_1 = lac.get(artifact1).name - image_path_2 = lac.get(artifact2).name - - mount_point_1 = None - mount_point_2 = None - with MountableImage(app, image_path_1) as mount_point_1: - with MountableImage(app, image_path_2) as mount_point_2: - app.runcmd(['tbdiff-create', output, - os.path.join(mount_point_1, 'factory'), - os.path.join(mount_point_2, 'factory')]) diff --git a/tests.as-root/make-patch.script b/tests.as-root/make-patch.script deleted file mode 100755 index 728088ea..00000000 --- a/tests.as-root/make-patch.script +++ /dev/null @@ -1,93 +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 DISABLED FOR NOW, SINCE make-patch DOES NOT WORK WITH ROOTFS-TARBALL -# SYSTEM IMAGES, ONLY ON **COMPRESSED** DISK IMAGES. -cat "$SRCDIR/tests.as-root/make-patch.stdout" -exit 0 - -## Test making a patch between two different system images. - -set -eu - -. "$SRCDIR/tests.as-root/lib" - -# Build first image. Remember the stratum. -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs master linux-system -img1=$(find "$DATADIR/cache/artifacts" -maxdepth 1 -name '*.system.*-rootfs') - -# Modify the chunk, in a new branch. -"$SRCDIR/scripts/run-git-in" "$DATADIR/chunk-repo" checkout --quiet farrokh -"$SRCDIR/scripts/run-git-in" "$DATADIR/chunk-repo" checkout --quiet -b alfred -sed -i s/hello/goodbye/ "$DATADIR/chunk-repo/hello.c" -"$SRCDIR/scripts/run-git-in" "$DATADIR/chunk-repo" commit -am goodbye \ - > /dev/null - -# Modify the morphs repo to use the new chunk branch, creating a new -# branch for the morphs repo. -"$SRCDIR/scripts/run-git-in" "$DATADIR/morphs" checkout --quiet -b alfred -sed -i 's/farrokh/alfred/' "$DATADIR/morphs/hello-stratum.morph" -sed -i 's/master/alfred/' "$DATADIR/morphs/hello-system.morph" -"$SRCDIR/scripts/run-git-in" "$DATADIR/morphs" commit -am goodbye \ - > /dev/null - -# Build second image. -"$SRCDIR/scripts/test-morph" build-morphology \ - test:morphs alfred linux-system -img2=$(find "$DATADIR/cache/artifacts" -maxdepth 1 -name '*.system.*' \ - ! -name $(basename "$img1")) - -# Make the patch. -patch="$DATADIR/patch" -"$SRCDIR/scripts/test-morph" make-patch "$patch" \ - test:morphs master linux-system.morph \ - test:morphs alfred linux-system.morph - -# Big Scary WARNING: The test from here-on down is disabled -# Not because of bugs in Morph but because the images are compressed -# and we have no reliable way within Baserock of uncompressing them -# while maintaining sparseness. Once we can sort that, remove the -# cat and the exit. -cat </dev/null -echo "new version:" -./bin/hello - -echo "Done." - -cd / -umount -d "$device" diff --git a/tests.as-root/make-patch.stdout b/tests.as-root/make-patch.stdout deleted file mode 100644 index b52a681e..00000000 --- a/tests.as-root/make-patch.stdout +++ /dev/null @@ -1,5 +0,0 @@ -old version: -hello, world -new version: -goodbye, world -Done. diff --git a/without-test-modules b/without-test-modules index f143eb46..a69b2c5c 100644 --- a/without-test-modules +++ b/without-test-modules @@ -15,7 +15,6 @@ 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/trebuchet_plugin.py morphlib/plugins/branch_and_merge_plugin.py morphlib/buildcommand.py morphlib/plugins/build_plugin.py -- cgit v1.2.1