예제 #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
파일: 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')