def _fs_mirror_digester_exit(self, digester): self._assert_current(digester) if self._was_cancelled(): self.wait() return current_mirror = self._current_mirror if digester.returncode != os.EX_OK: msg = "%s %s digester failed unexpectedly" % \ (self.distfile, current_mirror.name) self.scheduler.output(msg + '\n', background=True, log_path=self._log_path) logging.error(msg) else: bad_digest = self._find_bad_digest(digester.digests) if bad_digest is not None: msg = "%s %s has bad %s digest: expected %s, got %s" % \ (self.distfile, current_mirror.name, bad_digest, self.digests[bad_digest], digester.digests[bad_digest]) self.scheduler.output(msg + '\n', background=True, log_path=self._log_path) logging.error(msg) elif self.config.options.dry_run: # Report success without actually touching any files if self._same_device(current_mirror.location, self.config.options.distfiles): logging.info(("dry-run: hardlink '%s' from %s " "to distfiles") % (self.distfile, current_mirror.name)) else: logging.info("dry-run: copy '%s' from %s to distfiles" % (self.distfile, current_mirror.name)) self._success() self.returncode = os.EX_OK self.wait() return else: src = os.path.join(current_mirror.location, self.distfile) dest = os.path.join( self.config.options.distfiles, self.config.layouts[0].get_path(self.distfile)) if self._hardlink_atomic( src, dest, "%s to %s" % (current_mirror.name, "distfiles")): logging.debug("hardlink '%s' from %s to distfiles" % (self.distfile, current_mirror.name)) self._success() self.returncode = os.EX_OK self.wait() return self._start_task( FileCopier(src_path=src, dest_path=dest, background=(self.background and self._log_path is not None), logfile=self._log_path), self._fs_mirror_copier_exit) return self._try_next_mirror()