示例#1
0
文件: build.py 项目: gmoro/jurt
 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))
示例#2
0
 def _move_root(self, root, dest):
     rootparent = os.path.dirname(root.path)
     if not util.same_partition(rootparent, dest):
         raise RootError, ("%s and %s must be on the same partition" %
                 (rootparent, dest))
     logger.debug("moving root from %s to %s", root.path, dest)
     self.su().rename(root.path, dest)
     root.path = dest
示例#3
0
 def cmd_cheapcopy(self):
     from jurtlib import util
     if len(self.args) < 2:
         raise CliError, "copy requires two operands"
     source = self.args[0]
     dest = self.args[1]
     self.target.rootmanager.check_valid_subdir(dest)
     copyopts = "-af"
     if util.same_partition(source, dest):
         copyopts += "l"
     cmd = ["cp", copyopts, source, dest]
     if not self.opts.dry_run:
         self._exec(cmd)