Commit Graph

66 Commits

Author SHA1 Message Date
Thomas Waldmann 6df21df3f4 Merge branch 'master' into multithreading
Note: although I hopefully fixed all the conflicts,
some tests are quite broken.

Conflicts:
	borg/_chunker.c
	borg/archive.py
	borg/archiver.py
	borg/cache.py
	borg/helpers.py
	borg/testsuite/archiver.py
2016-02-04 20:34:18 +01:00
Thomas Waldmann 4b339f5d69 cosmetic source cleanup (flake8) 2016-01-30 21:32:45 +01:00
Thomas Waldmann 169634f2ca change the builtin default for --chunker-params, create 2MiB chunks, fixes #343
one of the biggest issues with borg < 1.0 was that it had a default target chunk
size of 64kiB, thus it created a lot of chunks, a huge chunk management overhead
(high RAM and disk usage).
2016-01-24 15:44:09 +01:00
Thomas Waldmann fc52101d46 suppress unneeded exception context (PEP 409) 2016-01-24 15:36:04 +01:00
Thomas Waldmann fe8762ad28 os.utime on py 3.4+ always supports fd and follow_symlinks 2016-01-24 15:16:05 +01:00
Thomas Waldmann 265da6286f remove conditionals/wrappers, we always have stat nanosecond support on 3.4+
also: no wrapper needed for binascii.unhexlify any more
2016-01-24 15:16:05 +01:00
Thomas Waldmann 19998888ba remove support for missing PermissionError on py 3.2 2016-01-24 14:57:48 +01:00
TW 704b505968 Merge pull request #565 from ThomasWaldmann/repocache-ctxmgr
Repocache ctxmgr
2016-01-18 00:58:23 +01:00
Thomas Waldmann 4d73f3cdb9 implement and use context manager for RepositoryCache, fixes #548 2016-01-17 00:30:00 +01:00
Thomas Waldmann 9198f6962c implement --progress option for borg delete <archive> 2016-01-16 20:46:49 +01:00
Thomas Waldmann 888e078382 use finer chunker granularity for items metadata stream, fixes #547, fixes #487
the items metadata stream is usually not that big (compared to the file content data) -
it is just file and dir names and other metadata.

if we use too rough granularity there (and big minimum chunk size), we usually will get no deduplication.
2016-01-15 20:56:21 +01:00
Thomas Waldmann c9afa2b27b output progress indication from inner loop, fixes #500
- so it shows progress while it backups a bigger file
- so it announces the filename earlier

also: move rate limiting code to show_progress()
2015-12-27 11:06:03 +01:00
Thomas Waldmann aa97724c0c add --prefix to check to check only some specific archives, fixes #206 2015-12-13 00:39:52 +01:00
Thomas Waldmann 0c076ad114 compact_segments: save_space -> free unused segments quickly
as soon as one target segment is full, it is a good time to commit it and remove the source segments
that are already completely unused (because they were transferred int the target segment).

so, for compact_segments(save_space=True), the additional space needed should be about 1 segment size.

note: we can't just do that at the end of one source segment as this might create very small
target segments, which is not wanted.
2015-12-08 18:36:41 +01:00
Thomas Waldmann 68225af449 archive checker: remove report_progress, fix log levels 2015-12-08 00:59:41 +01:00
Antoine Beaupré f13dd6e579 completely remove have_cython() hack
this was making us require mock, which is really a test component and
shouldn't be part of the runtime dependencies. furthermore, it was
making the imports and the code more brittle: it may have been
possible that, through an environment variable, backups could be
corrupted because mock libraries would be configured instead of real
once, which is a risk we shouldn't be taking.

finally, this was used only to build docs, which we will build and
commit to git by hand with a fully working borg when relevant.

see #384.
2015-11-13 10:40:53 -05:00
Björn Ketelaars e6911b2f25 Avoid using msgpack.packb at import time.
move item_keys = ... to __init__ (self.item_keys = ...)

