Example #1
0
    def handle_noargs(self, **options):
        db_buildversion = get_pootle_build()

        if db_buildversion and db_buildversion < DEFAULT_POOTLE_BUILDVERSION:
            from pootle_misc.upgrade.schema import staggered_update

            logging.info('Upgrading Pootle database from schema version '
                         '%d to %d', db_buildversion,
                         DEFAULT_POOTLE_BUILDVERSION)
            staggered_update(db_buildversion)
            logging.info('Database upgrade done.')
        elif db_buildversion and db_buildversion > DEFAULT_POOTLE_BUILDVERSION:
            logging.info('Your installation is newer than Pootle 2.5.\n'
                         'You do not need to run this.')
        elif db_buildversion:
            logging.info('No database upgrades required.')

        if db_buildversion:
            new_buildversion = max(db_buildversion,
                                   DEFAULT_POOTLE_BUILDVERSION)
            logging.info('Current schema version: %d', new_buildversion)

        logging.info('THIS UPGRADE SCRIPT HAS BEEN DEPRECATED!')
        logging.info('If you are trying to upgrade Pootle from version 2.5\n'
                     'or older, please read the upgrade instructions at\n'
                     'http://docs.translatehouse.org/projects/pootle/en/'
                     'latest/server/upgrading.html')
Example #2
0
    def handle(self, *args, **options):
        db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
        db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

        ptl_changed = db_ptl_buildversion < CODE_PTL_BUILDVERSION
        tt_changed = db_tt_buildversion < CODE_TTK_BUILDVERSION

        if ptl_changed or tt_changed:
            if ptl_changed:
                logging.info('Detected new Pootle version: %d.',
                             CODE_PTL_BUILDVERSION)
                save_build_version('pootle', CODE_PTL_BUILDVERSION)

            if tt_changed:
                logging.info('Detected new Translate Toolkit version: %d.',
                             CODE_TTK_BUILDVERSION)
                save_build_version('ttk', CODE_TTK_BUILDVERSION)

            # Perform the option related actions.
            if options['calculate_stats']:
                calculate_stats()

            if options['flush_qc']:
                flush_quality_checks()

            logging.info('Done.')
        else:
            logging.info(
                'You are already up to date! Current build versions:\n'
                '- Pootle: %s\n'
                '- Translate Toolkit: %s',
                CODE_PTL_BUILDVERSION,
                CODE_TTK_BUILDVERSION,
            )
Example #3
0
    def handle_noargs(self, **options):
        db_buildversion = get_pootle_build()

        if db_buildversion and db_buildversion < DEFAULT_POOTLE_BUILDVERSION:
            from pootle_misc.upgrade.schema import staggered_update

            logging.info(
                'Upgrading Pootle database from schema version '
                '%d to %d', db_buildversion, DEFAULT_POOTLE_BUILDVERSION)
            staggered_update(db_buildversion)
            logging.info('Database upgrade done.')
        elif db_buildversion and db_buildversion > DEFAULT_POOTLE_BUILDVERSION:
            logging.info('Your installation is newer than Pootle 2.5.\n'
                         'You do not need to run this.')
        elif db_buildversion:
            logging.info('No database upgrades required.')

        if db_buildversion:
            new_buildversion = max(db_buildversion,
                                   DEFAULT_POOTLE_BUILDVERSION)
            logging.info('Current schema version: %d', new_buildversion)

        logging.info('THIS UPGRADE SCRIPT HAS BEEN DEPRECATED!')
        logging.info('If you are trying to upgrade Pootle from version 2.5\n'
                     'or older, please read the upgrade instructions at\n'
                     'http://docs.translatehouse.org/projects/pootle/en/'
                     'latest/server/upgrading.html')
Example #4
0
    def handle(self, *args, **options):
        db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
        db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

        ptl_changed = db_ptl_buildversion < CODE_PTL_BUILDVERSION
        tt_changed = db_tt_buildversion < CODE_TTK_BUILDVERSION

        if ptl_changed or tt_changed:
            if ptl_changed:
                logging.info('Detected new Pootle version: %d.',
                             CODE_PTL_BUILDVERSION)
                save_build_version('pootle', CODE_PTL_BUILDVERSION)

            if tt_changed:
                logging.info('Detected new Translate Toolkit version: %d.',
                             CODE_TTK_BUILDVERSION)
                save_build_version('ttk', CODE_TTK_BUILDVERSION)

            # Perform the option related actions.
            if options['calculate_stats']:
                calculate_stats()

            if options['flush_qc']:
                flush_quality_checks()

            logging.info('Done.')
        else:
            logging.info(
                    'You are already up to date! Current build versions:\n'
                    '- Pootle: %s\n'
                    '- Translate Toolkit: %s',
                CODE_PTL_BUILDVERSION, CODE_TTK_BUILDVERSION,
            )
