示例#1
0
文件: distgit.py 项目: FrNecas/packit
 def local_project(self):
     """ return an instance of LocalProject """
     if self._local_project is None:
         pagure_service = PagureService(
             token=self.pagure_user_token,
             instance_url=self.package_config.dist_git_base_url,
             read_only=self.config.dry_run,
         )
         if self.package_config.dist_git_clone_path:
             self._local_project = LocalProject(
                 working_dir=self.package_config.dist_git_clone_path,
                 git_url=self.package_config.dist_git_package_url,
                 namespace=self.package_config.dist_git_namespace,
                 repo_name=self.package_config.downstream_package_name,
                 git_service=pagure_service,
             )
         else:
             tmpdir = tempfile.mkdtemp(prefix="packit-dist-git")
             f = FedPKG(fas_username=self.fas_user, directory=tmpdir)
             f.init_ticket(self.config.keytab_path)
             f.clone(
                 self.package_config.downstream_package_name,
                 tmpdir,
                 anonymous=not cccolutils.has_creds(),
             )
             self._local_project = LocalProject(
                 working_dir=tmpdir,
                 git_url=self.package_config.dist_git_package_url,
                 namespace=self.package_config.dist_git_namespace,
                 repo_name=self.package_config.downstream_package_name,
                 git_service=pagure_service,
             )
             self._local_project.working_dir_temporary = True
     return self._local_project
示例#2
0
 def upload_to_lookaside_cache(self, archive_path: str) -> None:
     """
     Upload files (archive) to the lookaside cache.
     """
     # TODO: can we check if the tarball is already uploaded so we don't have ot re-upload?
     logger.info("About to upload to lookaside cache")
     f = FedPKG(fas_username=self.config.fas_user,
                directory=self.local_project.working_dir)
     f.init_ticket(self.config.keytab_path)
     try:
         f.new_sources(sources=archive_path)
     except Exception as ex:
         logger.error(
             f"'fedpkg new-sources' failed for the following reason: {ex}")
         raise PackitException(ex)
示例#3
0
文件: distgit.py 项目: xsuchy/packit
 def upload_to_lookaside_cache(self, archive_path: str) -> None:
     """
     Upload files (archive) to the lookaside cache.
     """
     # TODO: can we check if the tarball is already uploaded so we don't have ot re-upload?
     logger.info("About to upload to lookaside cache")
     f = FedPKG(self.fas_user, self.local_project.working_dir)
     f.init_ticket()
     try:
         f.new_sources(sources=archive_path)
     except Exception as ex:
         logger.error(
             f"`fedpkg new-sources` failed for some reason. "
             f"Either Fedora kerberos is invalid or there could be network outage."
         )
         raise PackitException(ex)
示例#4
0
    def build(
        self,
        scratch: bool = False,
        nowait: bool = False,
        koji_target: Optional[str] = None,
    ):
        """
        Perform a `fedpkg build` in the repository

        :param scratch: should the build be a scratch build?
        :param nowait: don't wait on build?
        :param koji_target: koji target to pick (see `koji list-targets`)
        """
        fpkg = FedPKG(fas_username=self.fas_user,
                      directory=self.local_project.working_dir)
        fpkg.init_ticket(self.config.keytab_path)
        fpkg.build(scratch=scratch, nowait=nowait, koji_target=koji_target)
示例#5
0
    def local_project(self):
        """ return an instance of LocalProject """
        if self._local_project is None:
            dist_git_project = self.config.get_project(
                url=self.package_config.dist_git_package_url
            )

            if self.package_config.dist_git_clone_path:
                self._local_project = LocalProject(
                    working_dir=self.package_config.dist_git_clone_path,
                    git_url=self.package_config.dist_git_package_url,
                    namespace=self.package_config.dist_git_namespace,
                    repo_name=self.package_config.downstream_package_name,
                    git_project=dist_git_project,
                )
            else:
                tmpdir = tempfile.mkdtemp(prefix="packit-dist-git")
                f = FedPKG(fas_username=self.fas_user, directory=tmpdir)
                f.init_ticket(self.config.keytab_path)
                f.clone(
                    self.package_config.downstream_package_name,
                    tmpdir,
                    anonymous=not cccolutils.has_creds(),
                )
                self._local_project = LocalProject(
                    working_dir=tmpdir,
                    git_url=self.package_config.dist_git_package_url,
                    namespace=self.package_config.dist_git_namespace,
                    repo_name=self.package_config.downstream_package_name,
                    git_project=dist_git_project,
                )
                self._local_project.working_dir_temporary = True
            self._local_project.refresh_the_arguments()
        elif not self._local_project.git_project:
            self._local_project.git_project = self.config.get_project(
                url=self.package_config.dist_git_package_url
            )
            self._local_project.refresh_the_arguments()
        return self._local_project