Solution from/discussed with TW.
2015-11-08 15:23:09 +01:00
Thomas Waldmann 5595d56ecf deal with unicode errors for symlinks in same way as for regular files, fixes #382 2015-11-08 01:05:55 +01:00
Thomas Waldmann 244303ac66 add ACL keys the RobustUnpacker must know about 2015-11-07 19:55:17 +01:00
TW 864fa9ae2d Merge pull request #370 from ThomasWaldmann/debug-helpers
Debug helpers
2015-11-06 18:08:05 +01:00
Thomas Waldmann 47813f6f6a archiver checker: better error logging, give chunk_id and sequence numbers
can be used together with borg debug-dump-archive-items.
2015-11-04 00:20:12 +01:00
Thomas Waldmann 12b5d07e55 fix RobustUnpacker, it missed some metadata keys. add check for unknown metadata keys.
not just the new atime and ctime keys were missing, but also bsdflags.
2015-11-03 20:21:52 +01:00
Thomas Waldmann fa35525b58 create from stdin: also save atime, ctime
cosmetic, just for completeness.
2015-11-03 19:52:49 +01:00
Thomas Waldmann f4b0f57618 Merge branch 'master' into multithreading
Some tests are failing, some block, one new test needed skipping.
2015-10-31 19:36:33 +01:00
Thomas Waldmann c492011a92 backup atime and ctime additionally to mtime, fixes #317
restore: mtime and atime
FUSE: support ctime and atime additionally to mtime
2015-10-26 02:07:55 +01:00
Thomas Waldmann 0942bc010e fix reading files without touching their atime 2015-10-26 01:43:58 +01:00
TW 21f26988cc Merge pull request #303 from anarcat/verbosity
Verbosity
2015-10-19 22:25:46 +02:00
Thomas Waldmann 7d31da7914 implement cmdline metadata value decoding
code copied & adapted from Archive.load()
2015-10-19 12:16:28 +02:00
Antoine Beaupré d666c86bfc adjust display of --stats
it was broken by recent commits.

also remove the __format__() anti-pattern from cache as well.
2015-10-17 21:21:33 -04:00
Antoine Beaupré b120e5f119 output more progress information
without this, there would be a solid 20 seconds here without any sort
of output on the console, regardless of the verbosity level. this
makes nice incremental messages telling the user that borg is not
stalled (or waiting for a lock, for that matter)

the "processing files" message is a little clunky, as we somewhat
abuse the cache to figure out if we are just starting... but it helps
if there are problems reading the actual files: it tells us the
initialization is basically complete and we're going ahead with the
reading of all the files.
2015-10-17 21:21:31 -04:00
Antoine Beaupré bdbdbdde90 Merge remote-tracking branch 'origin/master' into logging-refactor
Conflicts:
	borg/archive.py
	borg/archiver.py
	borg/cache.py
	borg/key.py
2015-10-09 12:58:27 -04:00
Antoine Beaupré efa88ef6c6 fix tests: they expect check to spew output
our default verbosity shows only warnings, we'd have to tweak tests to be verbose for this to work

This reverts commit 27be46a5ba.
2015-10-09 12:28:29 -04:00
Antoine Beaupré a1dad8c9da try to mock msgpack altogether to fix RTD again
it seems that msgpack is a hard depends in archive...
2015-10-08 17:06:48 -04:00
Antoine Beaupré e8ae96b54e try to fix RTD build *again* 2015-10-08 17:01:42 -04:00
Antoine Beaupré 27be46a5ba tweak some levels 2015-10-08 16:31:22 -04:00
Antoine Beaupré 423ff45d81 rename cython detection function
"have" has clearer semantics than "detect"
2015-10-08 15:34:44 -04:00
Antoine Beaupré f98998f042 fix logical inversion in the semantics of detect_cython() 2015-10-08 15:26:40 -04:00
Antoine Beaupré 6f9e04bc21 generalise the cython check hack
instead of applying this only to usage generation, use it as a generic
mechanism to disable loading of Cython code.