Example #5
0
    def handle_noargs(self, **options):
        """Run the install or upgrade machinery.

        If there is an up-to-date Pootle setup then no action is performed.
        """
        current_buildversion = get_pootle_build()

        if not current_buildversion:
            logging.info('Setting up a new Pootle installation.')

            call_command('syncdb', interactive=False)
            call_command('migrate')
            call_command('initdb')

            logging.info('Successfully deployed new Pootle.')
        elif current_buildversion < 21010:
            # Trying to upgrade a deployment older than Pootle 2.1.1 for which
            # we can't provide a direct upgrade.
            raise CommandError('This Pootle installation is too old. Please '
                               'upgrade first to 2.1.6 before upgrading to '
                               'this version.')
        elif current_buildversion < NEW_POOTLE_BUILD:
            logging.info('Upgrading existing Pootle installation.')

            if current_buildversion < 22000:
                # Run only if Pootle is < 2.5.0.
                call_command('updatedb')

            call_command('syncdb', interactive=False)

            if current_buildversion < 25100:
                # We are upgrading from a pre-South installation (before Pootle
                # 2.5.1), so it is necessary to fake the first migration for
                # some apps.
                OLD_APPS = ("pootle_app", "pootle_language",
                            "pootle_notifications", "pootle_profile",
                            "pootle_project", "pootle_statistics",
                            "pootle_store", "pootle_translationproject")

                if current_buildversion >= 22000:
                    # Fake the migration only if Pootle is 2.5.0.
                    OLD_APPS += ("staticpages", )

                for app in OLD_APPS:
                    call_command("migrate", app, "0001", fake=True)

            call_command('migrate')
            call_command('upgrade')

            logging.info('Successfully upgraded Pootle.')
        else:
            logging.info('Pootle already was up-to-date. No action has been '
                         'performed.')
Example #6
0
    def handle_noargs(self, **options):
        """Run the install or upgrade machinery.

        If there is an up-to-date Pootle setup then no action is performed.
        """
        current_buildversion = get_pootle_build()

        if not current_buildversion:
            logging.info('Setting up a new Pootle installation.')

            call_command('syncdb', interactive=False)
            call_command('migrate')
            call_command('initdb')

            logging.info('Successfully deployed new Pootle.')
        elif current_buildversion < 21010:
            # Trying to upgrade a deployment older than Pootle 2.1.1 for which
            # we can't provide a direct upgrade.
            raise CommandError('This Pootle installation is too old. Please '
                               'upgrade first to 2.1.6 before upgrading to '
                               'this version.')
        elif current_buildversion < NEW_POOTLE_BUILD:
            logging.info('Upgrading existing Pootle installation.')

            if current_buildversion < 22000:
                # Run only if Pootle is < 2.5.0.
                call_command('updatedb')

            call_command('syncdb', interactive=False)

            if current_buildversion < 25100:
                # We are upgrading from a pre-South installation (before Pootle
                # 2.5.1), so it is necessary to fake the first migration for
                # some apps.
                OLD_APPS = ("pootle_app", "pootle_language",
                            "pootle_notifications", "pootle_profile",
                            "pootle_project", "pootle_statistics",
                            "pootle_store", "pootle_translationproject")

                if current_buildversion >= 22000:
                    # Fake the migration only if Pootle is 2.5.0.
                    OLD_APPS += ("staticpages", )

                for app in OLD_APPS:
                    call_command("migrate", app, "0001", fake=True)

            call_command('migrate')
            call_command('upgrade')

            logging.info('Successfully upgraded Pootle.')
        else:
            logging.info('Pootle already was up-to-date. No action has been '
                         'performed.')
Example #7
0
    def handle(self, *args, **options):
        db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
        db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

        ptl_changed = db_ptl_buildversion < code_ptl_buildversion
        tt_changed = db_tt_buildversion < code_tt_buildversion

        if ptl_changed or tt_changed:

            if ptl_changed:
                logging.info('Detected new Pootle version: %d.',
                             code_ptl_buildversion)
            else:
                db_ptl_buildversion = 0

            if tt_changed:
                logging.info('Detected new Translate Toolkit version: %d.',
                             code_tt_buildversion)
            else:
                db_tt_buildversion = 0

            logging.info('Running the upgrade machinery...')

            from pootle_misc.upgrade import run_upgrade
            run_upgrade(db_ptl_buildversion, code_ptl_buildversion,
                        db_tt_buildversion, code_tt_buildversion)

            if options['calculate_stats']:
                from pootle_misc.upgrade import calculate_stats
                calculate_stats()

            if options['flush_qc']:
                from pootle_misc.upgrade import flush_checks
                flush_checks()

            logging.info('Done.')
        else:
            logging.info(
                    'You are already up to date! Current build versions:\n'
                    '- Pootle: %s\n'
                    '- Translate Toolkit: %s',
                code_ptl_buildversion, code_tt_buildversion,
            )
Example #8
0
    def handle_noargs(self, **options):
        """Run the install or upgrade machinery.

        If there is an up-to-date Pootle setup then no action is performed.
        """
        current_buildversion = get_pootle_build()

        if not current_buildversion:
            logging.info('Setting up a new Pootle installation.')

            call_command('syncdb', interactive=False)
            call_command('migrate')
            call_command('initdb')

            # Ensure we have the assets. Should be necessary only when running
            # from a checkout.
            call_command("collectstatic", clean=True, interactive=False)
            call_command("assets", "build")

            logging.info('Successfully deployed new Pootle.')
        elif current_buildversion < 25999:
            # Trying to upgrade a deployment older than Pootle 2.6.0 for which
            # we can't provide a direct upgrade.
            raise CommandError('This Pootle installation is older than 2.6.0. '
                               'Please upgrade first to 2.6.0 before '
                               'upgrading to this version.')
        elif current_buildversion < NEW_POOTLE_BUILD:
            logging.info('Upgrading existing Pootle installation.')

            call_command('syncdb', interactive=False)
            call_command('migrate')
            call_command('upgrade')

            # Ensure we don't use the old assets after upgrading.
            call_command("collectstatic", clean=True, interactive=False)
            call_command("assets", "build")

            logging.info('Successfully upgraded Pootle.')
        else:
            logging.info('Pootle already was up-to-date. No action has been '
                         'performed.')