bup 0.13.2__tar.gz → 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {bup-0.13.2/bup.egg-info → bup-0.14.0}/PKG-INFO +22 -1
  2. bup-0.14.0/README.md +36 -0
  3. {bup-0.13.2 → bup-0.14.0}/bup/__version__.py +1 -1
  4. {bup-0.13.2 → bup-0.14.0}/bup/github_backup.py +21 -6
  5. {bup-0.13.2 → bup-0.14.0}/bup/gui/run_backup_widget.py +3 -0
  6. {bup-0.13.2 → bup-0.14.0}/bup/preferences.py +9 -2
  7. {bup-0.13.2 → bup-0.14.0/bup.egg-info}/PKG-INFO +22 -1
  8. {bup-0.13.2 → bup-0.14.0}/bup.egg-info/requires.txt +1 -0
  9. {bup-0.13.2 → bup-0.14.0}/pyproject.toml +1 -0
  10. bup-0.13.2/README.md +0 -16
  11. {bup-0.13.2 → bup-0.14.0}/LICENSE +0 -0
  12. {bup-0.13.2 → bup-0.14.0}/LICENSE.txt +0 -0
  13. {bup-0.13.2 → bup-0.14.0}/bup/LICENSE +0 -0
  14. {bup-0.13.2 → bup-0.14.0}/bup/__init__.py +0 -0
  15. {bup-0.13.2 → bup-0.14.0}/bup/__main__.py +0 -0
  16. {bup-0.13.2 → bup-0.14.0}/bup/arguments.py +0 -0
  17. {bup-0.13.2 → bup-0.14.0}/bup/aws_cli.py +0 -0
  18. {bup-0.13.2 → bup-0.14.0}/bup/backup_types.py +0 -0
  19. {bup-0.13.2 → bup-0.14.0}/bup/bup.ico +0 -0
  20. {bup-0.13.2 → bup-0.14.0}/bup/bup.png +0 -0
  21. {bup-0.13.2 → bup-0.14.0}/bup/bup_base.py +0 -0
  22. {bup-0.13.2 → bup-0.14.0}/bup/cli/__init__.py +0 -0
  23. {bup-0.13.2 → bup-0.14.0}/bup/cli/cli_main.py +0 -0
  24. {bup-0.13.2 → bup-0.14.0}/bup/dynamodb_backup.py +0 -0
  25. {bup-0.13.2 → bup-0.14.0}/bup/gpl-3.0.md +0 -0
  26. {bup-0.13.2 → bup-0.14.0}/bup/gui/__init__.py +0 -0
  27. {bup-0.13.2 → bup-0.14.0}/bup/gui/about.py +0 -0
  28. {bup-0.13.2 → bup-0.14.0}/bup/gui/bup_dialog.py +0 -0
  29. {bup-0.13.2 → bup-0.14.0}/bup/gui/gui_icon.py +0 -0
  30. {bup-0.13.2 → bup-0.14.0}/bup/gui/gui_main.py +0 -0
  31. {bup-0.13.2 → bup-0.14.0}/bup/gui/log_widget.py +0 -0
  32. {bup-0.13.2 → bup-0.14.0}/bup/gui/preferences_widget.py +0 -0
  33. {bup-0.13.2 → bup-0.14.0}/bup/log_routing.py +0 -0
  34. {bup-0.13.2 → bup-0.14.0}/bup/robust_os_calls.py +0 -0
  35. {bup-0.13.2 → bup-0.14.0}/bup/s3_backup.py +0 -0
  36. {bup-0.13.2 → bup-0.14.0}/bup/ui_types.py +0 -0
  37. {bup-0.13.2 → bup-0.14.0}/bup.egg-info/SOURCES.txt +0 -0
  38. {bup-0.13.2 → bup-0.14.0}/bup.egg-info/dependency_links.txt +0 -0
  39. {bup-0.13.2 → bup-0.14.0}/bup.egg-info/entry_points.txt +0 -0
  40. {bup-0.13.2 → bup-0.14.0}/bup.egg-info/top_level.txt +0 -0
  41. {bup-0.13.2 → bup-0.14.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bup
3
- Version: 0.13.2
3
+ Version: 0.14.0
4
4
  Summary: backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder
5
5
  Author-email: abel <j@abel.co>
6
6
  License-Expression: GPL-3.0-only
@@ -31,6 +31,7 @@ Provides-Extra: dev
31
31
  Requires-Dist: wheel; extra == "dev"
32
32
  Requires-Dist: black; extra == "dev"
33
33
  Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: moto[server]; extra == "dev"
34
35
  Requires-Dist: coverage; extra == "dev"
35
36
  Requires-Dist: pytest-cov; extra == "dev"
36
37
  Requires-Dist: pyship; extra == "dev"
@@ -44,6 +45,26 @@ Dynamic: license-file
44
45
 
45
46
  backup for github repos and AWS S3 and DynamoDB
46
47
 
48
+ # Exclusions
49
+
50
+ Each backup type (S3, DynamoDB, GitHub) has an exclusion list: names to skip, one per line. S3 entries are bucket
51
+ names, DynamoDB entries are table names, and GitHub entries are either a repo name (`my-repo`) or `owner/my-repo`.
52
+ Exclusion lists are edited in the GUI's "Exclusions" box for each backup type.
53
+
54
+ The same syntax applies to all three lists (S3 buckets, DynamoDB tables, and GitHub repos):
55
+
56
+ - `#` starts a comment that runs to the end of the line. This works for whole-line comments and for inline
57
+ trailing comments, e.g. `my-bucket # too big, backed up elsewhere`.
58
+ - Blank and whitespace-only lines are ignored.
59
+ - Leading and trailing whitespace around a name is ignored, so ` my-bucket ` matches `my-bucket`.
60
+ - Names are matched exactly (no wildcards).
61
+
62
+ ```
63
+ # S3 buckets to skip
64
+ logs-archive # 2 TB, backed up by a lifecycle rule instead
65
+ scratch-bucket
66
+ ```
67
+
47
68
  # Security Notes
48
69
 
49
70
  - Credentials you enter (AWS secret access key, GitHub token) are stored **unencrypted** in a local
bup-0.14.0/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # bup
2
+
3
+ backup for github repos and AWS S3 and DynamoDB
4
+
5
+ # Exclusions
6
+
7
+ Each backup type (S3, DynamoDB, GitHub) has an exclusion list: names to skip, one per line. S3 entries are bucket
8
+ names, DynamoDB entries are table names, and GitHub entries are either a repo name (`my-repo`) or `owner/my-repo`.
9
+ Exclusion lists are edited in the GUI's "Exclusions" box for each backup type.
10
+
11
+ The same syntax applies to all three lists (S3 buckets, DynamoDB tables, and GitHub repos):
12
+
13
+ - `#` starts a comment that runs to the end of the line. This works for whole-line comments and for inline
14
+ trailing comments, e.g. `my-bucket # too big, backed up elsewhere`.
15
+ - Blank and whitespace-only lines are ignored.
16
+ - Leading and trailing whitespace around a name is ignored, so ` my-bucket ` matches `my-bucket`.
17
+ - Names are matched exactly (no wildcards).
18
+
19
+ ```
20
+ # S3 buckets to skip
21
+ logs-archive # 2 TB, backed up by a lifecycle rule instead
22
+ scratch-bucket
23
+ ```
24
+
25
+ # Security Notes
26
+
27
+ - Credentials you enter (AWS secret access key, GitHub token) are stored **unencrypted** in a local
28
+ SQLite preferences database in your user profile. Prefer AWS profiles (`~/.aws/credentials`) over
29
+ raw keys where possible, and treat the preferences database with the same care as a credentials file.
30
+ - GitHub authentication for clone/pull is passed to git via the process environment, so the token is
31
+ not written into each backup's `.git/config`. Backups made by older versions of bup may still have
32
+ a token embedded in their remote URL; bup scrubs these the next time each repo is pulled.
33
+
34
+ # Acknowledgements
35
+
36
+ <div>Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
@@ -1,4 +1,4 @@
1
- __version__ = "0.13.2"
1
+ __version__ = "0.14.0"
2
2
  __application_name__ = "bup"
3
3
  __title__ = __application_name__
4
4
  __author__ = "abel"
@@ -99,7 +99,7 @@ class GithubBackup(BupBase):
99
99
  except GitCommandError as e:
100
100
  self.warning_out(self.redact(f'could not pull "{repo_dir}" - will try to start over and do a clone of "{repo_owner_and_name},{e}","{__file__}"'))
101
101
 
102
- # new to us (or the pull failed, e.g. a force-pushed branch with a rewritten history) - clone the repo
102
+ # new to us (or the fetch/reset failed, e.g. a corrupt local clone) - clone the repo
103
103
  if not pull_success:
104
104
  try:
105
105
  if repo_dir.exists():
@@ -145,6 +145,20 @@ class GithubBackup(BupBase):
145
145
  except (GitCommandError, AttributeError, ValueError) as e:
146
146
  log.warning(self.redact(f'could not set remote url for "{repo_dir}" : {e}'))
147
147
 
148
+ # A backup is a mirror: the goal is "local == remote, exactly", never to integrate histories.
149
+ # So this is fetch + hard reset to the remote-tracking ref (the model git itself uses for mirrors),
150
+ # not "git pull" - a merge would fail on any force-pushed branch (rebased feature branches,
151
+ # CI-owned branches such as gh-pages or badges, orphan branches) and trigger a needless full re-clone.
152
+ # One fetch per repo transfers every branch's objects in a single negotiation; --prune drops
153
+ # remote-tracking refs for branches deleted on GitHub so the local ref set stays honest.
154
+ self.info_out(f'git fetch "{repo_name}"')
155
+ try:
156
+ git_repo.git.fetch("--prune", "origin")
157
+ except GitCommandError as e:
158
+ # recoverable - the caller falls back to a fresh clone, and escalates to an error if that also fails
159
+ self.warning_out(self.redact(f"{repo_name} : {e}"))
160
+ return False
161
+
148
162
  for branch in branches:
149
163
  if self.stop_requested:
150
164
  break
@@ -154,17 +168,18 @@ class GithubBackup(BupBase):
154
168
  if branch_name.lower() == "main" or (main_branch is None and branch_name.lower() == "master"):
155
169
  main_branch = branch
156
170
 
157
- self.info_out(f'git pull "{repo_name}" branch:"{branch_name}"')
171
+ self.info_out(f'git reset "{repo_name}" branch:"{branch_name}"')
158
172
  try:
159
173
  git_repo.git.reset("--hard")
160
174
  git_repo.git.clean("-fd")
161
- git_repo.git.checkout(branch_name)
162
- git_repo.git.pull()
175
+ git_repo.git.checkout(branch_name) # creates a local tracking branch from origin/<name> on first sight
176
+ git_repo.git.reset("--hard", f"origin/{branch_name}")
177
+ git_repo.git.clean("-fd")
163
178
  success = True
164
179
  except GitCommandError as e:
165
180
  if "did not match any file".lower() in str(e).lower():
166
181
  # new branch with no files yet - skip it and continue with other branches
167
- self.info_out(f"git pull {repo_name} branch:{branch_name} - no files")
182
+ self.info_out(f"git reset {repo_name} branch:{branch_name} - no files")
168
183
  continue
169
184
  elif "would be overwritten by checkout" in str(e).lower():
170
185
  # typically caused by CRLF line-ending normalization on Windows, not actual user edits
@@ -172,7 +187,7 @@ class GithubBackup(BupBase):
172
187
  success = False
173
188
  break
174
189
  else:
175
- # recoverable (e.g. a force-pushed branch whose rewritten history can't be merged) -
190
+ # recoverable (e.g. a corrupt object store) -
176
191
  # the caller falls back to a fresh clone, and escalates to an error if that also fails
177
192
  self.warning_out(self.redact(f"{repo_name} : {e}"))
178
193
  success = False
@@ -107,6 +107,9 @@ class BackupWidget(QGroupBox):
107
107
  # read exclusions into the DB
108
108
  exclusions = ExclusionPreferences(self.backup_type.name)
109
109
  self.display_boxes[display_type].text_box.setText("\n".join(exclusions.get()))
110
+ self.display_boxes[display_type].text_box.setToolTip(
111
+ "One name per line. '#' starts a comment (whole line or trailing, e.g. 'my-bucket # note'). Blank lines and surrounding whitespace are ignored."
112
+ )
110
113
  self.display_boxes[display_type].text_box.textChanged.connect(self.exclusions_save_timer.start)
111
114
  else:
112
115
  self.display_boxes[display_type].text_box.setReadOnly(True)
@@ -73,5 +73,12 @@ class ExclusionPreferences(PrefOrderedSet):
73
73
  super().__init__(__application_name__, __author__, f"exclusions_{exclusion_type}")
74
74
 
75
75
  def get_no_comments(self) -> List[str]:
76
- # get list of exclusions with comment and blank lines removed (tolerating leading whitespace)
77
- return [s for s in super().get() if len(s.strip()) > 0 and not s.strip().startswith("#")]
76
+ """
77
+ Exclusion entries with rudimentary sanitization applied: anything from a "#" to the end of the line is a comment
78
+ (so both whole-line comments and inline trailing comments such as "my-bucket # note" are supported), comments and
79
+ blank/whitespace-only lines are dropped, and leading/trailing whitespace is stripped from the remaining entries
80
+ so that e.g. "my-bucket " still matches "my-bucket". "#" can not appear in S3 bucket, DynamoDB table, or GitHub
81
+ repo names, so there is no need for an escape.
82
+ """
83
+ entries_without_comments = [s.split("#", 1)[0].strip() for s in super().get()]
84
+ return [s for s in entries_without_comments if len(s) > 0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bup
3
- Version: 0.13.2
3
+ Version: 0.14.0
4
4
  Summary: backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder
5
5
  Author-email: abel <j@abel.co>
6
6
  License-Expression: GPL-3.0-only
@@ -31,6 +31,7 @@ Provides-Extra: dev
31
31
  Requires-Dist: wheel; extra == "dev"
32
32
  Requires-Dist: black; extra == "dev"
33
33
  Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: moto[server]; extra == "dev"
34
35
  Requires-Dist: coverage; extra == "dev"
35
36
  Requires-Dist: pytest-cov; extra == "dev"
36
37
  Requires-Dist: pyship; extra == "dev"
@@ -44,6 +45,26 @@ Dynamic: license-file
44
45
 
45
46
  backup for github repos and AWS S3 and DynamoDB
46
47
 
48
+ # Exclusions
49
+
50
+ Each backup type (S3, DynamoDB, GitHub) has an exclusion list: names to skip, one per line. S3 entries are bucket
51
+ names, DynamoDB entries are table names, and GitHub entries are either a repo name (`my-repo`) or `owner/my-repo`.
52
+ Exclusion lists are edited in the GUI's "Exclusions" box for each backup type.
53
+
54
+ The same syntax applies to all three lists (S3 buckets, DynamoDB tables, and GitHub repos):
55
+
56
+ - `#` starts a comment that runs to the end of the line. This works for whole-line comments and for inline
57
+ trailing comments, e.g. `my-bucket # too big, backed up elsewhere`.
58
+ - Blank and whitespace-only lines are ignored.
59
+ - Leading and trailing whitespace around a name is ignored, so ` my-bucket ` matches `my-bucket`.
60
+ - Names are matched exactly (no wildcards).
61
+
62
+ ```
63
+ # S3 buckets to skip
64
+ logs-archive # 2 TB, backed up by a lifecycle rule instead
65
+ scratch-bucket
66
+ ```
67
+
47
68
  # Security Notes
48
69
 
49
70
  - Credentials you enter (AWS secret access key, GitHub token) are stored **unencrypted** in a local
@@ -19,6 +19,7 @@ sentry-sdk
19
19
  wheel
20
20
  black
21
21
  pytest
22
+ moto[server]
22
23
  coverage
23
24
  pytest-cov
24
25
  pyship
@@ -38,6 +38,7 @@ dev = [
38
38
  "wheel",
39
39
  "black",
40
40
  "pytest",
41
+ "moto[server]",
41
42
  "coverage",
42
43
  "pytest-cov",
43
44
  "pyship",
bup-0.13.2/README.md DELETED
@@ -1,16 +0,0 @@
1
- # bup
2
-
3
- backup for github repos and AWS S3 and DynamoDB
4
-
5
- # Security Notes
6
-
7
- - Credentials you enter (AWS secret access key, GitHub token) are stored **unencrypted** in a local
8
- SQLite preferences database in your user profile. Prefer AWS profiles (`~/.aws/credentials`) over
9
- raw keys where possible, and treat the preferences database with the same care as a credentials file.
10
- - GitHub authentication for clone/pull is passed to git via the process environment, so the token is
11
- not written into each backup's `.git/config`. Backups made by older versions of bup may still have
12
- a token embedded in their remote URL; bup scrubs these the next time each repo is pulled.
13
-
14
- # Acknowledgements
15
-
16
- <div>Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes