Merge lp:~mterry/deja-dup/detect-encryption into lp:deja-dup/30

Proposed by Michael Terry
Status: Merged
Merged at revision: 1503
Proposed branch: lp:~mterry/deja-dup/detect-encryption
Merge into: lp:deja-dup/30
Diff against target: 357 lines (+62/-91)
11 files modified
libdeja/tests/scripts/delete-just-right.test (+2/-2)
libdeja/tests/scripts/delete-too-few.test (+1/-1)
libdeja/tests/scripts/delete-too-old.test (+7/-7)
libdeja/tests/scripts/disk-full.test (+6/-6)
libdeja/tests/scripts/disk-full2.test (+3/-3)
libdeja/tests/scripts/encrypt-ask.test (+12/-9)
libdeja/tests/scripts/encrypt-detect.test (+8/-6)
libdeja/tests/scripts/nag.test (+20/-16)
libdeja/tests/scripts/threshold-full.test (+1/-1)
libdeja/tests/scripts/threshold-inc.test (+1/-1)
libdeja/tools/duplicity/DuplicityJob.vala (+1/-39)
To merge this branch: bzr merge lp:~mterry/deja-dup/detect-encryption
Reviewer Review Type Date Requested Status
Robert Bruce Park (community) Approve
Déjà Dup Developers Pending
Review via email: mp+191484@code.launchpad.net

Description of the change

Use official duplicity method of declaring that a backup is encrypted.

A while back, I added support to duplicity to announce whether the backup is encrypted or not. I also added support in deja-dup for noticing. Unfortunately, there was a bug with the first implementation, and I never actually turned on deja-dup-side support for the feature.

But I figure it's about time. Our current method is to just scan duplicity debug messages for file names ending in .gpg, which seems brittle.

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) wrote :

