예제 #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))
예제 #2
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))
예제 #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))
예제 #4
0
 def sync(self):
     vinfo("Doing overlay syncing")
     try:
         XTargetBuilder.sync(self)
     except XTargetError, e:
         if e.log:
             error(e.log)
         die(str(e))
예제 #5
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))
예제 #6
0
    def build(self, target_ebuild, arch=None):
        self.info('Running build step')
        self.__load_target_db()

        self.build_info['success'] = True

        for p in self.plugin_list:
            try:
                p.build(target_ebuild, self.target_builder, arch)
            except XUtilsError as e:
                error(str(e))
                self.build_info['success'] = False
                return
예제 #7
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))
예제 #8
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))
예제 #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))
예제 #10
0
def rm_expired_files(dirname, expired_time, depth=0):
    if depth > MAX_DEPTH:
        xutils.error("DiskClean", "too deep path, dirname: %s" % dirname)
        return
    xutils.info("DiskClean", "check dirname `%s`" % dirname)
    now = time.time()
    for fname in os.listdir(dirname):
        fpath = os.path.join(dirname, fname)
        if os.path.islink(fpath):
            continue
        if os.path.isdir(fpath):
            rm_expired_files(fpath, expired_time, depth + 1)
            if is_empty_dir(fpath):
                xutils.rmfile(fpath)
        st = os.stat(fpath)
        if now - st.st_ctime >= expired_time:
            xutils.info("DiskClean", "%s is expired" % fname)
            xutils.rmfile(fpath)