it may be incomplete: there may be other places where Cython code is
loaded that is not checked, but that is sufficient to build the usage
docs. the environment variable used is documented as such in the
docs/usage.rst.

we also move the check to a helper function and document it
better. this has the unfortunate side effect of moving includes
around, but I can't think of a better way.
2015-10-08 08:56:02 -04:00
Antoine Beaupré 9cbc868764 make tests and build work again in usage using environment
this is such a crude hack it is totally embarrassing....

the proper solution would probably be to move the `build_parser()`
function out of `Archiver` completely, but this is such an undertaking
that i doubt it is worth doing since we're looking at switching to
click anyways.

the main problem in moving build_parser() out is that it references
`self` all the time, so it *needs* an archiver context that it can
reuse. we could make the function static and pass self in there by
hand, but it seems like almost a worse hack... and besides, we would
need to load the archiver in order to do that, which would break usage
all over again...
2015-10-07 22:26:59 -04:00
Antoine Beaupré 42cc17caed use new logger object initialisation code 2015-10-06 12:57:27 -04:00
Antoine Beaupré 35aaeef8bd remove spurious output 2015-10-02 16:00:42 -04:00
Antoine Beaupré 8193c414a9 add and use string representation of archive for stats 2015-10-02 15:56:21 -04:00
Antoine Beaupré c9b11316ab use a module-specific logger instead of global one
that way we have one logger per module, and we can pick and choose
which module we want verbose, for example
2015-10-02 11:05:44 -04:00
Antoine Beaupré 1b540d91a0 convert more print() statements to logging
we use logging.warning in info and list, but print() more usage bits.

we also now support logging.debug() and by default are more silent
2015-10-01 14:20:29 -04:00
Antoine Beaupré 09ffbb1d9d convert most print() calls to logging
the logging level varies: most is logging.info(), in some place
logging.warning() or logging.error() are used when the condition is
clearly an error or warning. in other cases, we keep using print, but
force writing to sys.stderr, unless we interact with the user.

there were 77 calls to print before this commit, now there are 7, most
of which in the archiver module, which interacts directly with the
user. in one case there, we still use print() only because logging is
not setup properly yet during argument parsing.

it could be argued that commands like info or list should use print
directly, but we have converted them anyways, without ill effects on
the unit tests

unit tests still use print() in some places

this switches all informational output to stderr, which should help
with, if not fix jborg/attic#312 directly
2015-10-01 13:41:45 -04:00
Thomas Waldmann 322a87cbfd Merge branch 'master' into multithreading
Note: there is a failing archiver test on py33-only now.
It is somehow related to __del__ method usage in Cache
and/or locking code. Could not find out the exact reason
why it behaves like that.
2015-09-08 21:22:37 +02:00
Thomas Waldmann 1aacdda4a4 implement borg create --dry-run, attic issue #267
also: fix verbose mode display of stdin backup
2015-09-08 03:12:45 +02:00
Thomas Waldmann 9ebc53ad77 restore_xattrs: ignore if setxattr fails with EACCES, fixes #162
e.g.:
- setting any security.* key is expected to fail with EACCES if one is not root.
- issue #162 on our issue tracker: user was root, but due to some specific scenario
  involving docker and selinux, setting security.selinux key fails even when running as root

not sure if it is the best solution to silently ignore this, but some lines below this change
failure to do a chown is also silently ignored (happens e.g. when restoring a file not owned
by the current user as a non-root user).
2015-08-29 00:11:04 +02:00
Thomas Waldmann ea8f3bd7e7 restore_xattrs: minor cleanup / simplification
if we use {} as default for item.get(), we do not need the "if" as iteration over an empty dict won't do anything.
also fixes too deep indentation the original code had.
2015-08-28 23:22:26 +02:00
Thomas Waldmann 91d2cfa671 Merge branch 'master' into multithreading 2015-08-15 21:45:52 +02:00