예제 #1
0
파일: boost.py 프로젝트: PhilHolmes/gub
def replace_links (logger, file):
    if os.path.islink (file):
        link = os.readlink (file)
        loggedos.system (logger, '''
rm %(file)s
cp %(link)s %(file)s
''' % locals ())
예제 #2
0
파일: gup.py 프로젝트: alepharchives/gub
 def make_dirs (self):
     if not os.path.isdir (self.config):
         loggedos.system (logging.default_logger,
                          'mkdir -p %s' % self.config)
     if not os.path.isdir (self.root):
         loggedos.system (logging.default_logger,
                          'mkdir -p %s' % self.root)
예제 #3
0
파일: gup.py 프로젝트: jrioux/gub
 def make_dirs (self):
     if not os.path.isdir (self.config):
         loggedos.system (gub_log.default_logger,
                          'mkdir -p %s' % self.config)
     if not os.path.isdir (self.root):
         loggedos.system (gub_log.default_logger,
                          'mkdir -p %s' % self.root)
예제 #4
0
def system(cmd, env={}, ignore_errors=False):
    call_env = os.environ.copy()
    call_env.update(env)
    for i in cmd.split('\n'):
        if i:
            loggedos.system(logging.default_logger, i % env, call_env,
                            ignore_errors)
예제 #5
0
파일: build.py 프로젝트: epronk/gub
 def copy_readme(logger, file):
     if (
         os.path.isfile(file)
         and not os.path.basename(file).startswith("Makefile")
         and not os.path.basename(file).startswith("GNUmakefile")
     ):
         loggedos.system(logger, self.expand("cp %(file)s %(install_prefix)s/share/doc/%(name)s", locals()))
