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-10 08:04:53 +0000
commitab90762d9a695118e7a89690c2f3b8c15e247a76 (patch)
treeb4227a6977d6e85a1830d1d97fa8087d9140dc94 /extensions/jffs2.write
parent20dfa465dd7a06c41947002b82ebb318168c18b2 (diff)
downloaddefinitions-ab90762d9a695118e7a89690c2f3b8c15e247a76.tar.gz
Remove dependencies on morphlib and cliapp from deployment extensionsbaserock/adamcoldrick/remove-dependencies
This is done by either copying or reimplementing relevant parts of morphlib/cliapp in extensions/writeexts.py, or by using functionality from the Python standard library instead where appropriate. Note that this means that these extensions will require "$definitions_checkout/extensions" in PYTHONPATH when they are run. This commit also updates VERSION to 6, 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