def get_buildroot_files(regexp=None, inside_buildroot_only=True, exclude_broken_symlinks=True, buildroot_path=None): if not buildroot_path: buildroot_path = get_buildroot() files = set() for dirpath, dirnames, filenames in os.walk(buildroot_path): for filename in filenames: f = os.path.realpath(os.path.join(dirpath, filename)) if inside_buildroot_only: if not f.startswith(buildroot_path): continue if exclude_broken_symlinks: if not os.path.exists(f): continue if regexp: match = re.search(regexp, f) if not match: continue files.add(f) return files
def _find_paths(self): buildroot = config.get_buildroot() paths = [] for dirpath, _, filenames in os.walk(buildroot): for filename in filenames: fpath = os.path.abspath(os.path.join(dirpath, filename)) if self._check_path(fpath): paths.append(fpath) return paths
def get_buildroot_path(self, prefix=None): if not self.path: return None if prefix is None: prefix = config.get_buildroot() return os.path.join(prefix, self.path[1:])