def _package(self, pkg, output_file, with_deps):  # pylint: disable=too-many-branches
        total_files = len(pkg.pkgfiles)
        if self.errors_only and pkg.res == total_files:
            return
        info('%s/%s' % (pkg.cat, pkg.name), output=output_file)
        if pkg.res == total_files:
            res_str = color.green('%i/%i' % (pkg.res, total_files))
        else:
            res_str = color.yellow('%i/%i' % (pkg.res, total_files))
        print('   Checked: %s files' % res_str, file=output_file)
        if pkg.res == total_files:
            print('', file=output_file)
            return

        for file_ in pkg.pkgfiles:
            if not file_.status:
                continue
            for error in file_.status:
                if error == 'EMTIME':
                    out_str = '%s: %s' % (color.red('MTIME'), file_.name)
                    if is_verbose():
                        out_str += " (recorded '%i'!= actual '%i')" % (file_.mtime, file_.status['EMTIME'])
                elif error == 'ECHKSUM':
                    out_str = '%s: %s' % (color.red('MD5-DIGEST'), file_.name)
                    if is_verbose():
                        out_str += " (recorded '%s'!= actual '%s')" % (file_.md5sum, file_.status['ECHKSUM'])
                elif error == 'ENOENT':
                    out_str = '%s: %s' % (color.red('AFK'), file_.name)
                else:
                    out_str = '%s: %s' % (color.red('UNKNOWN'), file_.name)
                print('   ' + out_str, file=output_file)
        print('', file=output_file)
Esempio n. 2
0
        def list_targets(self):
                tgt_list = XTargetBuilder.list_targets(self)
                curr_tgt = get_current_target(config=self.cfg)

                if not curr_tgt or not curr_tgt.startswith(self.cfg['targets_dir']):
                        curr_tgt = None
                else:
                        curr_tgt = os.path.basename(curr_tgt)
                # sort tgt_list by alphabetic order
                tgt_list.sort()
                for name, pkg, arch, use in tgt_list:
                        out_str = "  %-20s " % name
                        if pkg is None:
                                out_str += "[%-20s] " % "Unknown"
                        else:
                                out_str += "[%-20s] " % pkg
                        if name == curr_tgt:
                                out_str += color.teal("(current) ")
                        if is_verbose():
                                if arch is not None:
                                        out_str += "ARCH=\"%s\" " % arch
                                if use is not None:
                                        out_str += "USE=\" "
                                        for flag, val in use.iteritems():
                                                if val == '0':
                                                        out_str += "-%s " % flag
                                                else:
                                                        out_str += "%s " % flag
                                        out_str += "\""
                        print out_str
Esempio n. 3
0
    def list_targets(self):
        tgt_list = XTargetBuilder.list_targets(self)
        curr_tgt = get_current_target(config=self.cfg)

        if not curr_tgt or not curr_tgt.startswith(self.cfg['targets_dir']):
            curr_tgt = None
        else:
            curr_tgt = os.path.basename(curr_tgt)
        # sort tgt_list by alphabetic order
        tgt_list.sort()
        for name, pkg, arch, use in tgt_list:
            out_str = "  %-20s " % name
            if pkg is None:
                out_str += "[%-20s] " % "Unknown"
            else:
                out_str += "[%-20s] " % pkg
            if name == curr_tgt:
                out_str += color.teal("(current) ")
            if is_verbose():
                if arch is not None:
                    out_str += "ARCH=\"%s\" " % arch
                if use is not None:
                    out_str += "USE=\" "
                    for flag, val in use.iteritems():
                        if val == '0':
                            out_str += "-%s " % flag
                        else:
                            out_str += "%s " % flag
                    out_str += "\""
            print out_str
Esempio n. 4
0
 def list_profiles(self, pkg_atom=None):
     verbose = is_verbose()
     try:
         tgt_list = XTargetBuilder.list_profiles_ng(self,
                                                    pkg_atom,
                                                    version=verbose,
                                                    filter=self._arch_given)
     except XTargetError, e:
         die(str(e))
Esempio n. 5
0
 def check_progress(self, curr, total):
     if not is_verbose():
         return
     curr = curr * 100 / total
     for _ in range(self.prog_cnt):
         sys.stdout.write('\b')
     prog_str = ' %3i%% ' % curr
     self.prog_cnt = len(prog_str)
     sys.stdout.write(prog_str)
     sys.stdout.flush()
Esempio n. 6
0
        def __init__(self, arch=None, sync=False, config=None):
                if is_verbose():
                        stdout = sys.stdout
                        stderr = sys.stderr
                else:
                        stdout = stderr = None

                try:
                        XTargetBuilder.__init__(self, arch, sync, stdout, stderr, config)
                except XTargetError, e:
                        die(str(e))
Esempio n. 7
0
    def __init__(self, arch=None, sync=False, config=None):
        if is_verbose():
            stdout = sys.stdout
            stderr = sys.stderr
        else:
            stdout = stderr = None

        try:
            XTargetBuilder.__init__(self, arch, sync, stdout, stderr, config)
        except XTargetError, e:
            die(str(e))
Esempio n. 8
0
 def list_profiles(self, pkg_atom=None):
         verbose = is_verbose()
         try:
                 tgt_list = XTargetBuilder.list_profiles_ng(self, pkg_atom, version=verbose, filter=self._arch_given)
         except XTargetError, e:
                 die(str(e))
Esempio n. 9
0
 def end_progress(self):
     self.prog_cnt = 0
     if is_verbose():
         print