def seed()

in mozci/util/cache_stores.py [0:0]


    def seed(self):
        """Download and extract the seed data to the cache directory."""
        logger.info(
            f"Seeding mozci cache at {self._directory} with contents from {self._url}"
        )
        self._create_cache_directory(self._directory)

        filename = self._url.split("/")[-1]
        with self._session.get(self._url, stream=True) as r:
            r.raise_for_status()

            with tempfile.TemporaryDirectory() as tempdir:
                with tempfile.NamedTemporaryFile(suffix=filename) as fh:
                    shutil.copyfileobj(r.raw, fh)

                    if filename.endswith(".tar.zst"):
                        extract_tar_zst(fh.name, tempdir)
                    else:
                        shutil.unpack_archive(fh.name, tempdir)

                path = tempdir
                if self._archive_relpath:
                    path = os.path.join(tempdir, self._archive_relpath)

                shutil.copytree(path, self._directory, dirs_exist_ok=True)

        # Make sure we don't reseed again for another 'reseed_interval' minutes.
        self.put(self.RESEED_KEY, False, self._reseed_interval)