Ejemplo n.º 1
0
    def spec_build (self, spec_name):
        spec = self.specs[spec_name]
        if self.spec_all_installed (spec):
            return
        checksum_fail_reason = self.failed_checksums.get (spec_name, '')
        if ((not checksum_fail_reason or self.options.lax_checksums)
            and not spec.install_after_build):
            return
        global logger
        if self.options.log == 'build':
            # This is expecially broken with multi-platform builds...
            logger = logging.default_logger
        else:
            if self.options.log == 'platform':
                log = os.path.join (spec.settings.logdir, 'build.log')
            else:
                log = os.path.join (spec.settings.logdir,
                                    misc.strip_platform (spec_name)) + '.log'
            if os.path.isfile (log):
                misc.rename_append_time (log)
            logger = logging.CommandLogger (log, logging.default_logger.threshold)
        if checksum_fail_reason:
            rebuild = 'must'
            if self.options.lax_checksums:
                rebuild = 'should'
            logger.write_log ('%(rebuild)s rebuild: %(spec_name)s\n' % locals (), 'verbose')
        else:
            logger.write_log ('checksum ok: %(spec_name)s\n' % locals (), 'verbose')

        if logging.get_numeric_loglevel ('verbose') > logger.threshold:
            logger.write_log ('\n'.join (checksum_fail_reason.split ('\n')[:10]), 'verbose')
        logger.write_log (checksum_fail_reason, 'output')

        if ((checksum_fail_reason and not self.options.lax_checksums)
            or not self.spec_is_installable (spec)):
            deferred_runner = runner.DeferredRunner (logger)
            spec.connect_command_runner (deferred_runner)
            spec.runner.stage ('building package: %s\n' % spec_name)
            skip = self.get_skip_stages () ### + spec.get_done ()
            skip = [x for x in skip if x != self.options.stage]
            
            spec.build (self.options, skip)
            spec.connect_command_runner (None)
            deferred_runner.execute_deferred_commands ()
            checksum_file = spec.expand ('%(checksum_file)s')
            if checksum_file:
                if len (self.checksums[spec_name].split ('\n')) < 5:
                    # Sanity check.  This can't be right.  Do not
                    # overwrite precious [possibly correct] checksum.
                    raise Exception ('BROKEN CHECKSUM:' + self.checksums[spec_name])
                if os.path.isfile (checksum_file):
                    misc.rename_append_time (checksum_file)
                open (checksum_file, 'w').write (self.checksums[spec_name])
            loggedos.system (logging.default_logger, spec.expand ('rm -f %(stamp_file)s'))
        # Ugh, pkg_install should be stage
        if spec.install_after_build and not self.spec_all_installed (spec):
            logger.write_log (spec.stage_message ('pkg_install'), 'stage')
            self.spec_install (spec)
        logging.default_logger.write_log ('\n', 'stage')
