]> arthur.barton.de Git - bup.git/log
bup.git
3 years agotick: convert to internal command
Rob Browning [Fri, 12 Feb 2021 19:36:04 +0000 (13:36 -0600)]
tick: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agotick-cmd: copy to bup.cmd.tick
Rob Browning [Fri, 12 Feb 2021 19:36:04 +0000 (13:36 -0600)]
tick-cmd: copy to bup.cmd.tick

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agotag: convert to internal command
Rob Browning [Fri, 12 Feb 2021 19:30:34 +0000 (13:30 -0600)]
tag: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agotag-cmd: copy to bup.cmd.tag
Rob Browning [Fri, 12 Feb 2021 19:30:34 +0000 (13:30 -0600)]
tag-cmd: copy to bup.cmd.tag

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agomidx: convert to internal command
Rob Browning [Fri, 12 Feb 2021 19:22:25 +0000 (13:22 -0600)]
midx: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agomidx-cmd: copy to bup.cmd.midx
Rob Browning [Fri, 12 Feb 2021 19:22:25 +0000 (13:22 -0600)]
midx-cmd: copy to bup.cmd.midx

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agorandom: convert to internal command
Rob Browning [Mon, 8 Feb 2021 08:30:04 +0000 (02:30 -0600)]
random: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agorandom-cmd: copy to bup.cmd.random
Rob Browning [Mon, 8 Feb 2021 08:30:04 +0000 (02:30 -0600)]
random-cmd: copy to bup.cmd.random

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agomemtest: convert to internal command
Rob Browning [Mon, 8 Feb 2021 07:28:50 +0000 (01:28 -0600)]
memtest: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agomemtest-cmd: copy to bup.cmd.memtest
Rob Browning [Mon, 8 Feb 2021 07:28:50 +0000 (01:28 -0600)]
memtest-cmd: copy to bup.cmd.memtest

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agomargin: convert to internal command
Rob Browning [Mon, 8 Feb 2021 07:17:09 +0000 (01:17 -0600)]
margin: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agomargin-cmd: copy to bup.cmd.margin
Rob Browning [Mon, 8 Feb 2021 07:17:09 +0000 (01:17 -0600)]
margin-cmd: copy to bup.cmd.margin

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agofeatures: convert to internal command
Rob Browning [Mon, 8 Feb 2021 07:07:15 +0000 (01:07 -0600)]
features: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agofeatures-cmd: copy to bup.cmd.features
Rob Browning [Mon, 8 Feb 2021 07:07:15 +0000 (01:07 -0600)]
features-cmd: copy to bup.cmd.features

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agosplit: convert to internal command
Rob Browning [Mon, 8 Feb 2021 07:00:32 +0000 (01:00 -0600)]
split: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agosplit-cmd: copy to bup.cmd.split
Rob Browning [Mon, 8 Feb 2021 07:00:32 +0000 (01:00 -0600)]
split-cmd: copy to bup.cmd.split

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoinit: convert to internal command
Rob Browning [Mon, 8 Feb 2021 04:09:54 +0000 (22:09 -0600)]
init: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoinit-cmd: copy to bup.cmd.init
Rob Browning [Mon, 8 Feb 2021 04:09:54 +0000 (22:09 -0600)]
init-cmd: copy to bup.cmd.init

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agogc: convert to internal command
Rob Browning [Mon, 8 Feb 2021 04:02:27 +0000 (22:02 -0600)]
gc: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agogc-cmd: copy to bup.cmd.gc
Rob Browning [Mon, 8 Feb 2021 04:02:27 +0000 (22:02 -0600)]
gc-cmd: copy to bup.cmd.gc

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agorm: convert to internal command
Rob Browning [Mon, 8 Feb 2021 03:50:55 +0000 (21:50 -0600)]
rm: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agorm-cmd: copy to bup.cmd.rm
Rob Browning [Mon, 8 Feb 2021 03:50:55 +0000 (21:50 -0600)]
rm-cmd: copy to bup.cmd.rm

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoindex: convert to internal command
Rob Browning [Sun, 7 Feb 2021 23:01:20 +0000 (17:01 -0600)]
index: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoindex-cmd: copy to bup.cmd.index
Rob Browning [Sun, 7 Feb 2021 23:01:20 +0000 (17:01 -0600)]
index-cmd: copy to bup.cmd.index

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agojoin: convert to internal command
Rob Browning [Fri, 12 Feb 2021 23:40:20 +0000 (17:40 -0600)]
join: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agojoin-cmd: copy to bup.cmd.join
Rob Browning [Sun, 7 Feb 2021 22:54:13 +0000 (16:54 -0600)]
join-cmd: copy to bup.cmd.join

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agohelp: convert to internal command
Rob Browning [Sun, 7 Feb 2021 22:44:44 +0000 (16:44 -0600)]
help: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agohelp-cmd: copy to bup.cmd.help
Rob Browning [Sun, 7 Feb 2021 22:44:44 +0000 (16:44 -0600)]
help-cmd: copy to bup.cmd.help

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agobloom: convert to internal command
Rob Browning [Sun, 7 Feb 2021 22:36:53 +0000 (16:36 -0600)]
bloom: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agobloom-cmd: copy to bup.cmd.bloom
Rob Browning [Sun, 7 Feb 2021 22:36:53 +0000 (16:36 -0600)]
bloom-cmd: copy to bup.cmd.bloom

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMakefile: check for bup version failures
Rob Browning [Sat, 13 Feb 2021 20:48:37 +0000 (14:48 -0600)]
Makefile: check for bup version failures

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoversion: convert to internal command
Rob Browning [Sat, 6 Feb 2021 19:45:44 +0000 (13:45 -0600)]
version: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoversion-cmd: copy to bup.cmd.version
Rob Browning [Sat, 6 Feb 2021 19:45:44 +0000 (13:45 -0600)]
version-cmd: copy to bup.cmd.version

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoxstat: convert to internal command
Rob Browning [Sat, 6 Feb 2021 19:42:39 +0000 (13:42 -0600)]
xstat: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoxstat-cmd: copy to bup.cmd.xstat
Rob Browning [Sat, 6 Feb 2021 19:42:39 +0000 (13:42 -0600)]
xstat-cmd: copy to bup.cmd.xstat

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agometa: convert to internal command
Rob Browning [Sat, 6 Feb 2021 19:07:28 +0000 (13:07 -0600)]
meta: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agometa-cmd: copy to bup.cmd.meta
Rob Browning [Sat, 6 Feb 2021 19:07:28 +0000 (13:07 -0600)]
meta-cmd: copy to bup.cmd.meta

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agols: convert to internal command
Rob Browning [Sat, 6 Feb 2021 18:52:35 +0000 (12:52 -0600)]
ls: convert to internal command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agols-cmd: copy to bup.cmd.ls
Rob Browning [Sat, 6 Feb 2021 18:52:35 +0000 (12:52 -0600)]
ls-cmd: copy to bup.cmd.ls

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agocat-file-cmd: migrate to internal bup.cmd.cat_file
Rob Browning [Sun, 13 Dec 2020 02:24:20 +0000 (20:24 -0600)]
cat-file-cmd: migrate to internal bup.cmd.cat_file

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agocat-file-cmd: copy to bup.cmd.cat_file
Rob Browning [Sat, 6 Feb 2021 18:04:24 +0000 (12:04 -0600)]
cat-file-cmd: copy to bup.cmd.cat_file

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoRemove $(dirname "$0") from sys.path
Rob Browning [Tue, 9 Feb 2021 06:13:04 +0000 (00:13 -0600)]
Remove $(dirname "$0") from sys.path

