예제 #1
0
 def fast_process_file(self, index, diff_rorp):
     """Patch base_rp with diff_rorp and write increment (neither is dir)"""
     mirror_rp, inc_prefix = longname.get_mirror_inc_rps(
         self.CCPP.get_rorps(index), self.basis_root_rp, self.inc_root_rp)
     tf = mirror_rp.get_temp_rpath(sibling=True)
     if self._patch_to_temp(mirror_rp, diff_rorp, tf):
         inc = robust.check_common_error(self.error_handler,
                                         increment.Increment,
                                         (tf, mirror_rp, inc_prefix))
         if inc is not None and not isinstance(inc, int):
             self.CCPP.set_inc(index, inc)
             if inc.isreg():
                 inc.fsync_with_dir()  # Write inc before rp changed
             if tf.lstat():
                 if robust.check_common_error(self.error_handler,
                                              rpath.rename,
                                              (tf, mirror_rp)) is None:
                     self.CCPP.flag_success(index)
                 else:
                     tf.delete()
             elif mirror_rp.lstat():
                 mirror_rp.delete()
                 self.CCPP.flag_deleted(index)
             return  # normal return, otherwise error occurred
     tf.setdata()
     if tf.lstat():
         tf.delete()
예제 #2
0
 def start_process_directory(self, index, diff_rorp):
     """Start processing directory - record information for later"""
     self.base_rp, discard = longname.get_mirror_inc_rps(
         self.CCPP.get_rorps(index), self.basis_root_rp)
     if diff_rorp.isdir():
         self._prepare_dir(diff_rorp, self.base_rp)
     elif self._set_dir_replacement(diff_rorp, self.base_rp):
         if diff_rorp.lstat():
             self.CCPP.flag_success(index)
         else:
             self.CCPP.flag_deleted(index)
예제 #3
0
 def start_process_directory(self, index, diff_rorp):
     """Start processing directory"""
     self.base_rp, inc_prefix = longname.get_mirror_inc_rps(
         self.CCPP.get_rorps(index), self.basis_root_rp, self.inc_root_rp)
     self.base_rp.setdata()
     assert diff_rorp.isdir() or self.base_rp.isdir(), (
         "Either diff '{ipath!r}' or base '{bpath!r}' "
         "must be a directory".format(ipath=diff_rorp, bpath=self.base_rp))
     if diff_rorp.isdir():
         inc = increment.Increment(diff_rorp, self.base_rp, inc_prefix)
         if inc and inc.isreg():
             inc.fsync_with_dir()  # must write inc before rp changed
         self.base_rp.setdata()  # in case written by increment above
         self._prepare_dir(diff_rorp, self.base_rp)
     elif self._set_dir_replacement(diff_rorp, self.base_rp):
         inc = increment.Increment(self.dir_replacement, self.base_rp,
                                   inc_prefix)
         if inc:
             self.CCPP.set_inc(index, inc)
             self.CCPP.flag_success(index)
예제 #4
0
 def fast_process_file(self, index, diff_rorp):
     """Patch base_rp with diff_rorp (case where neither is directory)"""
     mirror_rp, discard = longname.get_mirror_inc_rps(
         self.CCPP.get_rorps(index), self.basis_root_rp)
     assert not mirror_rp.isdir(), (
         "Mirror path '{rp}' points to a directory.".format(rp=mirror_rp))
     tf = mirror_rp.get_temp_rpath(sibling=True)
     if self._patch_to_temp(mirror_rp, diff_rorp, tf):
         if tf.lstat():
             if robust.check_common_error(self.error_handler, rpath.rename,
                                          (tf, mirror_rp)) is None:
                 self.CCPP.flag_success(index)
             else:
                 tf.delete()
         elif mirror_rp and mirror_rp.lstat():
             mirror_rp.delete()
             self.CCPP.flag_deleted(index)
     else:
         tf.setdata()
         if tf.lstat():
             tf.delete()