← Back to team overview

deja-dup-team team mailing list archive

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

 

Michael Terry has proposed merging lp:~mterry/deja-dup/detect-encryption into lp:deja-dup.

Requested reviews:
  Robert Bruce Park (robru)
  Déjà Dup Developers (deja-dup-hackers)

For more details, see:
https://code.launchpad.net/~mterry/deja-dup/detect-encryption/+merge/191484

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.
-- 
https://code.launchpad.net/~mterry/deja-dup/detect-encryption/+merge/191484
Your team Déjà Dup Developers is requested to review the proposed merge of lp:~mterry/deja-dup/detect-encryption into lp:deja-dup.
=== modified file 'libdeja/tests/scripts/delete-just-right.test'
--- libdeja/tests/scripts/delete-just-right.test	2012-10-31 11:42:52 +0000
+++ libdeja/tests/scripts/delete-just-right.test	2013-10-16 19:21:14 +0000
@@ -9,9 +9,9 @@
 [Duplicity status]
 #echo "INFO 3"
 #echo "chain-no-sig"
-#echo " full $(date --utc --date='1001 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1001 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true
 
 [Duplicity remove]

=== modified file 'libdeja/tests/scripts/delete-too-few.test'
--- libdeja/tests/scripts/delete-too-few.test	2012-10-31 11:42:52 +0000
+++ libdeja/tests/scripts/delete-too-few.test	2013-10-16 19:21:14 +0000
@@ -9,5 +9,5 @@
 [Duplicity status]
 #echo "INFO 3"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1000 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true

=== modified file 'libdeja/tests/scripts/delete-too-old.test'
--- libdeja/tests/scripts/delete-too-old.test	2012-10-31 11:42:52 +0000
+++ libdeja/tests/scripts/delete-too-old.test	2013-10-16 19:21:14 +0000
@@ -9,14 +9,14 @@
 [Duplicity status]
 #echo "INFO 3"
 #echo "chain-no-sig"
-#echo " full $(date --utc --date='503 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
-#echo "chain-no-sig"
-#echo " full $(date --utc --date='502 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
-#echo "chain-no-sig"
-#echo " full $(date --utc --date='501 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
-#echo " inc $(date --utc --date='500 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='503 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
+#echo "chain-no-sig"
+#echo " full $(date --utc --date='502 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
+#echo "chain-no-sig"
+#echo " full $(date --utc --date='501 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
+#echo " inc $(date --utc --date='500 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 #echo "chain-complete"
-#echo " full $(date --utc --date='499 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='499 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true
 
 [Duplicity remove]

=== modified file 'libdeja/tests/scripts/disk-full.test'
--- libdeja/tests/scripts/disk-full.test	2012-10-28 22:35:44 +0000
+++ libdeja/tests/scripts/disk-full.test	2013-10-16 19:21:14 +0000
@@ -8,11 +8,11 @@
 [Duplicity status 1]
 #echo "INFO 3"
 #echo "chain-no-sig"
-#echo " full $(date --utc --date='3 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='3 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 #echo "chain-no-sig"
-#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true
 
 [Duplicity dry]
@@ -25,9 +25,9 @@
 [Duplicity status 2]
 #echo "INFO 3"
 #echo "chain-no-sig"
-#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true
 
 [Duplicity remove 2]
@@ -36,5 +36,5 @@
 [Duplicity status 3]
 #echo "INFO 3"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true

=== modified file 'libdeja/tests/scripts/disk-full2.test'
--- libdeja/tests/scripts/disk-full2.test	2012-10-28 22:35:44 +0000
+++ libdeja/tests/scripts/disk-full2.test	2013-10-16 19:21:14 +0000
@@ -8,9 +8,9 @@
 [Duplicity status 1]
 #echo "INFO 3"
 #echo "chain-no-sig"
-#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='2 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true
 
 [Duplicity dry]
@@ -23,5 +23,5 @@
 [Duplicity status 2]
 #echo "INFO 3"
 #echo "chain-complete"
-#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true

=== modified file 'libdeja/tests/scripts/encrypt-ask.test'
--- libdeja/tests/scripts/encrypt-ask.test	2012-08-13 23:44:06 +0000
+++ libdeja/tests/scripts/encrypt-ask.test	2013-10-16 19:21:14 +0000
@@ -6,9 +6,10 @@
 Runs=status 1;dry 1;status 2;dry 2;backup 1;status 3;dry 3;backup 2;status-restore;list;verify;
 
 [Duplicity status 1]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 
 [Duplicity dry 1]
 #ERROR 31
@@ -16,9 +17,10 @@
 Encrypted=true
 
 [Duplicity status 2]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 Encrypted=true
 Passphrase=true
 
@@ -33,9 +35,10 @@
 Passphrase=true
 
 [Duplicity status 3]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 Encrypted=true
 Passphrase=true
 

=== renamed file 'libdeja/tests/scripts/encrypt-regex.test' => 'libdeja/tests/scripts/encrypt-detect.test'
--- libdeja/tests/scripts/encrypt-regex.test	2012-08-13 23:44:06 +0000
+++ libdeja/tests/scripts/encrypt-detect.test	2013-10-16 19:21:14 +0000
@@ -5,9 +5,10 @@
 Runs=status;dry;backup;status-restore;list;verify;
 
 [Duplicity status]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 
 [Duplicity dry]
 Encrypted=true
