Exemplo n.º 1
0
    def cmd_pack(self) -> None:
        base_targets = dist.require_targets(self.targets, default="*")
        archive_path = self.get_archive_path()
        common.iprint("Packing archive: {}".format(archive_path))
        with common.tar_context(archive_path, "w") as tar_f:

            def pack_path(rel_path: str) -> None:
                dest_path = self.dest_path_from_rel_path(rel_path)
                packed_name = "rustup/" + rel_path
                common.vprint("[pack] {}".format(rel_path))
                try:
                    tar_f.add(str(dest_path), packed_name)
                except FileNotFoundError:
                    raise error.MissingFileError(str(dest_path))

            def pack_rel_path(rel_path: str) -> None:
                pack_path(rel_path)
                pack_path(integrity.append_hash_suffix(rel_path))

            for spec in self.adjust_wild_specs(self.specs):
                common.iprint("Pack: {}".format(spec))
                version = self.version_from_spec(spec, download=False)
                common.iprint("  version: {}".format(version))

                targets = self.adjust_targets(version, base_targets)
                common.iprint("  targets: {}".format(len(targets)))
                for t in targets:
                    common.vvprint("  target: {}".format(t))

                for target in targets:
                    rel_path = self.rustup_init_rel_path(version, target)
                    pack_rel_path(rel_path)
Exemplo n.º 2
0
    def cmd_pack(self) -> None:
        base_targets = dist.require_targets(self.targets, default="*")
        archive_path = self.get_archive_path()
        common.iprint("Packing archive: {}".format(archive_path))
        with common.tar_context(archive_path, "w") as tar_f:

            def pack_path(rel_path: str) -> None:
                dest_path = self.dest_path_from_rel_path(rel_path)
                packed_name = "dist/" + rel_path
                common.vprint("[pack] {}".format(rel_path))
                try:
                    tar_f.add(str(dest_path), packed_name)
                except FileNotFoundError:
                    raise error.MissingFileError(str(dest_path))

            def pack_rel_path(rel_path: str) -> None:
                pack_path(rel_path)
                pack_path(integrity.append_hash_suffix(rel_path))
                if self._with_sig:
                    pack_path(signature.append_sig_suffix(rel_path))

            for spec in self.adjust_wild_specs(self.specs):
                common.iprint("Pack: {}".format(spec))
                manifest = self.select_manifest(spec,
                                                download=False,
                                                canonical=True)
                common.iprint("  ident: {}".format(manifest.ident))

                targets = self.adjust_targets(manifest, base_targets)
                packages = list(
                    manifest.gen_available_packages(targets=targets))
                common.iprint("  packages: {}, targets: {}".format(
                    len(packages), len(targets)))
                for t in targets:
                    common.vvprint("  target: {}".format(t))

                # Pack channel file.
                pack_rel_path(channel_rel_path(manifest.date,
                                               manifest.channel))

                # Pack up package file parts.
                for package in packages:
                    pack_rel_path(package.rel_path)
Exemplo n.º 3
0
 def cmd_verify(self) -> None:
     specs = self.adjust_wild_specs(self.specs)
     base_targets = dist.require_targets(self.targets, default="*")
     self._download_verify(download=False,
                           specs=specs,
                           base_targets=base_targets)
Exemplo n.º 4
0
 def cmd_download(self) -> None:
     specs = self.adjust_download_specs(self.specs)
     base_targets = dist.require_targets(self.targets)
     self._download_verify(download=True,
                           specs=specs,
                           base_targets=base_targets)