Ejemplo n.º 1
0
    def install(self, backend):
        """Install the GUI and dependencies."""
        # If the source setting has changed since the last time this was run,
        # get the code, from either a static release or a branch as specified
        # by the souce setting, and install it.
        if backend.different("juju-gui-source"):
            # Get a tarball somehow.
            origin, version_or_branch = utils.parse_source(backend.config["juju-gui-source"])
            if origin == "develop":
                # Develop is the latest passing build from Git.
                origin = "branch"
                version_or_branch = ("https://github.com/juju/juju-gui.git", "develop")

            if origin == "branch":
                logpath = backend.config["command-log-file"]
                # Make sure we have the required build dependencies.
                # Note that we also need to add the juju-gui repository
                # containing our version of nodejs.
                log("Installing build dependencies.")
                utils.install_missing_packages(
                    utils.DEB_BUILD_DEPENDENCIES, repository=backend.config["repository-location"]
                )

                branch_url, revision = version_or_branch
                log("Using source {}: {}".format(branch_url, revision))

                release_tarball_path = utils.fetch_gui_from_branch(branch_url, revision, logpath)
            else:
                release_tarball_path = utils.fetch_gui_release(origin, version_or_branch)
            # Install the tarball.
            utils.setup_gui(release_tarball_path)
        else:
            log("No change to juju-gui-source. Skipping step.")
Ejemplo n.º 2
0
 def test_no_missing(
     self, mock_log, mock_apt_get_install, mock_install_extra_repositories, mock_find_missing_packages
 ):
     # Nothing is installed if no missing packages are found.
     mock_find_missing_packages.return_value = []
     install_missing_packages(self.packages, repository=self.repository)
     mock_find_missing_packages.assert_called_once_with(*self.packages)
     self.assertFalse(mock_install_extra_repositories.called)
     self.assertFalse(mock_apt_get_install.called)
     mock_log.assert_called_once_with("No missing deb packages.")
Ejemplo n.º 3
0
 def test_missing_no_repository(
     self, mock_log, mock_apt_get_install, mock_install_extra_repositories, mock_find_missing_packages
 ):
     # No repositories are installed if not passed.
     mock_find_missing_packages.return_value = ["pkg1", "pkg2"]
     install_missing_packages(self.packages)
     mock_find_missing_packages.assert_called_once_with(*self.packages)
     self.assertFalse(mock_install_extra_repositories.called)
     mock_apt_get_install.assert_called_once_with("pkg1", "pkg2")
     mock_log.assert_called_once_with("Installing deb packages: pkg1, pkg2.")
Ejemplo n.º 4
0
 def test_no_missing(
         self, mock_log, mock_apt_get_install,
         mock_install_extra_repositories, mock_find_missing_packages):
     # Nothing is installed if no missing packages are found.
     mock_find_missing_packages.return_value = []
     install_missing_packages(self.packages, repository=self.repository)
     mock_find_missing_packages.assert_called_once_with(*self.packages)
     self.assertFalse(mock_install_extra_repositories.called)
     self.assertFalse(mock_apt_get_install.called)
     mock_log.assert_called_once_with('No missing deb packages.')
Ejemplo n.º 5
0
 def test_missing_no_repository(
         self, mock_log, mock_apt_get_install,
         mock_install_extra_repositories, mock_find_missing_packages):
     # No repositories are installed if not passed.
     mock_find_missing_packages.return_value = ['pkg1', 'pkg2']
     install_missing_packages(self.packages)
     mock_find_missing_packages.assert_called_once_with(*self.packages)
     self.assertFalse(mock_install_extra_repositories.called)
     mock_apt_get_install.assert_called_once_with('pkg1', 'pkg2')
     mock_log.assert_called_once_with(
         'Installing deb packages: pkg1, pkg2.')
Ejemplo n.º 6
0
 def test_missing(self, mock_log, mock_apt_get_install, mock_install_extra_repositories, mock_find_missing_packages):
     # The extra repository and packages are correctly installed.
     repository = self.repository
     mock_find_missing_packages.return_value = ["pkg1", "pkg2"]
     install_missing_packages(self.packages, repository=repository)
     mock_find_missing_packages.assert_called_once_with(*self.packages)
     mock_install_extra_repositories.assert_called_once_with(repository)
     mock_apt_get_install.assert_called_once_with("pkg1", "pkg2")
     mock_log.assert_has_calls(
         [
             mock.call("Adding the apt repository ppa:my/repository."),
             mock.call("Installing deb packages: pkg1, pkg2."),
         ]
     )
Ejemplo n.º 7
0
 def test_missing(
         self, mock_log, mock_apt_get_install,
         mock_install_extra_repositories, mock_find_missing_packages):
     # The extra repository and packages are correctly installed.
     repository = self.repository
     mock_find_missing_packages.return_value = ['pkg1', 'pkg2']
     install_missing_packages(self.packages, repository=repository)
     mock_find_missing_packages.assert_called_once_with(*self.packages)
     mock_install_extra_repositories.assert_called_once_with(repository)
     mock_apt_get_install.assert_called_once_with('pkg1', 'pkg2')
     mock_log.assert_has_calls([
         mock.call('Adding the apt repository ppa:my/repository.'),
         mock.call('Installing deb packages: pkg1, pkg2.')
     ])
Ejemplo n.º 8
0
    def install(self, backend):
        """Install the GUI and dependencies."""
        # If the source setting has changed since the last time this was run,
        # get the code, from either a static release or a branch as specified
        # by the souce setting, and install it.
        if backend.different('juju-gui-source'):
            # Get a tarball somehow.
            origin, version_or_branch = utils.parse_source(
                backend.config['juju-gui-source'])
            if origin == 'develop':
                # Develop is the latest passing build from Git.
                origin = 'branch'
                version_or_branch = ('https://github.com/juju/juju-gui.git',
                                     'develop')

            if origin == 'branch':
                logpath = backend.config['command-log-file']
                # Make sure we have the required build dependencies.
                # Note that we also need to add the juju-gui repository
                # containing our version of nodejs.
                log('Installing build dependencies.')
                utils.install_missing_packages(
                    utils.DEB_BUILD_DEPENDENCIES,
                    repository=backend.config['repository-location'])

                branch_url, revision = version_or_branch
                log('Using source {}: {}'.format(branch_url, revision))

                release_tarball_path = utils.fetch_gui_from_branch(
                    branch_url, revision, logpath)
            else:
                release_tarball_path = utils.fetch_gui_release(
                    origin, version_or_branch)
            # Install the tarball.
            utils.setup_gui(release_tarball_path)
        else:
            log('No change to juju-gui-source. Skipping step.')
Ejemplo n.º 9
0
 def install(self):
     """Execute the installation steps."""
     log('Installing dependencies.')
     utils.install_missing_packages(self.get_dependencies())
     call_methods(self.mixins, 'install', self)
Ejemplo n.º 10
0
 def install(self):
     """Execute the installation steps."""
     debs, repository = self.get_dependencies()
     log("Installing dependencies.")
     utils.install_missing_packages(debs, repository=repository)
     call_methods(self.mixins, "install", self)