diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 397: fix MasterImageTarget.file_system to propagate deletes from host to target

Message ID 20121009022412.25860.78300.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Oct. 9, 2012, 2:24 a.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-dispatcher/MasterImageTarget.file_system-propgagates-deletes/+merge/128599
  proposed by: Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 397 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Tue 2012-10-09 15:23:06 +1300
message:
  fix MasterImageTarget.file_system to propagate deletes from host to target
modified:
  lava_dispatcher/device/master.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/device/master.py'
--- lava_dispatcher/device/master.py	2012-10-02 02:53:01 +0000
+++ lava_dispatcher/device/master.py	2012-10-09 02:05:17 +0000
@@ -223,6 +223,8 @@ 
             raise RuntimeError(
                 'unknown master image partition(%d)' % partition)
 
+        assert directory != '/', "cannot mount entire partition"
+
         with self._as_master() as runner:
             if partition == self.config.data_part_android_org:
                 lbl = _android_data_label(runner)
@@ -234,7 +236,9 @@ 
                 if not runner.is_file_exist(targetdir):
                     runner.run('mkdir %s' % targetdir)
 
-                runner.run('tar -czf /tmp/fs.tgz -C %s ./' % targetdir)
+                parent_dir, target_name = os.path.split(targetdir)
+
+                runner.run('tar -czf /tmp/fs.tgz -C %s %s' % (parent_dir, target_name))
                 runner.run('cd /tmp')  # need to be in same dir as fs.tgz
                 self.proc.sendline('python -m SimpleHTTPServer 0 2>/dev/null')
                 match_id = self.proc.expect([
@@ -254,7 +258,7 @@ 
                 try:
                     os.mkdir(tfdir)
                     logging_system('tar -C %s -xzf %s' % (tfdir, tf))
-                    yield tfdir
+                    yield os.path.join(tfdir, target_name)
 
                 finally:
                     tf = os.path.join(self.scratch_dir, 'fs')
@@ -266,7 +270,8 @@ 
                     # get the last 2 parts of tf, ie "scratchdir/tf.tgz"
                     tf = '/'.join(tf.split('/')[-2:])
                     url = '%s/%s' % (self.context.config.lava_image_url, tf)
-                    self.target_extract(runner, url, targetdir)
+                    runner.run('rm -rf %s' % targetdir)
+                    self.target_extract(runner, url, parent_dir)
 
             finally:
                     self.proc.sendcontrol('c')  # kill SimpleHTTPServer