예제 #1
0
def whatis_sysdir(dir):
    ''' given a dir, determine it's type'''
    with pwd(dir):
        cfg = ConfigObj('.devshell')
        try:
            type = cfg['type']
            log.debug('is type ' + type)
            return type
        except KeyError, e:
            return 'directory'
예제 #2
0
 def __new__(cls, name=None):
     if not name:
         log.debug('no name with dirfactory')
         cwd = getcwd()
         type = whatis_sysdir(cwd)
     else:
         log.debug('dirfactory.new with name ' + name)
         cwd = abspath(name)
         if not exists(cwd):
             type = 'directory'
         else:
             type = whatis_sysdir(cwd)
     try:
         new_cls = directory_type[type]
     except KeyError, e:
         raise ExecutionException(e, 'the directory type %s is not supported by this installation of fedora-deveshell' % type.capitalize())
예제 #3
0
파일: darcs.py 프로젝트: ryanduan/logalis
    def set_cur_to(self, *args):
        '''passes arbitrary args to darcs get and makes a branch out of it

        this is not really optimal, because it only does things temporary,
        we need to look at as systematic way to handle branching.
        looking at a potential git and a potential cvs module may help
        '''
        if len(args) >= 2 and args[0] == 'new':
            branch_name = args[1]
            args = args[2:]
        else:
            branch_name = ''
        if len(args) == 1 and args[0] == 'head':
            log.debug('doing head')
            self.cfg['source'] = '.'
        elif len(args) == 2 and args[0] == 'branch':
            self.cfg['source'] = join(self.branches, args[1])
        else:
            log.debug('creating new branch')
            index = str(hash(args))
            index_dir = join(self.branches, index)
            with pwd(self.dir):
                if not exists(index_dir):
                    log.debug('index dir should be ' + index_dir)
                    self.get(self.source(), index_dir, *args)
                self.cfg['source'] = index_dir
            if branch_name:
                with pwd(self.branches_dir):
                    self.get(index, branch_name)
        self.set_current_src()
예제 #4
0
파일: git.py 프로젝트: ryanduan/logalis
 def setup_sourceball(self, ver, delete_old=False):
     '''gets darcs to spit out a sourceball to be used in rpm making by other modules'''
     log.debug('someone set us up the bomb')
     if delete_old:
         with pwd(self.pkg_src_dir):
             rm(self.sourceball)
     name = self.upstream_name
     date = self.date
     full_name = '%s-%s.%s' % (name, ver, self.alphatag)
     log.debug('full name is ' + full_name)
     sourceball = full_name + '.tar.gz'
     with pwd(self.source_dir):
         with log_file('git.log') as git_out:
             p1 = Popen(['git', 'archive', '--format=tar', "--prefix=%s/" % full_name, "HEAD"],
                       stdout=PIPE, stderr=git_out)
             log.info('generating tarball %s.tar.gz, please wait...'
                      % full_name)
             with pwd(self.pkg_src_dir):
                 with file(sourceball, "wb") as sourceball_file:
                     p2 = Popen(['gzip'], stdin=p1.stdout,
                                stdout=sourceball_file, stderr=git_out)
                     p2.communicate()
     self.cfg['sourceball'] = sourceball
     self.cfg['full_name'] = full_name
예제 #5
0
파일: darcs.py 프로젝트: ryanduan/logalis
 def setup_sourceball(self, ver, delete_old=False):
     '''gets darcs to spit out a sourceball to be used in rpm making by other modules'''
     log.debug('someone set us up the bomb')
     if delete_old:
         with pwd(self.pkg_src_dir):
             rm(self.sourceball)
     name = self.upstream_name
     date = self.date
     full_name = '%s-%s.%sdarcs' % (name, ver, date)
     log.debug('full name is ' + full_name)
     sourceball = full_name + '.tar.gz'
     with pwd(self.source_dir):
         with log_file('darcs.log') as darcs_out:
             log.debug('we get signal')
             p = Popen(['darcs', 'dist', '-d', full_name],
                       stdout=darcs_out, stderr=darcs_out)
             log.info('generating tarball %s.tar.gz, please wait...'
                      % full_name)
             p.communicate()
     with pwd(self.pkg_src_dir):
         move(join(self.source_dir, sourceball), sourceball)
         self.cfg['sourceball'] = sourceball