Merge lp:~mwilck/duplicity/0.7-series into lp:~duplicity-team/duplicity/0.7-series

Proposed by Martin Wilck
Status: Merged
Merged at revision: 1232
Proposed branch: lp:~mwilck/duplicity/0.7-series
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 111 lines (+31/-19)
5 files modified
duplicity/globmatch.py (+16/-12)
duplicity/selection.py (+3/-6)
testing/functional/__init__.py (+1/-1)
testing/gnupg/README (+2/-0)
testing/gnupg/gpg.conf (+9/-0)
To merge this branch: bzr merge lp:~mwilck/duplicity/0.7-series
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+301332@code.launchpad.net

Description of the change

This merge request contains the same change as
https://code.launchpad.net/~mwilck/duplicity/duplicity/+merge/301268,
for the 0.7 series this time. I believe a factor-20 speedup could be counted as a "bug fix".

Moreover, it includes 2 fixes that were necessary on my system (OpenSUSE tumbleweed) to make
the test suite pass. See the commit logs for details. I needed this in order to verify that the
first change didn't introduce any regressions.

To post a comment you must log in.
lp:~mwilck/duplicity/0.7-series updated
1232. By ken

* Merged in lp:~mwilck/duplicity/0.7-series
  - Speedup of path_matches_glob() by about 8x. See
    https://code.launchpad.net/~mwilck/duplicity/0.7-series/+merge/301332
    for more details.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

I had to remove -w from setsid to get precise and trusty to build on Launchpad.

Revision history for this message
Martin Wilck (mwilck) wrote :

Hmm, that would mean that setsid behaves differently on different distributions. It might be a difference in how setsid behaves, or a difference in pexpect.

In which test did the problems with "setsid -w" occur on precise / trusty?

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

All of the tests in tests/functional, as far as I can tell.

On Thu, Jul 28, 2016 at 1:59 PM, Martin Wilck <email address hidden> wrote:

> Hmm, that would mean that setsid behaves differently on different
> distributions. It might be a difference in how setsid behaves, or a
> difference in pexpect.
>
> In which test did the problems with "setsid -w" occur on precise / trusty?
>
> --
> https://code.launchpad.net/~mwilck/duplicity/0.7-series/+merge/301332
> You are subscribed to branch lp:duplicity/0.7-series.
>

Revision history for this message
Martin Wilck (mwilck) wrote :

To make sure I understand correctly - my changes work on Xenial and Wily but not on older Ubuntu releases? Are you using Ubuntu native pexpect packages or pexpect from PyPi?

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

I use pip, Launchpad uses their repo, which is out of date.

On Thursday, July 28, 2016, Martin Wilck <email address hidden> wrote:

> To make sure I understand correctly - my changes work on Xenial and Wily
> but not on older Ubuntu releases? Are you using Ubuntu native pexpect
> packages or pexpect from PyPi?
>
>
> --
> https://code.launchpad.net/~mwilck/duplicity/0.7-series/+merge/301332
> You are subscribed to branch lp:duplicity/0.7-series.
>

Revision history for this message
Martin Wilck (mwilck) wrote :

That might be the reason, then? Maybe we need to put in a version check on the pexpect module?

Revision history for this message
Martin Wilck (mwilck) wrote :

The problem is caused by different syntax of setsid invocation. setsid on Trusty doesn't support -w.

I am pushing a patch that tests for -w support and uses the flag only if supported.

Revision history for this message
Aaron Whitehouse (aaron-whitehouse) wrote :