Ok, had to merge trunk in order to get this to compile, but it looks good ;-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdeja/tests/scripts/delete-just-right.test'
2--- libdeja/tests/scripts/delete-just-right.test 2012-10-31 11:42:52 +0000
3+++ libdeja/tests/scripts/delete-just-right.test 2013-10-16 19:21:14 +0000
4@@ -9,9 +9,9 @@
5 [Duplicity status]
6 #echo "INFO 3"
7 #echo "chain-no-sig"
8-#echo " full $(date --utc --date='1001 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
9+#echo " full $(date --utc --date='1001 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
10 #echo "chain-complete"
11-#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
12+#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
13 OutputScript=true
14
15 [Duplicity remove]
16
17=== modified file 'libdeja/tests/scripts/delete-too-few.test'
18--- libdeja/tests/scripts/delete-too-few.test 2012-10-31 11:42:52 +0000
19+++ libdeja/tests/scripts/delete-too-few.test 2013-10-16 19:21:14 +0000
20@@ -9,5 +9,5 @@
21 [Duplicity status]
22 #echo "INFO 3"
23 #echo "chain-complete"
24-#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
25+#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
26 OutputScript=true
27
28=== modified file 'libdeja/tests/scripts/delete-too-old.test'
29--- libdeja/tests/scripts/delete-too-old.test 2012-10-31 11:42:52 +0000
30+++ libdeja/tests/scripts/delete-too-old.test 2013-10-16 19:21:14 +0000
31@@ -9,14 +9,14 @@
32 [Duplicity status]
33 #echo "INFO 3"
34 #echo "chain-no-sig"
35-#echo " full $(date --utc --date='503 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
36-#echo "chain-no-sig"
37-#echo " full $(date --utc --date='502 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
38-#echo "chain-no-sig"
39-#echo " full $(date --utc --date='501 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
40-#echo " inc $(date --utc --date='500 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
41+#echo " full $(date --utc --date='503 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
42+#echo "chain-no-sig"
43+#echo " full $(date --utc --date='502 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
44+#echo "chain-no-sig"
45+#echo " full $(date --utc --date='501 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
46+#echo " inc $(date --utc --date='500 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
47 #echo "chain-complete"
48-#echo " full $(date --utc --date='499 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
49+#echo " full $(date --utc --date='499 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
50 OutputScript=true
51
52 [Duplicity remove]
53
54=== modified file 'libdeja/tests/scripts/disk-full.test'
55--- libdeja/tests/scripts/disk-full.test 2012-10-28 22:35:44 +0000
56+++ libdeja/tests/scripts/disk-full.test 2013-10-16 19:21:14 +0000
57@@ -8,11 +8,11 @@
58 [Duplicity status 1]
59 #echo "INFO 3"
60 #echo "chain-no-sig"
61-#echo " full $(date --utc --date='3 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
62+#echo " full $(date --utc --date='3 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
63 #echo "chain-no-sig"
64-#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
65+#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
66 #echo "chain-complete"
67-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
68+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
69 OutputScript=true
70
71 [Duplicity dry]
72@@ -25,9 +25,9 @@
73 [Duplicity status 2]
74 #echo "INFO 3"
75 #echo "chain-no-sig"
76-#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
77+#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
78 #echo "chain-complete"
79-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
80+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
81 OutputScript=true
82
83 [Duplicity remove 2]
84@@ -36,5 +36,5 @@
85 [Duplicity status 3]
86 #echo "INFO 3"
87 #echo "chain-complete"
88-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
89+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
90 OutputScript=true
91
92=== modified file 'libdeja/tests/scripts/disk-full2.test'
93--- libdeja/tests/scripts/disk-full2.test 2012-10-28 22:35:44 +0000
94+++ libdeja/tests/scripts/disk-full2.test 2013-10-16 19:21:14 +0000
95@@ -8,9 +8,9 @@
96 [Duplicity status 1]
97 #echo "INFO 3"
98 #echo "chain-no-sig"
99-#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
100+#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
101 #echo "chain-complete"
102-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
103+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
104 OutputScript=true
105
106 [Duplicity dry]
107@@ -23,5 +23,5 @@
108 [Duplicity status 2]
109 #echo "INFO 3"
110 #echo "chain-complete"
111-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
112+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
113 OutputScript=true
114
115=== modified file 'libdeja/tests/scripts/encrypt-ask.test'
116--- libdeja/tests/scripts/encrypt-ask.test 2012-08-13 23:44:06 +0000
117+++ libdeja/tests/scripts/encrypt-ask.test 2013-10-16 19:21:14 +0000
118@@ -6,9 +6,10 @@
119 Runs=status 1;dry 1;status 2;dry 2;backup 1;status 3;dry 3;backup 2;status-restore;list;verify;
120
121 [Duplicity status 1]
122-#DEBUG 1
123-#. ['duplicity.gpg']
124-Output=true
125+#echo "INFO 3"
126+#echo "chain-complete"
127+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
128+OutputScript=true
129
130 [Duplicity dry 1]
131 #ERROR 31
132@@ -16,9 +17,10 @@
133 Encrypted=true
134
135 [Duplicity status 2]
136-#DEBUG 1
137-#. ['duplicity.gpg']
138-Output=true
139+#echo "INFO 3"
140+#echo "chain-complete"
141+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
142+OutputScript=true
143 Encrypted=true
144 Passphrase=true
145
146@@ -33,9 +35,10 @@
147 Passphrase=true
148
149 [Duplicity status 3]
150-#DEBUG 1
151-#. ['duplicity.gpg']
152-Output=true
153+#echo "INFO 3"
154+#echo "chain-complete"
155+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
156+OutputScript=true
157 Encrypted=true
158 Passphrase=true
159
160
161=== renamed file 'libdeja/tests/scripts/encrypt-regex.test' => 'libdeja/tests/scripts/encrypt-detect.test'
162--- libdeja/tests/scripts/encrypt-regex.test 2012-08-13 23:44:06 +0000
163+++ libdeja/tests/scripts/encrypt-detect.test 2013-10-16 19:21:14 +0000
164@@ -5,9 +5,10 @@
165 Runs=status;dry;backup;status-restore;list;verify;
166
167 [Duplicity status]
168-#DEBUG 1
169-#. ['duplicity.gpg']
170-Output=true
171+#echo "INFO 3"
172+#echo "chain-complete"
173+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
174+OutputScript=true
175
176 [Duplicity dry]
177 Encrypted=true
178@@ -16,9 +17,10 @@
179 Encrypted=true
180
181 [Duplicity status-restore]
182-#DEBUG 1
183-#. ['duplicity.gpg']
184-Output=true
185+#echo "INFO 3"
186+#echo "chain-complete"
187+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
188+OutputScript=true
189
190 [Duplicity list]
191 Encrypted=true
192
193=== modified file 'libdeja/tests/scripts/nag.test'
194--- libdeja/tests/scripts/nag.test 2012-08-20 01:16:15 +0000
195+++ libdeja/tests/scripts/nag.test 2013-10-16 19:21:14 +0000
196@@ -10,16 +10,18 @@
197 Runs=status 1;status 2;dry;backup;status-restore 1;status-restore 2;list;verify;
198
199 [Duplicity status 1]
200-#DEBUG 1
201-#. ['duplicity.gpg']
202-#
203-#ERROR 31
204-Output=true
205+#echo "INFO 3"
206+#echo "chain-complete"
207+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
208+#echo
209+#echo "ERROR 31"
210+OutputScript=true
211
212 [Duplicity status 2]
213-#DEBUG 1
214-#. ['duplicity.gpg']
215-Output=true
216+#echo "INFO 3"
217+#echo "chain-complete"
218+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
219+OutputScript=true
220 Encrypted=true
221 Passphrase=true
222
223@@ -32,17 +34,19 @@
224 Passphrase=true
225
226 [Duplicity status-restore 1]
227-#DEBUG 1
228-#. ['duplicity.gpg']
229-#
230-#ERROR 31
231-Output=true
232+#echo "INFO 3"
233+#echo "chain-complete"
234+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
235+#echo
236+#echo "ERROR 31"
237+OutputScript=true
238 ArchiveDirIsTmp=true
239
240 [Duplicity status-restore 2]
241-#DEBUG 1
242-#. ['duplicity.gpg']
243-Output=true
244+#echo "INFO 3"
245+#echo "chain-complete"
246+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
247+OutputScript=true
248 Encrypted=true
249 Passphrase=true
250 ArchiveDirIsTmp=true
251
252=== modified file 'libdeja/tests/scripts/threshold-full.test'
253--- libdeja/tests/scripts/threshold-full.test 2012-08-10 18:33:29 +0000
254+++ libdeja/tests/scripts/threshold-full.test 2013-10-16 19:21:14 +0000
255@@ -11,5 +11,5 @@
256 [Duplicity status]
257 #echo "INFO 3"
258 #echo "chain-complete"
259-#echo " full $(date --utc --date='91 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
260+#echo " full $(date --utc --date='91 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
261 OutputScript=true
262
263=== modified file 'libdeja/tests/scripts/threshold-inc.test'
264--- libdeja/tests/scripts/threshold-inc.test 2012-08-10 18:33:29 +0000
265+++ libdeja/tests/scripts/threshold-inc.test 2013-10-16 19:21:14 +0000
266@@ -12,5 +12,5 @@
267 [Duplicity status]
268 #echo "INFO 3"
269 #echo "chain-complete"
270-#echo " full $(date --utc --date='90 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
271+#echo " full $(date --utc --date='90 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
272 OutputScript=true
273
274=== modified file 'libdeja/tools/duplicity/DuplicityJob.vala'
275--- libdeja/tools/duplicity/DuplicityJob.vala 2013-09-24 02:16:16 +0000
276+++ libdeja/tools/duplicity/DuplicityJob.vala 2013-10-16 19:21:14 +0000
277@@ -57,7 +57,6 @@
278 static File slash_root;
279 static File slash_home;
280 static File slash_home_me;
281- static Regex gpg_regex;
282
283 bool has_checked_contents = false;
284 bool has_non_home_contents = false;
285@@ -97,15 +96,6 @@
286 slash_home = File.new_for_path("/home");
287 slash_home_me = File.new_for_path(Environment.get_home_dir());
288 }
289-
290- if (gpg_regex == null) {
291- try {
292- gpg_regex = new Regex(".*\\[.*\\.(g|gpg)'.*]$");
293- }
294- catch (Error e) {
295- error("%s\n", e.message); // this is a programmer error, so use error()
296- }
297- }
298 }
299
300 ~DuplicityJob() {
301@@ -885,9 +875,6 @@
302 case "WARNING":
303 process_warning(control_line, data_lines, user_text);
304 break;
305- case "DEBUG":
306- process_debug(control_line, data_lines, user_text);
307- break;
308 }
309 }
310
311@@ -1125,28 +1112,6 @@
312 }
313 }
314
315- protected virtual void process_debug(string[] firstline, List<string>? data,
316- string text)
317- {
318- /*
319- * Pass message to appropriate function considering the type of output
320- */
321- if (firstline.length > 1) {
322- switch (int.parse(firstline[1])) {
323- case DEBUG_GENERIC:
324- if (mode == DejaDup.ToolJob.Mode.STATUS &&
325- /*!DuplicityInfo.get_default().reports_encryption &&*/
326- !detected_encryption) {
327- if (gpg_regex != null && gpg_regex.match(text)) {
328- detected_encryption = true;
329- existing_encrypted = true;
330- }
331- }
332- break;
333- }
334- }
335- }
336-
337 void process_file_stat(string date, string file, List<string> data, string text)
338 {
339 if (mode != DejaDup.ToolJob.Mode.LIST)
340@@ -1243,16 +1208,13 @@
341 info.full = tokens[1] == "full";
342 infos.append(info);
343
344-/*
345- if (DuplicityInfo.get_default().reports_encryption &&
346- !detected_encryption &&
347+ if (!detected_encryption &&
348 tokens.length > 4) {
349 // Just use the encryption status of the first one we see;
350 // mixed-encryption backups is not supported.
351 detected_encryption = true;
352 existing_encrypted = tokens[4] == "enc";
353 }
354-*/
355 }
356 }
357 else if (in_chain)

Subscribers

People subscribed via source and target branches