Пример #1
0
    def run(self):
        # do regress the target directory if necessary
        if self._operate_regress():
            # regress was necessary and failed
            return 1
        previous_time = self.repo.get_mirror_time(refresh=True)
        if previous_time < 0 or previous_time >= Time.getcurtime():
            log.Log(
                "Either there is more than one current_mirror or "
                "the last backup is not in the past. Aborting.", log.ERROR)
            return 1
        if Globals.get_api_version() < 201:  # compat200
            if previous_time:
                Time.setprevtime_compat200(previous_time)
                self.repo.base_dir.conn.Main.backup_touch_curmirror_local(
                    self.dir.base_dir, self.repo.base_dir)
                backup.mirror_and_increment_compat200(self.dir.base_dir,
                                                      self.repo.base_dir,
                                                      self.repo.incs_dir)
                self.repo.base_dir.conn.Main.backup_remove_curmirror_local()
            else:
                backup.mirror_compat200(self.dir.base_dir, self.repo.base_dir)
                self.repo.base_dir.conn.Main.backup_touch_curmirror_local(
                    self.dir.base_dir, self.repo.base_dir)
            self.repo.base_dir.conn.Main.backup_close_statistics(time.time())
        else:  # API 201 and higher
            self._operate_backup(previous_time)

        return 0
Пример #2
0
exec1 = getrp(b"executable")
exec2 = getrp(b"executable2")
sig = getrp(b"regular_file.sig")
hl1, hl2 = list(
    map(getrp, [b"two_hardlinked_files1", b"two_hardlinked_files2"]))
test = getrp(b"test")
dir = getrp(b".")
sym = getrp(b"symbolic_link")
nothing = getrp(b"nothing")

target = rpath.RPath(lc, os.path.join(abs_output_dir, b"out"))
out2 = rpath.RPath(lc, os.path.join(abs_output_dir, b"out2"))
out_gz = rpath.RPath(lc, os.path.join(abs_output_dir, b"out.gz"))

Time.set_current_time(1000000000)
Time.setprevtime_compat200(999424113)
if os.name == "nt":
    prevtimestr = b"2001-09-02T02-48-33-07-00"
else:
    prevtimestr = b"2001-09-02T02:48:33-07:00"
t_pref = os.path.join(abs_output_dir, b"out.%s" % prevtimestr)
t_diff = os.path.join(abs_output_dir, b"out.%s.diff" % prevtimestr)

Globals.postset_regexp_local("no_compression_regexp",
                             actions.DEFAULT_NOT_COMPRESSED_REGEXP, re.I)


class inctest(unittest.TestCase):
    """Test the incrementRP function"""
    def setUp(self):
        Globals.set('isbackup_writer', 1)