Skip to content
Snippets Groups Projects
Commit 3cb967b4 authored by Eduardo Piva's avatar Eduardo Piva Committed by Pekka Enberg
Browse files

upload_manifest: strip objects included in images


With this patch we strip all .so included in our build images,
regardless if it's a debug or a release build.

Basically any object ended with .so is stripped and sent to the
image without the -strip suffix. The code will check if there isn't
already an stripped object and if timestamp matches it, so it won't
strip unecessary files.

Everything outside build/target is ignored.

Fixes #133

Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarEduardo Piva <efpiva@gmail.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 36c42dbc
No related branches found
No related tags found
No related merge requests found
......@@ -90,9 +90,22 @@ def upload(osv, manifest, depends):
+ cpio_field(0, 8) # check
+ filename + '\0')
def strip_file(filename):
stripped_filename = filename
if(filename.endswith(".so") and \
(filename[0] != "/" or filename.startswith(os.getcwd()))):
stripped_filename = filename[:-3] + "-stripped.so"
if(not os.path.exists(stripped_filename) \
or (os.path.getmtime(stripped_filename) < \
os.path.getmtime(filename))):
subprocess.call(["strip", "-o", stripped_filename, filename])
return stripped_filename
# Send the files to the guest
for name, hostname in files:
depends.write('\t%s \\\n' % (hostname,))
hostname = strip_file(hostname)
cpio_send(cpio_header(name, os.stat(hostname).st_size))
with open(hostname, 'r') as f:
cpio_send(f.read())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment