#!/bin/bash # # Copyright (C) 2012 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 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"