예제 #6
0
def replace_links(logger, file):
    if os.path.islink(file):
        link = os.readlink(file)
        loggedos.system(logger, '''
rm %(file)s
cp %(link)s %(file)s
''' % locals())
예제 #7
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 = gub_log.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 = gub_log.CommandLogger (log, gub_log.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 gub_log.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 (gub_log.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)
        gub_log.default_logger.write_log ('\n', 'stage')
예제 #8
0
 def copy(logger, plain_name):
     base_name = os.path.basename(plain_name)
     full_name = self.expand(
         '%(install_prefix)s%(cross_dir)s/bin/%(toolchain_prefix)s%(base_name)s',
         env=locals())
     if not os.path.exists(full_name):
         loggedos.system(logger,
                         'cp %(plain_name)s %(full_name)s' % locals())
예제 #9
0
파일: build.py 프로젝트: marnen/gub
 def copy_readme(logger, file):
     if (os.path.isfile(file)
             and not os.path.basename(file).startswith('Makefile')
             and not os.path.basename(file).startswith('GNUmakefile')):
         loggedos.system(
             logger,
             self.expand(
                 'cp %(file)s %(install_prefix)s/share/doc/%(name)s',
                 locals()))
예제 #10
0
파일: build.py 프로젝트: epronk/gub
 def add_exe(logger_why_already_in_self, file):
     if (
         not os.path.islink(file)
         and not os.path.splitext(file)[1]
         and loggedos.read_pipe(
             logger_why_already_in_self, self.expand("file -b %(file)s", locals())
         ).startswith("MS-DOS executable PE")
     ):
         loggedos.system(logger_why_already_in_self, self.expand("mv %(file)s %(file)s.exe", locals()))
예제 #11
0
파일: binutils.py 프로젝트: jrioux/gub
 def copy(logger, full_name):
     base_name = (os.path.basename(self.expand(full_name)).replace(
         self.expand('%(toolchain_prefix)s'), ''))
     plain_name = self.expand(
         '%(install_prefix)s%(cross_dir)s/%(target_architecture)s/bin/%(base_name)s',
         env=locals())
     if not os.path.exists(plain_name):
         loggedos.system(logger,
                         'cp %(full_name)s %(plain_name)s' % locals())
예제 #12
0
파일: build.py 프로젝트: PhilHolmes/gub
        def install (logger, lst):
            for file in lst:
                if os.path.exists (file):
                    cmd = self.expand ('''
mkdir -p %(install_root)s/license
cp %(file)s %(install_root)s/license/%(name)s
''', locals ())
                    loggedos.system (logger, cmd)
                    return
예제 #13
0
파일: build.py 프로젝트: marnen/gub
        def install(logger, lst):
            for file in lst:
                if os.path.exists(file):
                    cmd = self.expand(
                        '''
mkdir -p %(install_root)s/license
cp %(file)s %(install_root)s/license/%(name)s
''', locals())
                    loggedos.system(logger, cmd)
                    return
예제 #14
0
파일: build.py 프로젝트: marnen/gub
 def add_exe(logger_why_already_in_self, file):
     if (not os.path.islink(file) and not os.path.splitext(file)[1]
             and loggedos.read_pipe(
                 logger_why_already_in_self,
                 self.expand(
                     'file -b %(file)s',
                     locals())).startswith('MS-DOS executable PE')):
         loggedos.system(
             logger_why_already_in_self,
             self.expand('mv %(file)s %(file)s.exe', locals()))
예제 #15
0
파일: tools.py 프로젝트: alepharchives/gub
        def wrap (logger, file):
            dir = os.path.dirname (file)
            base = os.path.basename (file)
            cmd = self.expand ('mv %(file)s %(dir)s/.%(base)s', locals ())
            loggedos.system (logger, cmd)
            loggedos.dump_file (logger, self.expand ('''#!/bin/sh
LD_LIBRARY_PATH=%(system_prefix)s/lib
%(system_prefix)s/bin/.%(base)s "$@"
''', locals ()), file)
            loggedos.chmod (logger, file, octal.o755)
예제 #16
0
파일: gcc.py 프로젝트: epronk/gub
 def rewire_one (logger, file):
     found_skips = [s for s in skip_libs if file.find (s) >= 0]
     if found_skips:
         return
     id = loggedos.read_pipe (logger,
                              self.expand ('%(toolchain_prefix)sotool -L %(file)s', 
                                          locals ()),
                              env=self.get_substitution_dict ()).split ()[1]
     id = os.path.split (id)[1]
     loggedos.system (logger, 
                      self.expand ('%(toolchain_prefix)sinstall_name_tool -id /usr/lib/%(id)s %(file)s',
                                   locals ()),
                      env=self.get_substitution_dict ())
예제 #17
0
 def rewire_one (logger, file):
     found_skips = [s for s in skip_libs if file.find (s) >= 0]
     if found_skips:
         return
     id = loggedos.read_pipe (logger,
                              self.expand ('%(toolchain_prefix)sotool -L %(file)s', 
                                          locals ()),
                              env=self.get_substitution_dict ()).split ()[1]
     id = os.path.split (id)[1]
     loggedos.system (logger, 
                      self.expand ('%(toolchain_prefix)sinstall_name_tool -id /usr/lib/%(id)s %(file)s',
                                   locals ()),
                      env=self.get_substitution_dict ())
예제 #18
0
파일: tools.py 프로젝트: alepharchives/gub
        def wrap(logger, file):
            dir = os.path.dirname(file)
            base = os.path.basename(file)
            cmd = self.expand('mv %(file)s %(dir)s/.%(base)s', locals())
            loggedos.system(logger, cmd)
            loggedos.dump_file(
                logger,
                self.expand(
                    '''#!/bin/sh
LD_LIBRARY_PATH=%(system_prefix)s/lib
%(system_prefix)s/bin/.%(base)s "$@"
''', locals()), file)
            loggedos.chmod(logger, file, octal.o755)
예제 #19
0
파일: commands.py 프로젝트: epronk/gub
    def execute (self, logger):
        buildspec = self.buildspec 
        if not buildspec.source:
            return False
        if not buildspec.source.is_tracking ():
            command = buildspec.expand ('rm -rf %(srcdir)s %(builddir)s %(install_root)s')
            loggedos.system (logger, command)

        if buildspec.source:
            buildspec.source.update_workdir (buildspec.expand ('%(srcdir)s'))

        # TODO: move this to Repository
        if (os.path.isdir (buildspec.expand ('%(srcdir)s'))):
            cmd = buildspec.expand ('chmod -R +w %(srcdir)s')
            loggedos.system (logger, cmd, ignore_errors=True)
예제 #20
0
    def execute(self, logger):
        buildspec = self.buildspec
        if not buildspec.source:
            return False
        if not buildspec.source.is_tracking():
            command = buildspec.expand(
                'rm -rf %(srcdir)s %(builddir)s %(install_root)s')
            loggedos.system(logger, command)

        if buildspec.source:
            buildspec.source.update_workdir(buildspec.expand('%(srcdir)s'))

        # TODO: move this to Repository
        if (os.path.isdir(buildspec.expand('%(srcdir)s'))):
            cmd = buildspec.expand('chmod -R +w %(srcdir)s')
            loggedos.system(logger, cmd, ignore_errors=True)
예제 #21
0
파일: gup.py 프로젝트: jbenham2015/gub
    def install_tarball(self, ball, name, prefix_dir):
        gub_log.action('untarring: %(ball)s\n' % locals())

        _z = misc.compression_flag(ball)
        _v = ''  # self.os_interface.verbose_flag ()
        lst = loggedos.read_pipe(gub_log.default_logger,
                                 'tar -t%(_z)s -f "%(ball)s"' %
                                 locals()).split('\n')
        conflicts = False
        installed_files = self.installed_files()
        installed_files_string = ':'.join([''] + installed_files + [''])
        misc.timing()
        for f in lst:
            if (':' + f + ':' in installed_files_string
                    and not os.path.isdir(os.path.join(self.root, f))):
                package = self._file_package_db[f]
                gub_log.error('already have file %(f)s: %(package)s\n' %
                              locals())
                conflicts = True
        gub_log.command('GUP: for f in lst:' + misc.timing() + '\n')
        if conflicts and not self.is_distro:
            raise Exception('Duplicate files found.')
        root = self.root
        loggedos.system(
            gub_log.default_logger,
            # cd %(root)s to avoid open(2) of cwd, see
            # http://lists.gnu.org/archive/html/lilypond-devel/2009-03/msg00304.html
            'cd %(root)s && tar -C %(root)s -p -x%(_z)s%(_v)s -f %(ball)s' %
            locals())
        for f in lst:
            if f.endswith('.la'):
                self.libtool_la_fixup(root, f)
            if f.endswith('.pc'):
                self.pkgconfig_pc_fixup(root, f, prefix_dir)

        self._package_file_db[name] = '\n'.join(lst)
        for f in lst:
            # ignore directories.
            if not f.endswith('/'):
                self._file_package_db[f] = name

        if os.path.exists('%(root)s/usr/etc/postinstall/%(name)s' % locals()):
            loggedos.system(
                gub_log.default_logger,
                'PATH=%(root)s/usr/bin:$PATH %(root)s/usr/etc/postinstall/%(name)s && mv %(root)s/usr/etc/postinstall/%(name)s %(root)s/usr/etc/postinstall/%(name)s.done || :'
                % locals())
예제 #22
0
파일: gup.py 프로젝트: alepharchives/gub
    def install_tarball (self, ball, name, prefix_dir):
        logging.action ('untarring: %(ball)s\n' % locals ())

        _z = misc.compression_flag (ball)
        _v = '' # self.os_interface.verbose_flag ()
        lst = loggedos.read_pipe (logging.default_logger,
                                  'tar -t%(_z)s -f "%(ball)s"'
                                  % locals ()).split ('\n')
        conflicts = False
        installed_files = self.installed_files ()
        installed_files_string = ':'.join ([''] + installed_files + [''])
        misc.timing ()
        for f in lst:
            if (':' + f + ':' in installed_files_string
                and not os.path.isdir (os.path.join (self.root, f))):
                package = self._file_package_db[f]
                logging.error ('already have file %(f)s: %(package)s\n'
                               % locals ())
                conflicts = True
        logging.command ('GUP: for f in lst:' + misc.timing () + '\n')
        if conflicts and not self.is_distro:
            raise Exception ('Duplicate files found.')
        root = self.root
        loggedos.system (logging.default_logger,
                         # cd %(root)s to avoid open(2) of cwd, see
                         # http://lists.gnu.org/archive/html/lilypond-devel/2009-03/msg00304.html
                         'cd %(root)s && tar -C %(root)s -p -x%(_z)s%(_v)s -f %(ball)s'
                         % locals ())
        for f in lst:
            if f.endswith ('.la'):
                self.libtool_la_fixup (root, f)
            if f.endswith ('.pc'):
                self.pkgconfig_pc_fixup (root, f, prefix_dir)

        self._package_file_db[name] = '\n'.join (lst)
        for f in lst:
            # ignore directories.
            if not f.endswith ('/'):
                self._file_package_db[f] = name

        if os.path.exists ('%(root)s/usr/etc/postinstall/%(name)s' % locals ()):
            loggedos.system (logging.default_logger,
                             'PATH=%(root)s/usr/bin:$PATH %(root)s/usr/etc/postinstall/%(name)s && mv %(root)s/usr/etc/postinstall/%(name)s %(root)s/usr/etc/postinstall/%(name)s.done || :' % locals ())
예제 #23
0
파일: commands.py 프로젝트: epronk/gub
    def execute (self, logger):
        root = self.root
        suffix_dir = self.suffix_dir
        dest = self.dest

        globs = list ()
        for f in self.globs:
            f = re.sub ('/+', '/', f)
            if f.startswith ('/'):
                f = f[1:]
            for exp in glob.glob (os.path.join (self.root, f)):
                globs.append (exp.replace (root, './').replace ('//', '/'))
        if not globs:
            globs.append ('no-globs-for-%(dest)s' % locals ())

        _v = logger.verbose_flag ()
        cmd = 'tar -C %(root)s/%(suffix_dir)s --ignore-failed --exclude="*~"%(_v)s -zcf %(dest)s ' % locals ()
        cmd += ' '.join (globs)
        loggedos.system (logger, cmd)
예제 #24
0
    def execute(self, logger):
        root = self.root
        suffix_dir = self.suffix_dir
        dest = self.dest

        globs = list()
        for f in self.globs:
            f = re.sub('/+', '/', f)
            if f.startswith('/'):
                f = f[1:]
            for exp in glob.glob(os.path.join(self.root, f)):
                globs.append(exp.replace(root, './').replace('//', '/'))
        if not globs:
            globs.append('no-globs-for-%(dest)s' % locals())

        _v = logger.verbose_flag()
        cmd = 'tar -C %(root)s/%(suffix_dir)s --ignore-failed --exclude="*~"%(_v)s -zcf %(dest)s ' % locals(
        )
        cmd += ' '.join(globs)
        loggedos.system(logger, cmd)
예제 #25
0
파일: commands.py 프로젝트: epronk/gub
    def execute (self, logger):
        logger.write_log ('Creating shar file from %s\n' % repr (self.kwargs), 'info') 
        name = self.kwargs['name']
        pretty_name = self.kwargs['pretty_name']
        release = self.kwargs['release']
        shar_file = self.kwargs['shar_file']
        shar_head = self.kwargs['shar_head']
        tarball = self.kwargs['tarball']
        version = self.kwargs['version']

        length = os.stat (tarball)[6]
        base_file = os.path.split (tarball)[1]
        script = loggedos.read_file (logger, shar_head)
        header_length = 0
        _z = misc.compression_flag (tarball)
        header_length = len (script % locals ()) + 1
        used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(_z)s'
        used_in_sharhead % locals ()
        loggedos.dump_file (logger, script % locals (), shar_file)
        loggedos.system (logger, 'cat %(tarball)s >> %(shar_file)s' % locals ())
        loggedos.chmod (logger, shar_file, octal.o755)
        loggedos.system (logger, 'rm %(tarball)s' % locals ())
예제 #26
0
파일: gup.py 프로젝트: jbenham2015/gub
    def __init__(self, root, dbdir=None, clean=False):
        self.root = os.path.normpath(root)
        if dbdir:
            self.config = dbdir
        else:
            self.config = self.root + '/etc/gup'

        self.config = os.path.normpath(self.config)
        self.verbose = True
        self.is_distro = False

        ## lock must be outside of root, otherwise we can't rm -rf root
        # UGH, /GUB
        self.lock_file = self.root + '.lock'
        self.lock = locker.Locker(self.lock_file)
        if clean:
            loggedos.system(gub_log.default_logger, 'rm -fr %s' % self.config)
        self.make_dirs()
        files_db = self.config + '/files.db'
        packages_db = self.config + '/packages.db'
        self._file_package_db = db.open(files_db, 'c')
        self._package_file_db = db.open(packages_db, 'c')
예제 #27
0
파일: gup.py 프로젝트: alepharchives/gub
    def __init__ (self, root, dbdir=None, clean=False):
        self.root = os.path.normpath (root)
        if dbdir:
            self.config = dbdir
        else:
            self.config = self.root + '/etc/gup'

        self.config = os.path.normpath (self.config)
        self.verbose = True
        self.is_distro = False

        ## lock must be outside of root, otherwise we can't rm -rf root
        # UGH, /GUB
        self.lock_file = self.root + '.lock'
        self.lock = locker.Locker (self.lock_file)
        if clean:
            loggedos.system (logging.default_logger,
                             'rm -fr %s' % self.config)
        self.make_dirs ()
        files_db = self.config + '/files.db'
        packages_db = self.config + '/packages.db'
        self._file_package_db = db.open (files_db, 'c')
        self._package_file_db = db.open (packages_db, 'c')
예제 #28
0
파일: build.py 프로젝트: marnen/gub
def libtool_update(logger, libtool, file):
    if not os.path.exists(libtool):
        message = 'Cannot update libtool: no such file: %(libtool)s' % locals()
        logger.write_log(message, 'error')
        raise Exception(message)
    loggedos.system(logger, 'cp %(file)s %(file)s~' % locals())
    loggedos.system(logger, 'cp %(libtool)s %(file)s' % locals())
    libtool_disable_install_not_into_dot_libs_test(logger, file)
    loggedos.system(logger, 'chmod 755  %(file)s' % locals())
예제 #29
0
파일: build.py 프로젝트: PhilHolmes/gub
def libtool_update (logger, libtool, file):
    if not os.path.exists (libtool):
        message = 'Cannot update libtool: no such file: %(libtool)s' % locals ()
        logger.write_log (message, 'error')
        raise Exception (message)
    loggedos.system (logger, 'cp %(file)s %(file)s~' % locals ())
    loggedos.system (logger, 'cp %(libtool)s %(file)s' % locals ())
    libtool_disable_install_not_into_dot_libs_test (logger, file)
    loggedos.system (logger, 'chmod 755  %(file)s' % locals ())
예제 #30
0
    def execute(self, logger):
        logger.write_log('Creating shar file from %s\n' % repr(self.kwargs),
                         'info')
        name = self.kwargs['name']
        pretty_name = self.kwargs['pretty_name']
        release = self.kwargs['release']
        shar_file = self.kwargs['shar_file']
        shar_head = self.kwargs['shar_head']
        tarball = self.kwargs['tarball']
        version = self.kwargs['version']
        target_cpu = self.kwargs['target_cpu']

        length = os.stat(tarball)[6]
        base_file = os.path.split(tarball)[1]
        script = loggedos.read_file(logger, shar_head)
        header_length = 0
        _z = misc.compression_flag(tarball)
        header_length = len(script % locals()) + 1
        used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(target_cpu)s %(_z)s'
        used_in_sharhead % locals()
        loggedos.dump_file(logger, script % locals(), shar_file)
        loggedos.system(logger, 'cat %(tarball)s >> %(shar_file)s' % locals())
        loggedos.chmod(logger, shar_file, octal.o755)
        loggedos.system(logger, 'rm %(tarball)s' % locals())
예제 #31
0
 def system(self, cmd, logger, env={}):
     env = self.package.get_substitution_dict(env)
     cmd = self.package.expand(cmd, env)
     return loggedos.system(logger, cmd, env=env)
예제 #32
0
파일: commands.py 프로젝트: epronk/gub
 def system (self, cmd, logger, env={}):
     env = self.package.get_substitution_dict (env)
     cmd = self.package.expand (cmd, env)
     return loggedos.system (logger, cmd, env=env)
예제 #33
0
파일: cron-builder.py 프로젝트: nizvoo/gub
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]))
    )
