Esempio n. 1
0
    def __init__(
        self,
        *,
        project: Project,
        build_id: str,
        architectures: Sequence[str],
        git_branch: str = "master",
        core18_channel: str = "stable",
        snapcraft_channel: str = "stable",
        deadline: int = 0,
    ) -> None:
        if not Git.check_command_installed():
            raise errors.GitNotFoundProviderError(provider="Launchpad")

        self._snap_name = project.info.name
        self._build_id = build_id

        self.architectures = architectures

        self._lp_name = build_id
        self._lp_git_branch = git_branch

        self._core18_channel = core18_channel
        self._snapcraft_channel = snapcraft_channel

        self._cache_dir = self._create_cache_directory()
        self._data_dir = self._create_data_directory()
        self._credentials = os.path.join(self._data_dir, "credentials")

        self._lp: Launchpad = self.login()
        self.user = self._lp.me.name

        self.deadline = deadline
Esempio n. 2
0
    def __init__(
        self,
        *,
        project: Project,
        build_id: str,
        user: str,
        architectures: Optional[List[str]] = None,
        git_branch: str = "master",
        core18_channel: str = "stable",
        snapcraft_channel: str = "edge",
    ) -> None:
        if not Git.check_command_installed():
            raise errors.GitNotFoundProviderError(provider="Launchpad")

        self._snap_name = project.info.name
        self._build_id = build_id

        self.architectures = architectures
        self.user = user

        self._lp_name = build_id
        self._lp_git_branch = git_branch

        self._core18_channel = core18_channel
        self._snapcraft_channel = snapcraft_channel

        self._cache_dir = self._create_cache_directory()
        self._data_dir = self._create_data_directory()
        self._credentials = os.path.join(self._data_dir, "credentials")

        self._lp: Launchpad = None
        self._waiting = []  # type: List[str]
Esempio n. 3
0
    def _gitify_repository(self, repo_dir: str) -> Git:
        """Git-ify source repository tree.

        :return: Git handler instance to git repository.
        """
        git_handler = Git(repo_dir, repo_dir, silent=True)

        # Init repo.
        git_handler.init()

        # Add all files found in repo.
        for f in os.listdir(repo_dir):
            if f != ".git":
                git_handler.add(f)

        # Commit files.
        git_handler.commit(f"committed by snapcraft version: {snapcraft.__version__}")

        return git_handler
Esempio n. 4
0
    def _gitify_repository(self, repo_dir: str) -> Git:
        """Git-ify source repository tree.

        :return: Git handler instance to git repository.
        """
        git_handler = Git(repo_dir, repo_dir, silent=True)

        # Init repo.
        git_handler.init()

        # Add all files found in repo.
        for f in os.listdir(repo_dir):
            if f != ".git":
                git_handler.add(f)

        # Commit files.
        timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
        git_handler.commit(
            "snapcraft commit\n\nversion: {}\ntimestamp: {}\n".format(
                snapcraft.__version__, timestamp))

        return git_handler