Skip to content

Commit

Permalink
borgmatic: add 1.9.0 build patch
Browse files Browse the repository at this point in the history
  • Loading branch information
chenrui333 committed Nov 5, 2024
1 parent 24a6945 commit fa4f1fe
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions borgmatic/1.9.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
diff --git a/borgmatic/commands/arguments.py b/borgmatic/commands/arguments.py
index 2eba9ff..f20984f 100644
--- a/borgmatic/commands/arguments.py
+++ b/borgmatic/commands/arguments.py
@@ -876,7 +876,7 @@ def make_parsers():
)
config_bootstrap_group.add_argument(
'--user-runtime-directory',
- help='Path used for temporary runtime data like bootstrap metadata. Defaults to $XDG_RUNTIME_DIR or /var/run/$UID',
+ help='Path used for temporary runtime data like bootstrap metadata. Defaults to $XDG_RUNTIME_DIR or $TMPDIR or $TEMP or /var/run/$UID',
)
config_bootstrap_group.add_argument(
'--borgmatic-source-directory',
diff --git a/borgmatic/config/paths.py b/borgmatic/config/paths.py
index d56ccc5..ad318d6 100644
--- a/borgmatic/config/paths.py
+++ b/borgmatic/config/paths.py
@@ -30,7 +30,8 @@ def get_borgmatic_runtime_directory(config):
'''
Given a configuration dict, get the borgmatic runtime directory used for storing temporary
runtime data like streaming database dumps and bootstrap metadata. Defaults to
- $XDG_RUNTIME_DIR/./borgmatic or /run/user/$UID/./borgmatic.
+ $XDG_RUNTIME_DIR/./borgmatic or $TMPDIR/./borgmatic or $TEMP/./borgmatic or
+ /run/user/$UID/./borgmatic.

The "/./" is taking advantage of a Borg feature such that the part of the path before the "/./"
does not get stored in the file path within an archive. That way, the path of the runtime
@@ -39,10 +40,10 @@ def get_borgmatic_runtime_directory(config):
return expand_user_in_path(
os.path.join(
config.get('user_runtime_directory')
- or os.environ.get(
- 'XDG_RUNTIME_DIR',
- f'/run/user/{os.getuid()}',
- ),
+ or os.environ.get('XDG_RUNTIME_DIR')
+ or os.environ.get('TMPDIR')
+ or os.environ.get('TEMP')
+ or f'/run/user/{os.getuid()}',
'.',
'borgmatic',
)
diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml
index 66ee665..accfbfd 100644
--- a/borgmatic/config/schema.yaml
+++ b/borgmatic/config/schema.yaml
@@ -218,7 +218,7 @@ properties:
Path for storing temporary runtime data like streaming database
dumps and bootstrap metadata. borgmatic automatically creates and
uses a "borgmatic" subdirectory here. Defaults to $XDG_RUNTIME_DIR
- or /run/user/$UID.
+ or or $TMPDIR or $TEMP or /run/user/$UID.
example: /run/user/1001/borgmatic
user_state_directory:
type: string
diff --git a/docs/how-to/backup-your-databases.md b/docs/how-to/backup-your-databases.md
index fc5aa5e..f216275 100644
--- a/docs/how-to/backup-your-databases.md
+++ b/docs/how-to/backup-your-databases.md
@@ -76,6 +76,11 @@ borgmatic created temporary streaming database dumps within the `~/.borgmatic`
directory by default. At that time, the path was configurable by the
`borgmatic_source_directory` configuration option (now deprecated).

+<span class="minilink minilink-addedin">New in version 1.9.1</span>In addition
+to `XDG_RUNTIME_DIR`, borgmatic also uses the `TMPDIR` or `TEMP` environment
+variable if set. `TMPDIR` is available on macOS, while `TEMP` is often
+available on other platforms.
+
Also note that using a database hook implicitly enables the
`read_special` configuration option (even if it's disabled in your
configuration) to support this dump and restore streaming. See Limitations
diff --git a/pyproject.toml b/pyproject.toml
index 647fa06..c3338c9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "borgmatic"
-version = "1.9.0"
+version = "1.9.1.dev0"
authors = [
{ name="Dan Helfman", email="[email protected]" },
]

0 comments on commit fa4f1fe

Please sign in to comment.