Ejemplo n.º 1
0
    def update(self):
        """
        Downloads the latest source tarball from github and installs it over the existing version.
        """
        try:
            import pip
            sickrage.LOGGER.info("Updating SiCKRAGE from PyPi servers")
            pip.main(['install', '-q', '-U', '--no-cache-dir', 'sickrage'])
        except Exception as e:
            sickrage.LOGGER.error("Error while trying to update: {}".format(e))
            sickrage.LOGGER.debug("Traceback: " + traceback.format_exc())
            return False

        # Notify update successful
        notify_version_update(sickrage.NEWEST_VERSION_STRING)

        return True
Ejemplo n.º 2
0
    def update(self):
        """
        Calls git pull origin <branch> in order to update SiCKRAGE. Returns a bool depending
        on the call's success.
        """

        # update remote origin url
        self.update_remote_origin()

        # remove untracked files and performs a hard reset on git branch to avoid update issues
        if sickrage.GIT_RESET:
            # self.clean() # This is removing user data and backups
            self.reset()

        if self.branch == self._find_installed_version():
            _, _, exit_status = self._run_git(self._git_path,
                                              'pull -f %s %s' % (sickrage.GIT_REMOTE, self.branch))  # @UnusedVariable
        else:
            _, _, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch)  # @UnusedVariable

        if exit_status == 0:
            _, _, exit_status = self._run_git(self._git_path, 'submodule update --init --recursive')

            if exit_status == 0:
                self._find_installed_version()

                # Notify update successful
                if sickrage.NOTIFY_ON_UPDATE:
                    notify_version_update(sickrage.CUR_COMMIT_HASH or "")

                return True

            else:
                return False

        else:
            return False