@@ -16,9 +17,10 @@
 Encrypted=true
 
 [Duplicity status-restore]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 
 [Duplicity list]
 Encrypted=true

=== modified file 'libdeja/tests/scripts/nag.test'
--- libdeja/tests/scripts/nag.test	2012-08-20 01:16:15 +0000
+++ libdeja/tests/scripts/nag.test	2013-10-16 19:21:14 +0000
@@ -10,16 +10,18 @@
 Runs=status 1;status 2;dry;backup;status-restore 1;status-restore 2;list;verify;
 
 [Duplicity status 1]
-#DEBUG 1
-#. ['duplicity.gpg']
-#
-#ERROR 31
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo
+#echo "ERROR 31"
+OutputScript=true
 
 [Duplicity status 2]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 Encrypted=true
 Passphrase=true
 
@@ -32,17 +34,19 @@
 Passphrase=true
 
 [Duplicity status-restore 1]
-#DEBUG 1
-#. ['duplicity.gpg']
-#
-#ERROR 31
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo
+#echo "ERROR 31"
+OutputScript=true
 ArchiveDirIsTmp=true
 
 [Duplicity status-restore 2]
-#DEBUG 1
-#. ['duplicity.gpg']
-Output=true
+#echo "INFO 3"
+#echo "chain-complete"
+#echo " full $(date --utc --date='1 day ago' +%Y%m%dT%H%M%SZ) 1 enc"
+OutputScript=true
 Encrypted=true
 Passphrase=true
 ArchiveDirIsTmp=true

=== modified file 'libdeja/tests/scripts/threshold-full.test'
--- libdeja/tests/scripts/threshold-full.test	2012-08-10 18:33:29 +0000
+++ libdeja/tests/scripts/threshold-full.test	2013-10-16 19:21:14 +0000
@@ -11,5 +11,5 @@
 [Duplicity status]
 #echo "INFO 3"
 #echo "chain-complete"
-#echo " full $(date --utc --date='91 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='91 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true

=== modified file 'libdeja/tests/scripts/threshold-inc.test'
--- libdeja/tests/scripts/threshold-inc.test	2012-08-10 18:33:29 +0000
+++ libdeja/tests/scripts/threshold-inc.test	2013-10-16 19:21:14 +0000
@@ -12,5 +12,5 @@
 [Duplicity status]
 #echo "INFO 3"
 #echo "chain-complete"
-#echo " full $(date --utc --date='90 days ago' +%Y%m%dT%H%M%SZ) 1 enc"
+#echo " full $(date --utc --date='90 days ago' +%Y%m%dT%H%M%SZ) 1 noenc"
 OutputScript=true

=== modified file 'libdeja/tools/duplicity/DuplicityJob.vala'
--- libdeja/tools/duplicity/DuplicityJob.vala	2013-09-24 02:16:16 +0000
+++ libdeja/tools/duplicity/DuplicityJob.vala	2013-10-16 19:21:14 +0000
@@ -57,7 +57,6 @@
   static File slash_root;
   static File slash_home;
   static File slash_home_me;
-  static Regex gpg_regex;
   
   bool has_checked_contents = false;
   bool has_non_home_contents = false;
@@ -97,15 +96,6 @@
       slash_home = File.new_for_path("/home");
       slash_home_me = File.new_for_path(Environment.get_home_dir());
     }
-
-    if (gpg_regex == null) {
-      try {
-        gpg_regex = new Regex(".*\\[.*\\.(g|gpg)'.*]$");
-      }
-      catch (Error e) {
-        error("%s\n", e.message); // this is a programmer error, so use error()
-      }
-    }
   }
 
   ~DuplicityJob() {
@@ -885,9 +875,6 @@
     case "WARNING":
       process_warning(control_line, data_lines, user_text);
       break;
-    case "DEBUG":
-      process_debug(control_line, data_lines, user_text);
-      break;
     }
   }
   
@@ -1125,28 +1112,6 @@
     }
   }
 
-  protected virtual void process_debug(string[] firstline, List<string>? data,
-                                       string text)
-  {
-    /*
-     * Pass message to appropriate function considering the type of output
-     */
-    if (firstline.length > 1) {
-      switch (int.parse(firstline[1])) {
-      case DEBUG_GENERIC:
-        if (mode == DejaDup.ToolJob.Mode.STATUS &&
-            /*!DuplicityInfo.get_default().reports_encryption &&*/
-            !detected_encryption) {
-          if (gpg_regex != null && gpg_regex.match(text)) {
-            detected_encryption = true;
-            existing_encrypted = true;
-          }
-        }
-        break;
-      }
-    }
-  }
-
   void process_file_stat(string date, string file, List<string> data, string text)
   {
     if (mode != DejaDup.ToolJob.Mode.LIST)
@@ -1243,16 +1208,13 @@
           info.full = tokens[1] == "full";
           infos.append(info);
 
-/*
-          if (DuplicityInfo.get_default().reports_encryption &&
-              !detected_encryption &&
+          if (!detected_encryption &&
               tokens.length > 4) {
             // Just use the encryption status of the first one we see;
             // mixed-encryption backups is not supported.
             detected_encryption = true;
             existing_encrypted = tokens[4] == "enc";
           }
-*/
         }
       }
       else if (in_chain)