For reference, while this talks about a x20 speedup, for me there is no material speed difference for the test suite between r 1231 and r 1232, so this speedup must be in a scenario not exhibited in the tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'duplicity/globmatch.py'
--- duplicity/globmatch.py 2016-06-27 21:12:18 +0000
+++ duplicity/globmatch.py 2016-07-27 21:14:04 +0000
@@ -49,8 +49,9 @@
49 return list(map(glob_to_regex, prefixes))49 return list(map(glob_to_regex, prefixes))
5050
5151
52def path_matches_glob(path, glob_str, include, ignore_case=False):52def path_matches_glob_fn(glob_str, include, ignore_case=False):
53 """Tests whether path matches glob, as per the Unix shell rules, taking as53 """Return a function test_fn(path) which
54 tests whether path matches glob, as per the Unix shell rules, taking as
54 arguments a path, a glob string and include (0 indicating that the glob55 arguments a path, a glob string and include (0 indicating that the glob
55 string is an exclude glob and 1 indicating that it is an include glob,56 string is an exclude glob and 1 indicating that it is an include glob,
56 returning:57 returning:
@@ -83,16 +84,19 @@
83 scan_comp_re = re_comp("^(%s)$" %84 scan_comp_re = re_comp("^(%s)$" %
84 "|".join(_glob_get_prefix_regexs(glob_str)))85 "|".join(_glob_get_prefix_regexs(glob_str)))
8586
86 if match_only_dirs and not path.isdir():87 def test_fn(path):
87 # If the glob ended with a /, only match directories88
88 return None89 if match_only_dirs and not path.isdir():
89 elif glob_comp_re.match(path.name):90 # If the glob ended with a /, only match directories
90 return include91 return None
91 elif include == 1 and scan_comp_re.match(path.name):92 elif glob_comp_re.match(path.name):
92 return 293 return include
93 else:94 elif include == 1 and scan_comp_re.match(path.name):
94 return None95 return 2
9596 else:
97 return None
98
99 return test_fn
96100
97def glob_to_regex(pat):101def glob_to_regex(pat):
98 """Returned regular expression equivalent to shell glob pat102 """Returned regular expression equivalent to shell glob pat
99103
=== modified file 'duplicity/selection.py'
--- duplicity/selection.py 2016-07-24 00:07:50 +0000
+++ duplicity/selection.py 2016-07-27 21:14:04 +0000
@@ -33,7 +33,7 @@
33from duplicity import diffdir33from duplicity import diffdir
34from duplicity import util # @Reimport34from duplicity import util # @Reimport
35from duplicity.globmatch import GlobbingError, FilePrefixError, \35from duplicity.globmatch import GlobbingError, FilePrefixError, \
36 path_matches_glob36 path_matches_glob_fn
3737
38"""Iterate exactly the requested files in a directory38"""Iterate exactly the requested files in a directory
3939
@@ -544,13 +544,10 @@
544 ignore_case = True544 ignore_case = True
545545
546 # Check to make sure prefix is ok546 # Check to make sure prefix is ok
547 if not path_matches_glob(self.rootpath, glob_str, include=1):547 if not path_matches_glob_fn(glob_str, include=1)(self.rootpath):
548 raise FilePrefixError(glob_str)548 raise FilePrefixError(glob_str)
549549
550 def sel_func(path):550 return path_matches_glob_fn(glob_str, include, ignore_case)
551 return path_matches_glob(path, glob_str, include, ignore_case)
552
553 return sel_func
554551
555 def exclude_older_get_sf(self, date):552 def exclude_older_get_sf(self, date):
556 """Return selection function based on files older than modification date """553 """Return selection function based on files older than modification date """
557554
=== modified file 'testing/functional/__init__.py'
--- testing/functional/__init__.py 2016-01-06 13:39:33 +0000
+++ testing/functional/__init__.py 2016-07-27 21:14:04 +0000
@@ -65,7 +65,7 @@
65 # this way we force a failure if duplicity tries to read from the65 # this way we force a failure if duplicity tries to read from the
66 # console unexpectedly (like for gpg password or such).66 # console unexpectedly (like for gpg password or such).
67 if platform.platform().startswith('Linux'):67 if platform.platform().startswith('Linux'):
68 cmd_list = ['setsid']68 cmd_list = ['setsid', '-w']
69 else:69 else:
70 cmd_list = []70 cmd_list = []
71 cmd_list.extend(["duplicity"])71 cmd_list.extend(["duplicity"])
7272
=== modified file 'testing/gnupg/README'
--- testing/gnupg/README 2011-11-04 12:48:04 +0000
+++ testing/gnupg/README 2016-07-27 21:14:04 +0000
@@ -11,3 +11,5 @@
11ID: 9B736B2A11ID: 9B736B2A
12Name: Recipient Two <two@example.com>12Name: Recipient Two <two@example.com>
13No password13No password
14
15See also the comments in gpg.conf.
1416
=== added file 'testing/gnupg/gpg.conf'
--- testing/gnupg/gpg.conf 1970-01-01 00:00:00 +0000
+++ testing/gnupg/gpg.conf 2016-07-27 21:14:04 +0000
@@ -0,0 +1,9 @@
1# gpg2 doesn't try all secrets by default, so add this option
2# Otherwise the tests with hidden encryption key will fail
3try-all-secrets
4
5# gpg2 2.1.13 has a bug that prevents the line above from working
6# (https://bugs.gnupg.org/gnupg/issue1985)
7# Uncomment the line below if you have gnupg2 2.1.13
8# (but that line will break gpg 1.x, so we can't use it by default)
9#try-secret-key 96B629431B77DC52B1917B40839E6A2856538CCF

Subscribers

People subscribed via source and target branches