Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
deja-dup
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
GNOME
deja-dup
Commits
b25db647
Commit
b25db647
authored
Jan 26, 2018
by
Jeremy Bicha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cherry pick upstream patch to exclude snap cache directories
by default (LP: #1744584)
parent
4a32611e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
0 deletions
+149
-0
debian/patches/0001-Exclude-snap-cache-dirs.patch
debian/patches/0001-Exclude-snap-cache-dirs.patch
+148
-0
debian/patches/series
debian/patches/series
+1
-0
No files found.
debian/patches/0001-Exclude-snap-cache-dirs.patch
0 → 100644
View file @
b25db647
From: Michael Terry <mike@mterry.name>
Date: Tue, 23 Jan 2018 21:40:46 -0500
Subject: Exclude snap cache dirs
---
deja-dup/help/C/prefs.page | 1 +
libdeja/OperationBackup.vala | 43 ++++++++++++++-----------------
libdeja/ToolPlugin.vala | 1 +
libdeja/tests/runner.vala | 4 ++-
libdeja/tools/duplicity/DuplicityJob.vala | 6 +++++
5 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/deja-dup/help/C/prefs.page b/deja-dup/help/C/prefs.page
index ae6eb36..810b56e 100644
--- a/deja-dup/help/C/prefs.page
+++ b/deja-dup/help/C/prefs.page
@@ -34,6 +34,7 @@
<item><p><file>~/.steam/root</file> <span its:translate="yes">(which by default also ignores <file its:translate="no">~/.local/share/Steam</file>)</span></p></item>
<item><p><file>~/.thumbnails</file></p></item>
<item><p><file>~/.xsession-errors</file></p></item>
+ <item><p><file>~/snap/*/*/.cache</file></p></item>
<item><p><file>/proc</file></p></item>
<item><p><file>/run</file></p></item>
<item><p><file>/sys</file></p></item>
diff --git a/libdeja/OperationBackup.vala b/libdeja/OperationBackup.vala
index 0a95c2a..44e121a 100644
--- a/libdeja/OperationBackup.vala
+++ b/libdeja/OperationBackup.vala
@@ -59,10 +59,8 @@
public class OperationBackup : Operation
var exclude_list = settings.get_file_list(EXCLUDE_LIST_KEY);
// Exclude directories no one wants to backup
- var always_excluded = get_always_excluded_dirs();
- foreach (string dir in always_excluded)
- job.excludes.prepend(File.new_for_path(dir));
-
+ add_always_excluded_dirs(ref job.excludes, ref job.exclude_regexps);
+
foreach (File s in exclude_list)
job.excludes.prepend(s);
foreach (File s in include_list)
@@ -84,17 +82,15 @@
public class OperationBackup : Operation
return null;
}
- List<string> get_always_excluded_dirs()
+ void add_always_excluded_dirs(ref List<File> files, ref List<string> regexps)
{
- List<string> rv = new List<string>();
-
// User doesn't care about cache
string dir = Environment.get_user_cache_dir();
if (dir != null) {
- rv.append(dir);
+ files.prepend(File.new_for_path(dir));
// We also add our special cache dir because if the user still especially
// includes the cache dir, we still won't backup our own metadata.
- rv.append(Path.build_filename(dir, Config.PACKAGE));
+ files.prepend(File.new_for_path(Path.build_filename(dir, Config.PACKAGE)));
}
// Likewise, user doesn't care about cache-like directories in $HOME.
@@ -104,27 +100,26 @@
public class OperationBackup : Operation
// When changing this list, remember to update the help documentation too.
dir = Environment.get_home_dir();
if (dir != null) {
- rv.append(Path.build_filename(dir, ".adobe/Flash_Player/AssetCache"));
- rv.append(Path.build_filename(dir, ".ccache"));
- rv.append(Path.build_filename(dir, ".gvfs"));
- rv.append(Path.build_filename(dir, ".Private")); // encrypted copies of stuff in $HOME
- rv.append(Path.build_filename(dir, ".recent-applications.xbel"));
- rv.append(Path.build_filename(dir, ".recently-used.xbel"));
- rv.append(Path.build_filename(dir, ".steam/root"));
- rv.append(Path.build_filename(dir, ".thumbnails"));
- rv.append(Path.build_filename(dir, ".xsession-errors"));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".adobe/Flash_Player/AssetCache")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".ccache")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".gvfs")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".Private"))); // encrypted copies of stuff in $HOME
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".recent-applications.xbel")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".recently-used.xbel")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".steam/root")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".thumbnails")));
+ files.prepend(File.new_for_path(Path.build_filename(dir, ".xsession-errors")));
+ regexps.prepend(Path.build_filename(dir, "snap/*/*/.cache"));
}
// Skip all of our temporary directories
foreach (var tempdir in DejaDup.get_tempdirs())
- rv.append(tempdir);
+ files.prepend(File.new_for_path(tempdir));
// Skip transient directories
- rv.append("/proc");
- rv.append("/run");
- rv.append("/sys");
-
- return rv;
+ files.prepend(File.new_for_path("/proc"));
+ files.prepend(File.new_for_path("/run"));
+ files.prepend(File.new_for_path("/sys"));
}
void fill_metadir() throws Error
diff --git a/libdeja/ToolPlugin.vala b/libdeja/ToolPlugin.vala
index a65355f..ae800c3 100644
--- a/libdeja/ToolPlugin.vala
+++ b/libdeja/ToolPlugin.vala
@@ -65,6 +65,7 @@
public abstract class ToolJob : Object
public List<File> includes; // BACKUP
public List<File> excludes; // BACKUP
+ public List<string> exclude_regexps; // BACKUP
protected List<File> _restore_files;
public List<File> restore_files { // RESTORE
diff --git a/libdeja/tests/runner.vala b/libdeja/tests/runner.vala
index a5eceb5..cedb157 100644
--- a/libdeja/tests/runner.vala
+++ b/libdeja/tests/runner.vala
@@ -191,7 +191,9 @@
string default_args(BackupRunner br, Mode mode = Mode.NONE, bool encrypted = fal
args += "collection-status ";
if (mode == Mode.STATUS || mode == Mode.NONE || mode == Mode.DRY || mode == Mode.BACKUP) {
- args += "'--exclude=%s' '--include=%s/deja-dup/metadata' ".printf(backupdir, cachedir);
+ args += "'--exclude=%s' ".printf(backupdir);
+ args += "'--exclude=%s/snap/*/*/.cache' ".printf(Environment.get_home_dir());
+ args += "'--include=%s/deja-dup/metadata' ".printf(cachedir);
string[] excludes1 = {"~/Downloads", "~/.local/share/Trash", "~/.xsession-errors", "~/.thumbnails", "~/.steam/root", "~/.Private", "~/.gvfs", "~/.ccache", "~/.adobe/Flash_Player/AssetCache"};
foreach (string ex in excludes1) {
diff --git a/libdeja/tools/duplicity/DuplicityJob.vala b/libdeja/tools/duplicity/DuplicityJob.vala
index 3b8addb..8110053 100644
--- a/libdeja/tools/duplicity/DuplicityJob.vala
+++ b/libdeja/tools/duplicity/DuplicityJob.vala
@@ -310,6 +310,12 @@
internal class DuplicityJob : DejaDup.ToolJob
includes.sort((CompareFunc)cmp_prefix);
excludes.sort((CompareFunc)cmp_prefix);
+ // TODO: Figure out a more reasonable way to order regexps and files.
+ // For now, just stick them in the front.
+ foreach (string r in exclude_regexps) {
+ saved_argv.append("--exclude=" + r);
+ }
+
foreach (File i in includes) {
var excludes2 = excludes.copy();
foreach (File e in excludes2) {
debian/patches/series
0 → 100644
View file @
b25db647
0001-Exclude-snap-cache-dirs.patch
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment