Esempio n. 1
0
 def sync_overlay(self, dir=None):
     vinfo("Syncing overlays to release specified revision")
     try:
         XTargetBuilder.sync_overlay(self, dir)
     except XTargetError, e:
         if e.log:
             error(e.log)
         die(str(e))
Esempio n. 2
0
 def sync(self):
         vinfo("Doing overlay syncing")
         try:
                 XTargetBuilder.sync(self)
         except XTargetError, e:
                 if e.log:
                         error(e.log)
                 die(str(e))
Esempio n. 3
0
 def sync(self):
     vinfo("Doing overlay syncing")
     try:
         XTargetBuilder.sync(self)
     except XTargetError, e:
         if e.log:
             error(e.log)
         die(str(e))
Esempio n. 4
0
 def sync_overlay(self, dir=None):
         vinfo("Syncing overlays to release specified revision")
         try:
                 XTargetBuilder.sync_overlay(self, dir)
         except XTargetError, e:
                 if e.log:
                         error(e.log)
                 die(str(e))
Esempio n. 5
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. 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 delete(self, target_dir=None):
         if target_dir is None or target_dir == "current":
                 target_dir = get_current_target(config=self.cfg)
         # check in config
         cfg = load_config()
         if cfg['ask_delete'] and not userquery("Are you sure you want to delete %s" % target_dir):
                 info("Abort")
                 return
         vinfo("Deleting %s" % target_dir)
         try:
                 XTargetBuilder.delete(self, target_dir)
         except XTargetError, e:
                 if e.log:
                         error(e.log)
                 die(str(e))
Esempio n. 8
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. 9
0
 def delete(self, target_dir=None):
     if target_dir is None or target_dir == "current":
         target_dir = get_current_target(config=self.cfg)
     # check in config
     cfg = load_config()
     if cfg['ask_delete'] and not userquery(
             "Are you sure you want to delete %s" % target_dir):
         info("Abort")
         return
     vinfo("Deleting %s" % target_dir)
     try:
         XTargetBuilder.delete(self, target_dir)
     except XTargetError, e:
         if e.log:
             error(e.log)
         die(str(e))
Esempio n. 10
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. 11
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. 12
0
 def create(self, pkg_atom, arch=None, dir=None):
         try:
                 target_dir = XTargetBuilder.create(self, pkg_atom, arch, dir)
                 rel = XTargetReleaseParser().get(target_dir, self.cfg['release_file'])
                 if rel.has_key('name') and rel.has_key('version'):
                         target_name = '%s-%s' % (rel['name'], rel['version'])
                 else:
                         target_name = pkg_atom
         except XTargetError, e:
                 if e.log:
                         error(e.log)
                 die(str(e))
Esempio n. 13
0
 def create(self, pkg_atom, arch=None, dir=None):
     try:
         target_dir = XTargetBuilder.create(self, pkg_atom, arch, dir)
         rel = XTargetReleaseParser().get(target_dir,
                                          self.cfg['release_file'])
         if rel.has_key('name') and rel.has_key('version'):
             target_name = '%s-%s' % (rel['name'], rel['version'])
         else:
             target_name = pkg_atom
     except XTargetError, e:
         if e.log:
             error(e.log)
         die(str(e))
Esempio n. 14
0
 def list(self, env=None):
         return (JOB_FINISHED, XTargetBuilder().list_targets())
Esempio n. 15
0
 def get(self, key):
         try:
                 print "%s" % XTargetBuilder.get(self, key)
         except XTargetError, e:
                 die(str(e))
Esempio n. 16
0
 def set(self, target_dir):
     try:
         XTargetBuilder.set(self, target_dir)
     except XTargetError, e:
         die(str(e))
Esempio n. 17
0
 def get(self, key):
     try:
         print "%s" % XTargetBuilder.get(self, key)
     except XTargetError, e:
         die(str(e))
Esempio n. 18
0
 def set(self, target_dir):
         try:
                 XTargetBuilder.set(self, target_dir)
         except XTargetError, e:
                 die(str(e))
Esempio n. 19
0
                                ("xtarget_delete", self.delete),
                                ("xtarget_sync", self.sync),
                               ])

        def list(self, env=None):
                return (JOB_FINISHED, XTargetBuilder().list_targets())

        def list_profiles(self, pkg_atom=None, arch=None, env=None):
                return (JOB_FINISHED, XTargetBuilder(arch).list_profiles(pkg_atom))

        def create(self, name, arch, dir, async=False, env=None):
                if async:
                        return self.spawn(self.create, name, arch, dir, False, env)
                else:
                        try:
                                ret = (JOB_FINISHED, XTargetBuilder(arch).create(name, arch, dir))
                        except Exception, e:
                                ret = (JOB_ERROR, str(e))
                        return ret

        def set(self, name, env=None):
                try:
                        XTargetBuilder().set(name)
                        ret = (JOB_FINISHED, None)
                except Exception, e:
                        ret = (JOB_ERROR, str(e))
                return ret

        def get_current(self):
                try:
                        ret = get_current_target()
Esempio n. 20
0
                        if rel.has_key('name') and rel.has_key('version'):
                                target_name = '%s-%s' % (rel['name'], rel['version'])
                        else:
                                target_name = pkg_atom
                except XTargetError, e:
                        if e.log:
                                error(e.log)
                        die(str(e))

                info("Target %s built in %s" % (target_name, target_dir))
                if self.cfg['create_autocurrent']:
                        # set new target to be current one
                        self.set(target_dir)
                        if self.cfg['create_autosync']:
                                try:
                                        XTargetBuilder.sync_overlay(self, target_dir)
                                except XTargetError, e:
                                        die(str(e))
                                info("Overlays of target %s sync" % target_dir)

        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:
Esempio n. 21
0
 def set(self, name, env=None):
         try:
                 XTargetBuilder().set(name)
                 ret = (JOB_FINISHED, None)
         except Exception, e:
                 ret = (JOB_ERROR, str(e))
Esempio n. 22
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. 23
0
 def list_profiles(self, pkg_atom=None, arch=None, env=None):
         return (JOB_FINISHED, XTargetBuilder(arch).list_profiles(pkg_atom))
Esempio n. 24
0
            if rel.has_key('name') and rel.has_key('version'):
                target_name = '%s-%s' % (rel['name'], rel['version'])
            else:
                target_name = pkg_atom
        except XTargetError, e:
            if e.log:
                error(e.log)
            die(str(e))

        info("Target %s built in %s" % (target_name, target_dir))
        if self.cfg['create_autocurrent']:
            # set new target to be current one
            self.set(target_dir)
            if self.cfg['create_autosync']:
                try:
                    XTargetBuilder.sync_overlay(self, target_dir)
                except XTargetError, e:
                    die(str(e))
                info("Overlays of target %s sync" % target_dir)

    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: