summaryrefslogtreecommitdiff
path: root/extensions/jffs2.write
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-04 15:17:44 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-11 08:55:05 +0000
commite4c6b8a69f0df2d0b3beac46865a66e0de527151 (patch)
treed837a9768fe2a15557d400301ed8b6588504eb55 /extensions/jffs2.write
parent840292841f4495a79a037f81a26d6b3f51e7cb8c (diff)
downloaddefinitions-e4c6b8a69f0df2d0b3beac46865a66e0de527151.tar.gz
Remove dependencies on morphlib and cliapp from deployment extensionsbaserock/adamcoldrick/remove-dependencies-v3
This is done by either copying some utility functions from morph into writeexts.py, and using the `subprocess` module rather than cliapp's runcmd and ssh_runcmd. Note that this means that these extensions will require "$definitions_checkout/extensions" in PYTHONPATH when they are run. This commit also updates VERSION to 5, since the PYTHONPATH requirement means that this change is incompatible with old versions of morph. Change-Id: Iec6fa7e3c7219619ce55e18493e5c37c36e97816
Diffstat (limited to 'extensions/jffs2.write')
-rw-r--r--extensions/jffs2.write18
1 files changed, 9 insertions, 9 deletions
diff --git a/extensions/jffs2.write b/extensions/jffs2.write
index 46b69a53..ad68204d 100644
--- a/extensions/jffs2.write
+++ b/extensions/jffs2.write
@@ -19,34 +19,34 @@
as the root filesystem.'''
-import cliapp
import os
+import subprocess
-import morphlib.writeexts
+import writeexts
-class Jffs2WriteExtension(morphlib.writeexts.WriteExtension):
+class Jffs2WriteExtension(writeexts.WriteExtension):
'''See jffs2.write.help for documentation.'''
def process_args(self, args):
if len(args) != 2:
- raise cliapp.AppException('Wrong number of command line args')
+ raise writeexts.ExtensionError('Wrong number of command line args')
temp_root, location = args
try:
self.create_jffs2_system(temp_root, location)
self.status(msg='Disk image has been created at %(location)s',
- location = location)
+ location=location)
except Exception:
self.status(msg='Failure to deploy system to %(location)s',
- location = location)
+ location=location)
raise
def create_jffs2_system(self, temp_root, location):
erase_block = self.get_erase_block_size()
- cliapp.runcmd(
+ subprocess.check_call(
['mkfs.jffs2', '--pad', '--no-cleanmarkers',
'--eraseblock='+erase_block, '-d', temp_root, '-o', location])
@@ -54,10 +54,10 @@ class Jffs2WriteExtension(morphlib.writeexts.WriteExtension):
erase_block = os.environ.get('ERASE_BLOCK', '')
if erase_block == '':
- raise cliapp.AppException('ERASE_BLOCK was not given')
+ raise writeexts.ExtensionError('ERASE_BLOCK was not given')
if not erase_block.isdigit():
- raise cliapp.AppException('ERASE_BLOCK must be a whole number')
+ raise writeexts.ExtensionError('ERASE_BLOCK must be a whole number')
return erase_block