예제 #34
0
파일: commands.py 프로젝트: epronk/gub
    def execute (self, logger):
#        return loggedos.system (logger, self.command, **self.kwargs)
        return loggedos.system (logger, self.command, env=self.env,
                                ignore_errors=self.ignore_errors)
예제 #35
0
def system (cmd, env={}, ignore_errors=False):
    call_env = os.environ.copy ()
    call_env.update (env)
    for i in cmd.split ('\n'):
        if i:
            loggedos.system (logging.default_logger, i % env, call_env, ignore_errors)
예제 #36
0
파일: cron-builder.py 프로젝트: jrioux/gub
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 = gub_log.get_numeric_loglevel ('command')
        
    gub_log.set_default_log ('log/cron-builder.log', options.verbosity)
    logger = gub_log.default_logger
    
    gub_log.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])))
예제 #37
0
파일: buildrunner.py 프로젝트: marnen/gub
    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 = gub_log.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 = gub_log.CommandLogger(log,
                                           gub_log.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 gub_log.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(gub_log.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)
        gub_log.default_logger.write_log('\n', 'stage')
예제 #38
0
 def rm(logger, file):
     loggedos.system(logger, 'rm -f %(file)s' % locals())
예제 #39
0
 def execute(self, logger):
     #        return loggedos.system (logger, self.command, **self.kwargs)
     return loggedos.system(logger,
                            self.command,
                            env=self.env,
                            ignore_errors=self.ignore_errors)
예제 #40
0
파일: gcc.py 프로젝트: PhilHolmes/gub
 def copy (logger, plain_name):
     base_name = os.path.basename (plain_name)
     full_name = self.expand ('%(install_prefix)s%(cross_dir)s/bin/%(toolchain_prefix)s%(base_name)s', env=locals ())
     if not os.path.exists (full_name):
         loggedos.system (logger, 'cp %(plain_name)s %(full_name)s' % locals ())
예제 #41
0
파일: libicu.py 프로젝트: PhilHolmes/gub
 def rm (logger, file):
     loggedos.system (logger, 'rm -f %(file)s' % locals ())
예제 #42
0
파일: lilypond.py 프로젝트: imace/gub
 def rename (logger, name):
     header = open (name).readline ().strip ()
     if header.endswith ('guile'):
         loggedos.system (logger, 'mv %(name)s %(name)s.scm' % locals ())
     elif header.endswith ('python') and not name.endswith ('.py'):
         loggedos.system (logger, 'mv %(name)s %(name)s.py' % locals ())
예제 #43
0
파일: build.py 프로젝트: PhilHolmes/gub
 def un_exe (logger, file):
     base = os.path.splitext (file)[0]
     loggedos.system (logger, self.expand ('mv %(file)s %(base)s', locals ()))
예제 #44
0
def libtool_update(logger, libtool, rpath, file):
    build.libtool_update(logger, libtool, file)
    libtool_disable_rpath(logger, libtool, rpath, file)
    loggedos.system(logger, 'chmod 755  %(file)s' % locals())
예제 #45
0
파일: target.py 프로젝트: epronk/gub
def libtool_update (logger, libtool, rpath, file):
    build.libtool_update (logger, libtool, file)
    libtool_disable_rpath (logger, libtool, rpath, file)
    loggedos.system (logger, 'chmod 755  %(file)s' % locals ())
예제 #46
0
파일: lilypond.py 프로젝트: Jahrme/gub
 def rename(logger, name):
     header = open(name).readline().strip()
     if header.endswith('guile'):
         loggedos.system(logger, 'mv %(name)s %(name)s.scm' % locals())
     elif header.endswith('python') and not name.endswith('.py'):
         loggedos.system(logger, 'mv %(name)s %(name)s.py' % locals())
예제 #47
0
파일: build.py 프로젝트: marnen/gub
 def un_exe(logger, file):
     base = os.path.splitext(file)[0]
     loggedos.system(logger,
                     self.expand('mv %(file)s %(base)s', locals()))
예제 #48
0
파일: binutils.py 프로젝트: PhilHolmes/gub
 def copy (logger, full_name):
     base_name = (os.path.basename (self.expand (full_name))
                  .replace (self.expand ('%(toolchain_prefix)s'), ''))
     plain_name = self.expand ('%(install_prefix)s%(cross_dir)s/%(target_architecture)s/bin/%(base_name)s', env=locals ())
     if not os.path.exists (plain_name):
         loggedos.system (logger, 'cp %(full_name)s %(plain_name)s' % locals ())