예제 #1
0
 def __init__(self, name=None, tarball=""):
     if tarball:
         tmp_dir = mkdtemp()
         with pwd(tmp_dir):
             sourceball_name = copy(tarball, split(tarball)[1])
             log.debug("sourceball_name " + sourceball_name)
             sourceball = tarfile.open(sourceball_name)
         extract_dir = base_dir(sourceball)
         if name and not name == extract_dir:
             log.debug("hahahahhaah")
             raise ExecutionException("tarball is not target directory")
         if not name:
             name = extract_dir
     super(SourceBall, self).__init__(name)
     if tarball:
         self.cfg["tarball_source"] = tarball
         with pwd(self.parent):
             sourceball.extractall()
         with pwd(self.branches_dir):
             sourceball.extractall()
             move(self.name, self.orig_dir(self.name))
         with pwd(self.pkg_src_dir):
             move(join(tmp_dir, sourceball_name), sourceball_name)
         self.cfg["sourceball"] = sourceball_name
         self.set_cur_to("head")
예제 #2
0
 def clean_orig(self):
     with pwd(self.pkg_src_dir):
         sourceball = tarfile.open(self.sourceball)
     with pwd(self.branches_dir):
         rm(self.orig_dir(self.name))
         sourceball.extractall()
         move(self.name, self.orig_dir(self.name))
예제 #3
0
파일: build.py 프로젝트: ryanduan/logalis
    def fetch_build(self, package):
        '''fetches the built source tree from the execution of rpmbuild for review

        This is usefull to see if rpmbuild did anything funny in execution
        of the spec file. Hopefully you'll never need this. The results
        end up in the top level directory of the given package

        package is a directory name to a Package (Directory).
        '''
        pkg = DirFactory(package)
        with pwd(self.dir):
            source = pkg.cfg['source']
            move(join('BUILD', source), join(pkg.dir, 'results'))
예제 #4
0
파일: build.py 프로젝트: ryanduan/logalis
    def fetch_rpms(self, target_dir):
        '''fetches all rpm files from the buildroot to another target directory

        As a module author, it is a good idea to use this to clean up
        afterwards. This module pulls all RPMs said module may have made
        as well as any other RPMs from earlier incantations of other modules.
        Please be courteous to other module authors and run this liberally.

        target_dir is a path to the destination for all the rpms
        '''
        target_dir = abspath(target_dir)
        with pwd(self.dir):
            for path, dirs, files in walk('.'):
                for f in files:
                    if f.endswith('.rpm'):
                        move(join(path, f), join(target_dir, f))
예제 #5
0
파일: package.py 프로젝트: ryanduan/logalis
 def add_spec(self, spec_file):
     '''add's a spec file to the package, and sets the canonical package
     name based on the spec file, possibly renaming the spec file to match
     within fedora guidelines'''
     log.debug('spec_file is %s' % spec_file)
     log.debug('spec_file_name is %s' % self.name + '.spec')
     #TODO: get the spec file name, copy
     # Then get the actual package name and set pkg_name to the right one
     spec_file = abspath(spec_file)
     spec_fname = basename(spec_file)
     with pwd(self.dir):
         try:
             copy(spec_file, spec_fname)
             rpm = RPMSpec(spec_fname)
             self.cfg['pkg_name'] = rpm.name()
             if not spec_fname == self.spec_file:
                 move(spec_fname, self.spec_file)
         except IOError, e:
             log.error(str(e))
             raise ExecutionException(e, 'spec-file could not be added')
예제 #6
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