summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-10-12 16:09:16 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-10-12 16:09:16 +0000
commit5a430fdf91be1c569d1f1b8d8e3de929a20c2e1b (patch)
treeb60cea79adcdf94458e625df5008fb782b980957
parente3aa8ba25847397a03a665492a0cbe4541814246 (diff)
parentf5b2eb8fe4ea19af7cc2ed76a21784d33c00577a (diff)
downloaddefinitions-5a430fdf91be1c569d1f1b8d8e3de929a20c2e1b.tar.gz
Merge remote-tracking branch 'origin/liw/fix-check-on-squeeze'
-rw-r--r--morphlib/builder2.py7
-rw-r--r--morphlib/plugins/trebuchet_plugin.py5
-rwxr-xr-xtests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script4
-rwxr-xr-xtests.as-root/tarball-image-is-sensible.script6
4 files changed, 16 insertions, 6 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index 856587a2..565fdf4f 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -706,9 +706,10 @@ class DiskImageBuilder(SystemKindBuilder): # pragma: no cover
self.app.status(msg='Compressing disk image',
chatty=True)
with os.fdopen(image_file_fd, "rb") as ifh:
- with gzip.GzipFile(fileobj=handle, mode="wb",
- compresslevel=1) as ofh:
- shutil.copyfileobj(ifh, ofh, 1024 * 1024)
+ ofh = gzip.GzipFile(
+ fileobj=handle, mode="wb", compresslevel=1)
+ shutil.copyfileobj(ifh, ofh, 1024 * 1024)
+ ofh.close()
except:
os.remove(image_name)
diff --git a/morphlib/plugins/trebuchet_plugin.py b/morphlib/plugins/trebuchet_plugin.py
index 1c44bf29..4fa25e91 100644
--- a/morphlib/plugins/trebuchet_plugin.py
+++ b/morphlib/plugins/trebuchet_plugin.py
@@ -40,8 +40,9 @@ class MountableImage(object):
try:
with os.fdopen(tempfd, "wb") as outfh:
- with gzip.open(path, "rb") as infh:
- morphlib.util.copyfileobj(infh, outfh)
+ infh = gzip.open(path, "rb")
+ morphlib.util.copyfileobj(infh, outfh)
+ infh.close()
except:
os.unlink(self.temp_path)
raise
diff --git a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
index c20efff5..ab0186c1 100755
--- a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
+++ b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
@@ -20,6 +20,10 @@
set -eu
+case $(python --version 2>&1) in
+ "Python 2.6"*) exit 0 ;;
+esac
+
cache="$DATADIR/cache/artifacts"
kernelrepo="$DATADIR/kernel-repo"
morphsrepo="$DATADIR/morphs-repo"
diff --git a/tests.as-root/tarball-image-is-sensible.script b/tests.as-root/tarball-image-is-sensible.script
index d1245cbe..717d8e36 100755
--- a/tests.as-root/tarball-image-is-sensible.script
+++ b/tests.as-root/tarball-image-is-sensible.script
@@ -20,7 +20,11 @@
set -eu
-source "$SRCDIR/scripts/fix-committer-info"
+case $(python --version 2>&1) in
+ "Python 2.6"*) exit 0 ;;
+esac
+
+. "$SRCDIR/scripts/fix-committer-info"
tar=$("$SRCDIR/morph" \
--no-default-config --config="$DATADIR/morph.conf" --verbose \