def _read_module(self, module): config = ConfigParser(self.schemas_module) config.read("%s/%s" % (module, self.config_name)) for section in iter(config): real = ('module', section[-1], module) + section[1:] s = self.get(real, {}) s.update(config[section]) self[real] = s
def _read_base(self): config = ConfigParser(self.schemas_base) config.read(self.config_name) for section in iter(config): real = ('module', section[-1],) + section[1:] self[real] = config[section] for module in config['base',]['modules']: self._read_module(module)
def _read_package(self, package): config = ConfigParser(self.schemas) config.read("%s/%s" % (package, self.config_name)) for section in iter(config): if len(section) > 1: real = (section[-1], package, "_".join(section[:-1])) else: real = (section[-1], package) s = self.get(real, {}) s.update(config[section]) self[real] = s
def _read_base(self): config = ConfigParser(self.schemas) config.read(self.config_name) packages = config["base",]["packages"] for section in iter(config): real = (section[-1],) + section[:-1] self[real] = config[section] for package in packages: self._read_package(package)
def _read_package(self, package): config = ConfigParser(self.schemas) config.read("%s/%s" % (package, self.config_name)) for section in iter(config): if len(section) > 1: real = (section[-1], package, '_'.join(section[:-1])) else: real = (section[-1], package) s = self.get(real, {}) s.update(config[section]) self[real] = s
def _read_base(self): config = ConfigParser(self.schemas) config.read(self.config_name) packages = config['base', ]['packages'] for section in iter(config): real = (section[-1], ) + section[:-1] self[real] = config[section] for package in packages: self._read_package(package)
def _read_base(self): config = ConfigParser(self.schemas) config.read("debian/config/%s" % self.config_name) packages = config['base',]['packages'] for section in iter(config): real = (section[-1],) + section[:-1] self[real] = config[section] for package in packages: self._read_package(package)
def main(source_dir): config = ConfigParser({ 'base': { 'packages': SchemaItemList() }, 'upstream': { 'exclude': SchemaItemList() }, }) config.read('defines') dest_dirs = config['base', ]['packages'] exclusions = config['upstream', ]['exclude'] for section in FirmwareWhence(open(os.path.join(source_dir, 'WHENCE'))): if re.search( r'^BSD\b' r'|^GPLv2 or OpenIB\.org BSD\b' r'|\bPermission\s+is\s+hereby\s+granted\s+for\s+the\s+' r'distribution\s+of\s+this\s+firmware\s+(?:data|image)\b' r'(?!\s+as\s+part\s+of)' r'|\bRedistribution\s+and\s+use\s+in(?:\s+source\s+and)?' r'\s+binary\s+forms\b' r'|\bPermission\s+is\s+hereby\s+granted\b[^.]+\sto' r'\s+deal\s+in\s+the\s+Software\s+without' r'\s+restriction\b' r'|\bredistributable\s+in\s+binary\s+form\b', section.licence): # Suitable for main if source is available; non-free otherwise maybe_free = True pass elif re.match(r'^(?:D|Red)istributable\b', section.licence): # Only suitable for non-free maybe_free = False pass elif re.match(r'^GPL(?:v2|\+)?\b', section.licence): # Suitable for main if source is available; not distributable # otherwise continue else: # Probably not distributable continue for file_info in section.files.values(): if (not (maybe_free and (file_info.source or file_info.binary.endswith('.cis'))) and not any( fnmatch.fnmatch(file_info.binary, exclusion) for exclusion in exclusions)): update_file(source_dir, dest_dirs, file_info.binary)
def main(source_dir): config = ConfigParser({ 'base': {'packages': SchemaItemList()}, 'upstream': {'exclude': SchemaItemList()}, }) config.read('defines') dest_dirs = config['base',]['packages'] exclusions = config['upstream',]['exclude'] for section in FirmwareWhence(open(os.path.join(source_dir, 'WHENCE'))): if re.search(r'^BSD\b' r'|^GPLv2 or OpenIB\.org BSD\b' r'|\bPermission\s+is\s+hereby\s+granted\s+for\s+the\s+' r'distribution\s+of\s+this\s+firmware\s+(?:data|image)\b' r'(?!\s+as\s+part\s+of)' r'|\bRedistribution\s+and\s+use\s+in(?:\s+source\s+and)?' r'\s+binary\s+forms\b' r'|\bPermission\s+is\s+hereby\s+granted\b[^.]+\sto' r'\s+deal\s+in\s+the\s+Software\s+without' r'\s+restriction\b' r'|\bredistributable\s+in\s+binary\s+form\b', section.licence): # Suitable for main if source is available; non-free otherwise maybe_free = True pass elif re.match(r'^(?:D|Red)istributable\b', section.licence): # Only suitable for non-free maybe_free = False pass elif re.match(r'^GPL(?:v2|\+)?\b', section.licence): # Suitable for main if source is available; not distributable # otherwise continue else: # Probably not distributable continue for file_info in section.files.values(): if (not (maybe_free and (file_info.source or file_info.binary.endswith('.cis'))) and not any(fnmatch.fnmatch(file_info.binary, exclusion) for exclusion in exclusions)): update_file(source_dir, dest_dirs, file_info.binary)