From 9803db01c6d9c624a68e37cee0829176e0906b3b Mon Sep 17 00:00:00 2001 From: Richard Dale Date: Wed, 26 Jun 2013 14:40:00 +0100 Subject: Allow an optional pattern to match files not to be stripped from a chunk --- strip-gplv3.configure | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'strip-gplv3.configure') diff --git a/strip-gplv3.configure b/strip-gplv3.configure index dae357aa..3672d55a 100755 --- a/strip-gplv3.configure +++ b/strip-gplv3.configure @@ -22,38 +22,40 @@ to find the files created by that chunk, then remove them. ''' import cliapp +import re import os import json class StripGPLv3ConfigureExtension(cliapp.Application): gplv3_chunks = [ - 'autoconf', - 'automake', - 'bash', - 'binutils', - 'bison', - 'ccache', - 'cmake', - 'flex', - 'gawk', - 'gdbm', - 'gettext', - 'gperf', - 'groff', - 'libtool', - 'm4', - 'make', - 'nano', - 'texinfo-tarball', + ['autoconf', ''], + ['automake', ''], + ['bash', ''], + ['binutils', ''], + ['bison', ''], + ['ccache', ''], + ['cmake', ''], + ['flex', ''], + ['gawk', ''], + ['gcc', r'^.*lib.*\.so(\.\d+)*$'], + ['gdbm', ''], + ['gettext', ''], + ['gperf', ''], + ['groff', ''], + ['libtool', r'^.*lib.*\.so(\.\d+)*$'], + ['m4', ''], + ['make', ''], + ['nano', ''], + ['texinfo-tarball', ''], ] def process_args(self, args): target_root = args[0] for chunk in self.gplv3_chunks: - self.remove_chunk(target_root, chunk) + self.remove_chunk(target_root, chunk[0], chunk[1]) - def remove_chunk(self, target_root, chunk): + def remove_chunk(self, target_root, chunk, pattern): chunk_meta_path = os.path.join(target_root, 'baserock', chunk + '.meta') @@ -64,8 +66,9 @@ class StripGPLv3ConfigureExtension(cliapp.Application): raise cliapp.AppError('Chunk %s does not have a "contents" list' % chunk) for content_entry in reversed(chunk_meta_data['contents']): - self.remove_content_entry(target_root, content_entry) - + pat = re.compile(pattern) + if len(pattern) == 0 or not pat.match(content_entry): + self.remove_content_entry(target_root, content_entry) os.remove(chunk_meta_path) def remove_content_entry(self, target_root, content_entry): -- cgit v1.2.1