Ejemplo n.º 2
0
def main():
    (options, args) = parse_options()
    # FIXME: local/system; wow that's from two layout changes ago!
    #    os.environ['PATH']= os.getcwd () + '/target/local/system/usr/bin:' + os.environ['PATH']
    #    printf (os.environ['PATH'])

    os.system("mkdir -p log")
    if options.dry_run:
        options.verbosity = logging.get_numeric_loglevel("command")

    logging.set_default_log("log/cron-builder.log", options.verbosity)
    logger = logging.default_logger

    logging.info(" *** Starting cron-builder:\n  %s " % "\n  ".join(args))

    if options.clean:
        # FIXME: what if user changes ~/.gubrc?  should use gubb.Settings!
        loggedos.system(logger, "rm -rf log/ target/ uploads/ buildnumber-* downloads/lilypond-*")

    make_cmd = "make -f lilypond.make %s " % options.make_options
    python_cmd = sys.executable + " "

    branch = options.branch
    local_branch = options.local_branch
    branch_sep = ":"

    # FIXME: what happened to branch juggling?
    if 1:
        local_branch = ""
        branch_sep = ""

    if 0:  # FIXME: use if 1: when --stage download is fixed
        # cannot do this now, --stage=dowload of fontconfig depends on
        # tools freetype-config
        # must build bootstrap first

        # FIXME: use gub-tester's download facility
        # can't have these in gub-tester, since these
        # will always usually result in "release already tested"
        for platform in args:
            loggedos.system(
                logger,
                python_cmd
                + "bin/gub --branch=lilypond=%(local_branch)s%(branch_sep)s:%(branch)s --platform=%(platform)s --stage=download lilypond"
                % locals(),
            )
            loggedos.system(logger, "rm -f target/%(platform)s/status/lilypond-%(branch)s*" % locals())
    else:
        loggedos.system(logger, make_cmd + "bootstrap")

    test_cmds = []
    if 1:
        test_cmds.append(make_cmd + "bootstrap")
    if options.build_package:
        test_cmds += [
            python_cmd
            + "bin/gub --branch=lilypond=%(branch)s%(branch_sep)s%(local_branch)s --skip-if-locked --platform=%(platform)s lilypond"
            % locals()
            for platform in args
        ]

    if options.build_installer:
        version_options = ""

        # installer-builder does not need remote-branch
        test_cmds += [
            python_cmd
            + "bin/gib --skip-if-locked %(version_options)s --branch=lilypond=%(branch)s%(branch_sep)s%(local_branch)s --platform=%(platform)s build-all lilypond"
            % locals()
            for platform in args
        ]

    if options.build_docs:
        test_cmds += [make_cmd + "doc-build", make_cmd + "doc-export"]
        options.test_options += " --dependent"

    if options.build_tarball:
        test_cmds += [make_cmd + "dist-check"]

    loggedos.system(
        logger, python_cmd + "bin/gub-tester %s %s" % (options.test_options, " ".join(["'%s'" % c for c in test_cmds]))
    )
Ejemplo n.º 3
0
    def spec_build(self, spec_name):
        spec = self.specs[spec_name]
        if self.spec_all_installed(spec):
            return
        checksum_fail_reason = self.failed_checksums.get(spec_name, '')
        if ((not checksum_fail_reason or self.options.lax_checksums)
                and not spec.install_after_build):
            return
        global logger
        if self.options.log == 'build':
            # This is expecially broken with multi-platform builds...
            logger = logging.default_logger
        else:
            if self.options.log == 'platform':
                log = os.path.join(spec.settings.logdir, 'build.log')
            else:
                log = os.path.join(spec.settings.logdir,
                                   misc.strip_platform(spec_name)) + '.log'
            if os.path.isfile(log):
                misc.rename_append_time(log)
            logger = logging.CommandLogger(log,
                                           logging.default_logger.threshold)
        if checksum_fail_reason:
            rebuild = 'must'
            if self.options.lax_checksums:
                rebuild = 'should'
            logger.write_log('%(rebuild)s rebuild: %(spec_name)s\n' % locals(),
                             'verbose')
        else:
            logger.write_log('checksum ok: %(spec_name)s\n' % locals(),
                             'verbose')

        if logging.get_numeric_loglevel('verbose') > logger.threshold:
            logger.write_log('\n'.join(checksum_fail_reason.split('\n')[:10]),
                             'verbose')
        logger.write_log(checksum_fail_reason, 'output')

        if ((checksum_fail_reason and not self.options.lax_checksums)
                or not self.spec_is_installable(spec)):
            deferred_runner = runner.DeferredRunner(logger)
            spec.connect_command_runner(deferred_runner)
            spec.runner.stage('building package: %s\n' % spec_name)
            skip = self.get_skip_stages()  ### + spec.get_done ()
            skip = [x for x in skip if x != self.options.stage]

            spec.build(self.options, skip)
            spec.connect_command_runner(None)
            deferred_runner.execute_deferred_commands()
            checksum_file = spec.expand('%(checksum_file)s')
            if checksum_file:
                if len(self.checksums[spec_name].split('\n')) < 5:
                    # Sanity check.  This can't be right.  Do not
                    # overwrite precious [possibly correct] checksum.
                    raise Exception('BROKEN CHECKSUM:' +
                                    self.checksums[spec_name])
                if os.path.isfile(checksum_file):
                    misc.rename_append_time(checksum_file)
                open(checksum_file, 'w').write(self.checksums[spec_name])
            loggedos.system(logging.default_logger,
                            spec.expand('rm -f %(stamp_file)s'))
        # Ugh, pkg_install should be stage
        if spec.install_after_build and not self.spec_all_installed(spec):
            logger.write_log(spec.stage_message('pkg_install'), 'stage')
            self.spec_install(spec)
        logging.default_logger.write_log('\n', 'stage')
