diff --git a/borg/archive.py b/borg/archive.py index 178ad94b8..0c57680f4 100644 --- a/borg/archive.py +++ b/borg/archive.py @@ -204,6 +204,7 @@ class Archive: if start is None: start = datetime.utcnow() start_monotonic = time.monotonic() + self.chunker_params = chunker_params self.start = start self.start_monotonic = start_monotonic if end is None: @@ -227,7 +228,7 @@ class Archive: raise self.DoesNotExist(name) info = self.manifest.archives[name] self.load(info[b'id']) - self.zeros = b'\0' * (1 << chunker_params[1]) + self.zeros = None def _load_meta(self, id): data = self.key.decrypt(id, self.repository.get(id)) @@ -405,6 +406,8 @@ Number of files: {0.stats.nfiles}'''.format( with backup_io(): os.link(source, path) else: + if sparse and self.zeros is None: + self.zeros = b'\0' * (1 << self.chunker_params[1]) with backup_io(): fd = open(path, 'wb') with fd: diff --git a/docs/api.rst b/docs/api.rst deleted file mode 100644 index f05cdbc29..000000000 --- a/docs/api.rst +++ /dev/null @@ -1,86 +0,0 @@ - -.. IMPORTANT: this file is auto-generated by "setup.py build_api", do not edit! - - -API Documentation -================= - -.. automodule:: borg.archive - :members: - :undoc-members: - -.. automodule:: borg.archiver - :members: - :undoc-members: - -.. automodule:: borg.cache - :members: - :undoc-members: - -.. automodule:: borg.chunker - :members: - :undoc-members: - -.. automodule:: borg.compress - :members: get_compressor, Compressor, CompressorBase - :undoc-members: - -.. automodule:: borg.crypto - :members: - :undoc-members: - -.. automodule:: borg.fuse - :members: - :undoc-members: - -.. automodule:: borg.hashindex - :members: - :undoc-members: - -.. automodule:: borg.helpers - :members: - :undoc-members: - -.. automodule:: borg.key - :members: - :undoc-members: - -.. automodule:: borg.keymanager - :members: - :undoc-members: - -.. automodule:: borg.locking - :members: - :undoc-members: - -.. automodule:: borg.logger - :members: - :undoc-members: - -.. automodule:: borg.lrucache - :members: - :undoc-members: - -.. automodule:: borg.platform - :members: - :undoc-members: - -.. automodule:: borg.platform_linux - :members: - :undoc-members: - -.. automodule:: borg.remote - :members: - :undoc-members: - -.. automodule:: borg.repository - :members: - :undoc-members: - -.. automodule:: borg.shellpattern - :members: - :undoc-members: - -.. automodule:: borg.xattr - :members: - :undoc-members: diff --git a/docs/development.rst b/docs/development.rst index afc1e21a9..7dc2941ac 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -183,20 +183,19 @@ Important notes: Regenerate usage files ---------------------- -Usage and API documentation is currently committed directly to git, +Usage documentation is currently committed directly to git, although those files are generated automatically from the source tree. -When a new module is added, the ``docs/api.rst`` file needs to be -regenerated:: - - ./setup.py build_api - When a command is added, a commandline flag changed, added or removed, the usage docs need to be rebuilt as well:: ./setup.py build_usage +However, we prefer to do this as part of our :ref:`releasing` +preparations, so it is generally not necessary to update these when +submitting patches that change something about the command line. + Building the docs with Sphinx ----------------------------- @@ -270,7 +269,7 @@ Checklist: - update ``CHANGES.rst``, based on ``git log $PREVIOUS_RELEASE..`` - check version number of upcoming release in ``CHANGES.rst`` - verify that ``MANIFEST.in`` and ``setup.py`` are complete -- ``python setup.py build_api ; python setup.py build_usage`` and commit +- ``python setup.py build_usage`` and commit - tag the release:: git tag -s -m "tagged/signed release X.Y.Z" X.Y.Z diff --git a/docs/faq.rst b/docs/faq.rst index 6c69d60b5..fbf213768 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -321,6 +321,13 @@ for a potential solution. Please note that this workaround only helps you for backup, not for restore. +Can I backup my root partition (/) with Borg? +--------------------------------------------- + +Backing up your entire root partition works just fine, but remember to +exclude directories that make no sense to backup, such as /dev, /proc, +/sys, /tmp and /run. + If it crashes with a UnicodeError, what can I do? ------------------------------------------------- diff --git a/setup.py b/setup.py index e3b8beb9e..8f65963d5 100644 --- a/setup.py +++ b/setup.py @@ -213,43 +213,8 @@ class build_usage(Command): return is_subcommand -class build_api(Command): - description = "generate a basic api.rst file based on the modules available" - - user_options = [ - ('output=', 'O', 'output directory'), - ] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - print("auto-generating API documentation") - with open("docs/api.rst", "w") as doc: - doc.write(""" -.. IMPORTANT: this file is auto-generated by "setup.py build_api", do not edit! - - -API Documentation -================= -""") - for mod in sorted(glob('borg/*.py') + glob('borg/*.pyx')): - print("examining module %s" % mod) - mod = mod.replace('.pyx', '').replace('.py', '').replace('/', '.') - if "._" not in mod: - doc.write(""" -.. automodule:: %s - :members: - :undoc-members: -""" % mod) - - cmdclass = { 'build_ext': build_ext, - 'build_api': build_api, 'build_usage': build_usage, 'sdist': Sdist }