Beispiel #1
0
 def deliver(self, id, buildresults, logstore):
     # setting up base delivery directory
     topdir = os.path.join(self.deliverydir, id)
     latestlink = id
     latestpath = os.path.join(self.deliverydir, self.latestname)
     create_dirs(topdir)
     id, subidpaths = logstore.logs()
     # copying and compressing log files
     for subid, path in subidpaths:
         subtop = os.path.join(topdir, subid, self.logsdirname)
         create_dirs(subtop)
         logname = os.path.basename(path) + self.deliverylogext
         destpath = os.path.join(subtop, logname)
         self._pipe_through(path, self.logcompresscmd, destpath)
     # copying (or hardlinking) the built packages
     for result in buildresults:
         for path in result.builtpaths:
             pkgdestdir = os.path.join(topdir, result.sourceid, self.packagesdirname)
             create_dirs(pkgdestdir)
             destpath = os.path.join(pkgdestdir, os.path.basename(path))
             if util.same_partition(pkgdestdir, path):
                 logger.debug("creating hardlink from %s to %s" % (path, destpath))
                 os.link(path, destpath)
             else:
                 logger.debug("copying %s to %s" % (path, destpath))
                 shutil.copy(path, destpath)
     # creating a symlink pointing to the most recently delivered build
     util.replace_link(latestpath, id)
     logger.info("done. check out %s" % (topdir))
Beispiel #2
0
 def _update_latest_link(self, state, rootpath, interactive=False):
     rootname = os.path.basename(rootpath)
     # creates a relative link pointing to statename/rootid
     rootsubdir = self._root_path(state, rootname)
     comps = os.path.abspath(rootsubdir).rsplit(os.path.sep, 2)
     relative = os.path.sep.join(comps[-2:])
     util.replace_link(self._latest_path(interactive), relative)
Beispiel #3
0
 def _update_latest_link(self, rootpath):
     linkname = self._latest_link_name()
     linkpath = self.path_from_name(linkname)
     rootname = os.path.basename(rootpath)
     util.replace_link(linkpath, rootname)