def path_sync_callback(self, src, _): try: mime_type = self.ms.file(src).split(';')[0] except AttributeError: return if not mime_type in ('application/x-executable', 'application/x-sharedlib'): return needed_libs = self._ldlibs(src) for needed_lib in needed_libs: util.path_sync( needed_lib, self.target_root.pjoin(needed_lib), file_copy_callback = self.path_sync_callback )
def install(self, root): src = self.src if self.cachedir: src = self.cachedir full_dest = root.pjoin(self.dest) if not self.keep and self.mountable: util.dbg("Bind mounting %s at %s" % (src, full_dest)) self.mount = util.Mount(src, self.dest, root) util.mount(self.mount, self.istate.mount_points) else: util.path_sync( src, full_dest, root = root, ignore = self.ignore, file_copy_callback = self.file_copy_callback ) return
def copy_files(self): for min_path in self.files: if '*' in min_path: if self.seed: files = glob.glob(self.target_root.pjoin(min_path)) strip_index = len(self.target_root) for i in range(0, len(files)): files[i] = files[i][strip_index:] else: files = glob.glob(min_path) else: files = [ min_path ] for path in files: if self.seed: if not os.path.lexists(self.target_root.pjoin(path)): util.warn('Path (%s,%s) does not exist' % (min_path, path)) continue util.chroot( path = self.target_root, function = util.path_sync, fargs = { 'src': path, 'targ': self.target_root.pjoin(path), 'file_copy_callback': self.path_sync_callback }, failuref = self.chroot_failure ) else: if not os.path.lexists(path): util.warn('Path %s does not exist' % (min_path,)) continue util.path_sync( path, self.target_root.pjoin(path), file_copy_callback = self.path_sync_callback )
def install_portage_conf(self): portage_cr = self.target_root.pjoin(self.env["PORTAGE_CONFIGROOT"] + "/etc/") dest = self.target_root.pjoin("/etc/") util.path_sync(portage_cr, dest)