Пример #1
0
	def fast_process(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 = TempFile.new(mirror_rp)
		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)
				elif inc.renamed:
					self.CCPP.flag_deleted(index)
				return # normal return, otherwise error occurred
		tf.setdata()
		if tf.lstat(): tf.delete()
Пример #2
0
 def fast_process(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 = TempFile.new(mirror_rp)
     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()
Пример #3
0
	def start_process(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)
Пример #4
0
	def fast_process(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_rp
		tf = TempFile.new(mirror_rp)
		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()
Пример #5
0
	def start_process(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 %s or %s must be a directory" % (repr(diff_rorp.path),
				 repr(self.base_rp.path)))
		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)