Ejemplo n.º 4
0
def main():
    (options, args) = parse_options()
    # FIXME: local/system; wow that's from two layout changes ago!
    #    os.environ['PATH']= os.getcwd () + '/target/local/system/usr/bin:' + os.environ['PATH']
    #    printf (os.environ['PATH'])

    os.system('mkdir -p log')
    if options.dry_run:
        options.verbosity = logging.get_numeric_loglevel('command')

    logging.set_default_log('log/cron-builder.log', options.verbosity)
    logger = logging.default_logger

    logging.info(' *** Starting cron-builder:\n  %s ' % '\n  '.join(args))

    if options.clean:
        # FIXME: what if user changes ~/.gubrc?  should use gubb.Settings!
        loggedos.system(
            logger,
            'rm -rf log/ target/ uploads/ buildnumber-* downloads/lilypond-*')

    make_cmd = 'make -f lilypond.make %s ' % options.make_options
    python_cmd = sys.executable + ' '

    branch = options.branch
    local_branch = options.local_branch
    branch_sep = ':'

    # FIXME: what happened to branch juggling?
    if 1:
        local_branch = ''
        branch_sep = ''

    if 0:  #FIXME: use if 1: when --stage download is fixed
        # cannot do this now, --stage=dowload of fontconfig depends on
        # tools freetype-config
        # must build bootstrap first

        # FIXME: use gub-tester's download facility
        # can't have these in gub-tester, since these
        # will always usually result in "release already tested"
        for platform in args:
            loggedos.system(
                logger, python_cmd +
                'bin/gub --branch=lilypond=%(local_branch)s%(branch_sep)s:%(branch)s --platform=%(platform)s --stage=download lilypond'
                % locals())
            loggedos.system(
                logger,
                'rm -f target/%(platform)s/status/lilypond-%(branch)s*' %
                locals())
    else:
        loggedos.system(logger, make_cmd + 'bootstrap')

    test_cmds = []
    if 1:
        test_cmds.append(make_cmd + 'bootstrap')
    if options.build_package:
        test_cmds += [
            python_cmd +
            'bin/gub --branch=lilypond=%(branch)s%(branch_sep)s%(local_branch)s --skip-if-locked --platform=%(platform)s lilypond'
            % locals() for platform in args
        ]

    if options.build_installer:
        version_options = ''

        # installer-builder does not need remote-branch
        test_cmds += [
            python_cmd +
            'bin/gib --skip-if-locked %(version_options)s --branch=lilypond=%(branch)s%(branch_sep)s%(local_branch)s --platform=%(platform)s build-all lilypond'
            % locals() for platform in args
        ]

    if options.build_docs:
        test_cmds += [make_cmd + 'doc-build', make_cmd + 'doc-export']
        options.test_options += ' --dependent'

    if options.build_tarball:
        test_cmds += [make_cmd + 'dist-check']

    loggedos.system(
        logger, python_cmd + 'bin/gub-tester %s %s' %
        (options.test_options, ' '.join(["'%s'" % c for c in test_cmds])))