| path: Path, | path: Path, | ||||
| *, | *, | ||||
| repo_dir: Optional[Pathish] = None, | repo_dir: Optional[Pathish] = None, | ||||
| catalog_path: Optional[Pathish] = None, | |||||
| pkg_db_path: Optional[Pathish] = None, | |||||
| default_cwd: Optional[Pathish] = None) -> None: | default_cwd: Optional[Pathish] = None) -> None: | ||||
| self.path = path | self.path = path | ||||
| self.repo_dir = Path(repo_dir or (paths.PREBUILT_DIR / 'ci-repo')) | self.repo_dir = Path(repo_dir or (paths.PREBUILT_DIR / 'ci-repo')) | ||||
| self.catalog_path = Path(catalog_path or (self.repo_dir.parent / 'ci-catalog.db')) | |||||
| self.pkg_db_path = Path(pkg_db_path or (self.repo_dir.parent / 'ci-catalog.db')) | |||||
| self.default_cwd = default_cwd or Path.cwd() | self.default_cwd = default_cwd or Path.cwd() | ||||
| def clone(self: T) -> T: | def clone(self: T) -> T: | ||||
| @property | @property | ||||
| def catalog_path_arg(self) -> str: | def catalog_path_arg(self) -> str: | ||||
| """The arguments for --catalog""" | """The arguments for --catalog""" | ||||
| return f'--catalog={self.catalog_path}' | |||||
| return f'--catalog={self.pkg_db_path}' | |||||
| @property | @property | ||||
| def repo_dir_arg(self) -> str: | def repo_dir_arg(self) -> str: | ||||
| def set_repo_scratch(self, path: Pathish) -> None: | def set_repo_scratch(self, path: Pathish) -> None: | ||||
| self.repo_dir = Path(path) / 'data' | self.repo_dir = Path(path) / 'data' | ||||
| self.catalog_path = Path(path) / 'catalog.db' | |||||
| self.pkg_db_path = Path(path) / 'pkgs.db' | |||||
| def clean(self, *, build_dir: Optional[Path] = None, repo: bool = True, catalog: bool = True) -> None: | |||||
| def clean(self, *, build_dir: Optional[Path] = None, repo: bool = True, pkg_db: bool = True) -> None: | |||||
| """ | """ | ||||
| Clean out prior executable output, including repos, catalog, and | |||||
| Clean out prior executable output, including repos, pkg_db, and | |||||
| the build results at 'build_dir', if given. | the build results at 'build_dir', if given. | ||||
| """ | """ | ||||
| if build_dir and build_dir.exists(): | if build_dir and build_dir.exists(): | ||||
| shutil.rmtree(build_dir) | shutil.rmtree(build_dir) | ||||
| if repo and self.repo_dir.exists(): | if repo and self.repo_dir.exists(): | ||||
| shutil.rmtree(self.repo_dir) | shutil.rmtree(self.repo_dir) | ||||
| if catalog and self.catalog_path.exists(): | |||||
| self.catalog_path.unlink() | |||||
| if pkg_db and self.pkg_db_path.exists(): | |||||
| self.pkg_db_path.unlink() | |||||
| def run(self, args: proc.CommandLine, *, cwd: Optional[Pathish] = None) -> None: | def run(self, args: proc.CommandLine, *, cwd: Optional[Pathish] = None) -> None: | ||||
| """Execute the 'dds' executable with the given arguments""" | """Execute the 'dds' executable with the given arguments""" | ||||
| @property | @property | ||||
| def catalog_path_arg(self) -> str: | def catalog_path_arg(self) -> str: | ||||
| return f'--pkg-db-path={self.catalog_path}' | |||||
| return f'--pkg-db-path={self.pkg_db_path}' | |||||
| @property | @property | ||||
| def project_dir_flag(self) -> str: | def project_dir_flag(self) -> str: |