Python adds $(dirname "$0") to the sys.path, which we definitely don't
want (why would we?), so remove it early in the startup process.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agobup: include built-in subcommands in help
Rob Browning [Sun, 13 Dec 2020 17:05:52 +0000 (11:05 -0600)]
bup: include built-in subcommands in help

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agobup: filter stdout/stderr via thread/pipe for internal subcommands
Rob Browning [Sat, 12 Dec 2020 19:14:41 +0000 (13:14 -0600)]
bup: filter stdout/stderr via thread/pipe for internal subcommands

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agofilter_output: handle multiple srcs/dests as lists
Rob Browning [Fri, 11 Dec 2020 01:17:51 +0000 (19:17 -0600)]
filter_output: handle multiple srcs/dests as lists

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoconfigure-sampledata: cp lib/bup/*.py, not cmd/*.py
Rob Browning [Sat, 5 Dec 2020 08:02:12 +0000 (02:02 -0600)]
configure-sampledata: cp lib/bup/*.py, not cmd/*.py

So the tests won't depend on the location of the subcommands, in
preparation for their move to lib/bup/cmd.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMake it possible to close all catpipes
Rob Browning [Thu, 10 Dec 2020 07:56:00 +0000 (01:56 -0600)]
Make it possible to close all catpipes

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agooptions: add parse_bytes
Rob Browning [Sun, 13 Dec 2020 02:14:56 +0000 (20:14 -0600)]
options: add parse_bytes

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agogit: explicitly request that Popen close_fds
Rob Browning [Thu, 10 Dec 2020 01:42:14 +0000 (19:42 -0600)]
git: explicitly request that Popen close_fds

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoAdd --import-py-module
Rob Browning [Fri, 4 Dec 2020 23:55:00 +0000 (17:55 -0600)]
Add --import-py-module

This can be used by tests (and will be used by test-save-errors) to
override functions for error injection, etc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoAdd handle_ctrl_c to bup itself
Rob Browning [Wed, 2 Dec 2020 07:48:42 +0000 (01:48 -0600)]
Add handle_ctrl_c to bup itself

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoEnable --profile for built-in subcommands
Rob Browning [Wed, 2 Dec 2020 07:12:19 +0000 (01:12 -0600)]
Enable --profile for built-in subcommands

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agobup: don't convert bup_dir to bytes twice
Rob Browning [Sat, 6 Feb 2021 06:48:09 +0000 (00:48 -0600)]
bup: don't convert bup_dir to bytes twice

Thanks to Johannes Berg for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agobup: add support for "internal" subcommands
Rob Browning [Wed, 2 Dec 2020 01:43:13 +0000 (19:43 -0600)]
bup: add support for "internal" subcommands

Look for the existing something-cmd.py commands as both
lib/cmd/bup-something and lib/bup/cmd/something.py, and don't load the
latter as a module unless specifically allowed, so that we can create
separate rename commits as we convert each relevant external command
to an internal command.  This should make it easier to see what
actually changed in the git history, e.g. with --ignore-space-change.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoUpdate base_version for 0.32 release 0.32
Rob Browning [Sat, 9 Jan 2021 22:11:02 +0000 (16:11 -0600)]
Update base_version for 0.32 release

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoUpdate README, HACKING, and release notes for 0.32
Rob Browning [Sat, 9 Jan 2021 22:02:38 +0000 (16:02 -0600)]
Update README, HACKING, and release notes for 0.32

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoprep-for-macos-build: don't run brew update
Rob Browning [Wed, 6 Jan 2021 01:43:50 +0000 (19:43 -0600)]
prep-for-macos-build: don't run brew update

The update was causing tests to fail, and the previous attempt to
address the issue e244aa8ec2ea4b754d6242ee81dd0d3c6dace543 didn't.
Thanks to Johannes Berg proposing the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoREADME: add markdown mode indicator
Rob Browning [Wed, 6 Jan 2021 01:18:34 +0000 (19:18 -0600)]
README: add markdown mode indicator

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoindex: add newline to 'corrupt index' message
Johannes Berg [Thu, 31 Dec 2020 22:07:10 +0000 (23:07 +0100)]
index: add newline to 'corrupt index' message

This otherwise prints the traceback afterwards starting
on the same line, which looks odd.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoindex: remove pointless git.repo() invocation
Johannes Berg [Thu, 31 Dec 2020 21:29:38 +0000 (22:29 +0100)]
index: remove pointless git.repo() invocation

Since the only way we can get to clear_index() is with
indexfile having previously been assigned

    indexfile = git.repo(b'bupindex')

since opt.clear and opt.indexfile are explicitly mutually
exclusive, there's no point in calling git.repo() again,
it has no effect.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoget: remove pointless git.repo() call
Johannes Berg [Tue, 29 Dec 2020 22:28:34 +0000 (23:28 +0100)]
get: remove pointless git.repo() call

There's no point in doing "opt.source or git.repo()" since
we just pass the result to LocalRepo(), which already does
exactly the same thing.

Remove the src_dir variable entirely.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
3 years agoprune-older: fix output with --pretend
Johannes Berg [Wed, 30 Dec 2020 22:41:57 +0000 (23:41 +0100)]
prune-older: fix output with --pretend

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
3 years agobup-web: handle 4 item getsockname() result for IPv6 sockets
Christian Brabandt [Tue, 29 Dec 2020 14:19:48 +0000 (15:19 +0100)]
bup-web: handle 4 item getsockname() result for IPv6 sockets

So bup-web will create a new network socket to listen on for HTTP
connections and it may use either IPv4 or IPv6 (or both) addresses,
depending on the configuration of the system. This is done using the
tornado.netutil.bind_sockets().

Currently, bup-web does not restrict the address family to either
AF_INET/AF_INET6 and according to the documentation of
[tornado](https://www.tornadoweb.org/en/stable/netutil.html?highlight=netutil#tornado.netutil.bind_sockets)
it will use both address families and listen for connections on IPv4 and
IPv6 addresses.

> Family may be set to either socket.AF_INET or socket.AF_INET6 to
> restrict to IPv4 or IPv6 addresses, otherwise both will be used if
> available.

However, when your system has only IPv6 enabled, the print() statement
may fail with:

Traceback (most recent call last):
  File "/opt/bup/lib/bup/cmd/bup-web", line 310, in <module>
    print('Serving HTTP on %s:%d...' % sockets[0].getsockname())
TypeError: not all arguments converted during string formatting

For systems that have IPv4 as well as IPv6 enabled, it may or may not
fail, depending on whether the first returned socket by getsockname() is
for AF_INET6 or AF_INET4

The reason is, getsockname() for a AF_INET6 connections returns a tuple with
4 items: `(host, port, flowinfo, scope_id)`, while for AF_INET4
addresses, it contains only `(host, port)`.

Since we are only interested in the first 2 items, make sure to return
only the first 2 items, which are `host` and `port` for IPv4 (AF_INET)
and IPv6 (AF_INET6).

Signed-off-by: Christian Brabandt <cb@256bit.org>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit summary]

3 years agorestore: fix error message for inaccessible items
Johannes Berg [Tue, 29 Dec 2020 21:26:40 +0000 (22:26 +0100)]
restore: fix error message for inaccessible items

This actually shows up during tests, but it's hidden as it's
an error where we _expect_ bup to fail (and don't check why).
Fix the message in this case.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
3 years agoReplace atoi with explicit checks; rm unused atof
Rob Browning [Tue, 22 Dec 2020 17:17:45 +0000 (11:17 -0600)]
Replace atoi with explicit checks; rm unused atof

Replace atoi with explicit checks, making the intention a bit clearer
at each call site, and avoiding trouble we've had in the past with the
default to 0 for any unrecognized input.

This does make us stricter about the values (and the environment),
i.e. BUP_TTY_WIDTH=random-noise will now cause a crash.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agossh: don't pass through bad BUP_TTY_WIDTH
Johannes Berg [Mon, 21 Dec 2020 20:45:55 +0000 (21:45 +0100)]
ssh: don't pass through bad BUP_TTY_WIDTH

If there's no BUP_TTY_WIDTH variable already, then environ.get()
will result in None, which cannot be converted to an integer so
we get 0. Then we pass 0 to the other side in the BUP_TTY_WIDTH
environment variable.

Unfortunately, 0 is a really bad default, since textwrap cannot
work with a width of 0, causing tracebacks such as the one Mark
J Hewitt reported:
https://groups.google.com/g/bup-list/c/rfIw3STN2EY/m/C5Y3UrMIAgAJ

Fix this by not passing it through if there's no good value.

Reported-by: Mark J Hewitt <mjh@idnet.com>
Reported-by: Alexander Barton <alex@barton.de>
Fixes: cd3647c81a25 ("bup: pass TTY width through to sub-command and remote")
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoPrefer python 3, and mention intent to drop python 2 support
Rob Browning [Sun, 20 Dec 2020 01:36:09 +0000 (19:36 -0600)]
Prefer python 3, and mention intent to drop python 2 support

For now, set the minimum supported 3 version at 3.7 since I just
tested that on a debian/buster system, and update the installation
instructions after seeing what was required to run the tests from
scratch there.  Continue to search for 3.6 and 2.6 for now, since no
one's complained, and we can always lower the requirement later if it
seems appropriate.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoprep-for-macos-build: only install brew when not found
Rob Browning [Sun, 20 Dec 2020 19:15:38 +0000 (13:15 -0600)]
prep-for-macos-build: only install brew when not found

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoprep-for-macos-build: update brew install command
Rob Browning [Sun, 20 Dec 2020 19:00:25 +0000 (13:00 -0600)]
prep-for-macos-build: update brew install command

cirrus-ci builds started failing like this:

  Error:
    homebrew-core is a shallow clone.
  To `brew update`, first run:
    git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

and I noticed that the install url at https://brew.sh/ differed so try
using that one.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoREADME: update build requirements for Centos
danpawlik [Mon, 21 Sep 2020 14:33:22 +0000 (16:33 +0200)]
README: update build requirements for Centos

Some package names have changed, so building bup was problematic.

Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
[rlb@defaultvalue.org: adjust commit message]

3 years agodev: macos: install sha1sum
Johannes Berg [Tue, 18 Aug 2020 19:32:01 +0000 (21:32 +0200)]
dev: macos: install sha1sum

Install the sha1sum utility for the tests.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
3 years agotest-web: redirect stdio to make test work standalone
Johannes Berg [Tue, 4 Aug 2020 14:49:36 +0000 (16:49 +0200)]
test-web: redirect stdio to make test work standalone

Python (at least 3) behaves differently if somehow
stdio is connected to the terminal, and external
SIGTERM then doesn't cause the same behaviour as
actually pressing Ctrl-C. Redirect the output to
a file to make the test run standalone.

Print the file if any errors occur so that if there's
anything interesting in there, we can see it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agorestore: when -vv is specified, don't crash when printing paths
Jean-Paul Marmorat [Fri, 6 Nov 2020 15:07:39 +0000 (16:07 +0100)]
restore: when -vv is specified, don't crash when printing paths

Without the fix restore would crash like this:

  TypeError: can't concat str to bytes

Signed-off-by: Jean-Paul Marmorat <jean-paul.marmorat@mines-paristech.fr>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: add angle brackets around email address in
 signed-off-by; adjust commit message]
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMention homebrew installation
Gustavo Goretkin [Tue, 15 Dec 2020 23:43:06 +0000 (18:43 -0500)]
Mention homebrew installation

Signed-off-by: Gustavo Nunes Goretkin <gustavo.goretkin@gmail.com>
3 years agoREADME: reflect report that WSL works fine
Rob Browning [Wed, 16 Dec 2020 02:18:29 +0000 (20:18 -0600)]
README: reflect report that WSL works fine

Thanks to William Stein for the update.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMigrate tests to pytest
Rob Browning [Sat, 5 Dec 2020 20:59:00 +0000 (14:59 -0600)]
Migrate tests to pytest

3 years agocirrus freebsd: install pytest via pip for python 2
Rob Browning [Fri, 27 Nov 2020 18:51:51 +0000 (12:51 -0600)]
cirrus freebsd: install pytest via pip for python 2

I didn't see a port, and pkg warns that python 2 may be removed
entirely at the end of the year, so just use pip for now.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agofreebsd: fix pytest setup for python 3
Rob Browning [Thu, 26 Nov 2020 19:11:57 +0000 (13:11 -0600)]
freebsd: fix pytest setup for python 3

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoUse pytest item results to preserve tmpdirs on failure
Rob Browning [Tue, 17 Nov 2020 04:41:09 +0000 (22:41 -0600)]
Use pytest item results to preserve tmpdirs on failure

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoAdd bup map including test results to pytest items
Rob Browning [Tue, 17 Nov 2020 01:52:42 +0000 (19:52 -0600)]
Add bup map including test results to pytest items

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoRemove extensions from test command names
Rob Browning [Sun, 15 Nov 2020 19:53:42 +0000 (13:53 -0600)]
Remove extensions from test command names

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoPull some tests forward to improve parallel runtimes
Rob Browning [Fri, 13 Nov 2020 18:25:01 +0000 (12:25 -0600)]
Pull some tests forward to improve parallel runtimes

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoInstall xdist in prep-for-*-build
Johannes Berg [Fri, 29 May 2020 13:53:20 +0000 (15:53 +0200)]
Install xdist in prep-for-*-build

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[rlb@defaultvalue.org: adjust commit message after moving some code]

3 years agoAutodetect xdist and translate make -j to xdist -n
Rob Browning [Fri, 13 Nov 2020 20:27:52 +0000 (14:27 -0600)]
Autodetect xdist and translate make -j to xdist -n

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMigrate the remaining (standalone) test/ext tests to pytest
Johannes Berg [Thu, 28 May 2020 21:14:53 +0000 (23:14 +0200)]
Migrate the remaining (standalone) test/ext tests to pytest

Enable the test/ext/conftest.py collector to allow pytest to handle
all of the test/ext standalone tests too.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: show the pytest invocations; switch to use
 test/ext/conftest.py collector; use the release mark in check and
 distcheck; augment commit message; augment the information in
 HACKING]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMove ext/test.sh to ext/test-misc to match test-* pattern
Rob Browning [Sun, 15 Nov 2020 18:54:50 +0000 (12:54 -0600)]
Move ext/test.sh to ext/test-misc to match test-* pattern

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoAdd pytest collector for all test/cmd/test-* files
Rob Browning [Sun, 8 Nov 2020 18:13:55 +0000 (12:13 -0600)]
Add pytest collector for all test/cmd/test-* files

Add a collector for all the test/cmd tests that runs them as
individual subprocesses.  Add support for a pytest "release" mark and
apply it to the test-release-archive test.  Disable the collector
until the upcoming changes that rely on it are in place.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agotests: convert python-based tests to pytest
Johannes Berg [Thu, 28 May 2020 20:50:43 +0000 (22:50 +0200)]
tests: convert python-based tests to pytest

This converts the existing test scripts that are written
in python already to pytest based tests.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[rlb@defaultvalue.org: change wvtest imports to wvpytest; remove
 wvtest.py here; drop buptest.test_tempdir here]

3 years agotest-ftp: set TZ=UTC to produce consistent names
Rob Browning [Sun, 15 Nov 2020 18:09:08 +0000 (12:09 -0600)]
test-ftp: set TZ=UTC to produce consistent names

This dependency was exposed by the upcoming switch to pytest which may
run this test alongside others in the same python process.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agotest-prune-older: accommodate unified_diff break in python 3.5
Rob Browning [Sun, 15 Nov 2020 17:44:27 +0000 (11:44 -0600)]
test-prune-older: accommodate unified_diff break in python 3.5

Apparently python 3.5 changed unified_diff to crash when given bytes
arguments, and added a new diff_bytes function.  Use the latter when
the version is >= 3.5.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agotests: partially convert to pytest
Johannes Berg [Thu, 28 May 2020 20:05:45 +0000 (22:05 +0200)]
tests: partially convert to pytest

Convert all the python-based library unit tests to pytest,
and add a pytest.ini to only look in the test/ directory.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[rlb@defaultvalue.org: run pytest outside wvtest check wrapper so the
 output is visible; restore some of buptest.py and wvtest.py so the
 other tests can still run; rename pytest shim to wvpytest to
 distinguish from ./wvtest.py.; add ./pytest to centralize common
 options; switch .wvtest import to wvtest now that lib/test is a proper
 module dir; narrow pytest.ini test dirs to test/int and test/ext; move
 sort-z to test/bin; fix some dependencies in dev/prep-for-*]

3 years agoEnsure pytests preserve the cd $(pwd -P) behavior
Rob Browning [Sun, 15 Nov 2020 18:21:28 +0000 (12:21 -0600)]
Ensure pytests preserve the cd $(pwd -P) behavior

Previously handled in the Makefile.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoAdd pytest context manager to save/restore test environment
Rob Browning [Sun, 1 Nov 2020 20:03:41 +0000 (14:03 -0600)]
Add pytest context manager to save/restore test environment

Without this, test_git.py could fail because test_ftp had left its
GIT_DIR lying around, and other tests could fail because it changed
and didn't restore the working directory.  Make sure to call tzset()
after any TZ changes.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agoMove t*.py tests to test_*.py for pytest autodetection
Rob Browning [Sun, 1 Nov 2020 16:39:17 +0000 (10:39 -0600)]
Move t*.py tests to test_*.py for pytest autodetection

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agowvtest.py: respect BUP_TEST_SEED
Rob Browning [Sat, 14 Nov 2020 17:28:50 +0000 (11:28 -0600)]
wvtest.py: respect BUP_TEST_SEED

Without this, the test counts can vary given (for example) the
tests in validate_vfs_{streaming,seeking}* in tvfs.py.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agotests: move all tests to test/
Johannes Berg [Wed, 27 May 2020 17:58:38 +0000 (19:58 +0200)]
tests: move all tests to test/

Instead of having some testing code interleaved with bup's
real code in lib/bup/test/ and lib/bup/t/ move everything
related to testing into test/, which is also renamed from
just t/.

This aligns with pytest for future changes, and, almost more
importantly, cleans up the lib/ directory to only have the
operational code.

The latter is necessary to properly 'libify' bup in order to
be able to use tox properly to test with different versions
of python in venv later.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: also move utilities like compare-trees to dev/;
 make test/lib a test-specific module tree and have wvtest.py include
 it; use test/ext/ and test/int/ (external and internal) as the test
 dir names.]

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
3 years agocirrus: allow failures on macos with python 2
Rob Browning [Wed, 25 Nov 2020 20:37:01 +0000 (14:37 -0600)]
cirrus: allow failures on macos with python 2

It looks like macos has changed something that makes it very difficult
to detect and use the *utime* related functions.  Apparently Emacs
just decided to live without it, and Python had to go to substantial
lengths to sort it out.  So until/unless we have a reasonable fix,
just mark that combination as expected to fail.

Python 3 should work fine since we rely on it to sort out the problem
for us.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agosystem-info: include uname -a output
Rob Browning [Wed, 25 Nov 2020 20:35:12 +0000 (14:35 -0600)]
system-info: include uname -a output

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agocirrus: make macos image match reality (catalina)
Rob Browning [Wed, 25 Nov 2020 20:33:57 +0000 (14:33 -0600)]
cirrus: make macos image match reality (catalina)

Apparently it's actually choosing catalina anyway (see the labels
during the runs), and that appears to be all that's supported now at
https://cirrus-ci.org/guide/macOS/

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
3 years agoDepend on python 3 for utime when using 3
Rob Browning [Tue, 24 Nov 2020 00:21:00 +0000 (18:21 -0600)]
Depend on python 3 for utime when using 3

Since python 3.3+ now claims to implement what we need (follow
symlinks, ns resolution), rely on it for utime when possible in
preference to our own C code in _helpers.

This should fix new failures on macos due to changes to the
availability of utimensat, etc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>