Copy patches into results dir, if not compressed (hint for large)
Signed-off-by: Martin J. Bligh <mbligh@google.com>
Also log the local copy and md5 sum of the patch. Example output:
BASE: /usr/local/src/linux-2.6.18.tar.bz2
PATCH: http://mbligh.org/patches/ext2_reservations build/results/ext2_reservations 1b5ad454d9f9e960b56551aada72d132
git-svn-id: http://test.kernel.org/svn/autotest/trunk@646 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/kernel.py b/client/bin/kernel.py
index da725c7..b461cb4 100755
--- a/client/bin/kernel.py
+++ b/client/bin/kernel.py
@@ -116,10 +116,7 @@
# patches = [patches]
print 'Applying patches: ', patches
# self.job.stdout.redirect(os.path.join(self.log_dir, 'stdout'))
- local_patches = self.get_patches(patches)
- for patch in patches:
- self.logfile.write('PATCH: %s\n' % patch)
- self.apply_patches(local_patches)
+ self.apply_patches(self.get_patches(patches))
# self.job.stdout.restore()
@@ -138,9 +135,13 @@
local_patches = []
for patch in patches:
dest = os.path.join(self.src_dir, basename(patch))
+ # FIXME: this isn't unique. Append something to it
+ # like wget does if it's not there?
print "get_file %s %s %s %s" % (patch, dest, self.src_dir, basename(patch))
get_file(patch, dest)
- local_patches.append(dest)
+ # probably safer to use the command, not python library
+ md5sum = system_output('md5sum ' + dest).split()[0]
+ local_patches.append((patch, dest, md5sum))
return local_patches
@@ -151,9 +152,16 @@
if not local_patches:
return None
- for patch in local_patches:
- print 'Patching from', basename(patch), '...'
- cat_file_to_cmd(patch, 'patch -p1 > /dev/null')
+ for (spec, local, md5sum) in local_patches:
+ if local.endswith('.bz2') or local.endswith('.gz'):
+ ref = spec
+ else:
+ ref = force_copy(local, self.results_dir)
+ ref = self.job.relative_path(ref)
+ log = 'PATCH: %s %s %s\n' % (spec, ref, md5sum)
+ print log
+ cat_file_to_cmd(local, 'patch -p1 > /dev/null')
+ self.logfile.write(log)
def get_kernel_tree(self, base_tree):