From 133e5c531e15f6a6662ece13cfabe24b1860670d Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 19 Jul 2020 14:28:36 -0500 Subject: [PATCH] Add bup-features to report status; drop ACL warnings Add a new "bup features" command that reports information about the status and capabilities of the current installation. Given that, and the new summary at the end of the ./configure output, drop the platform specific warnings, which were a bit odd anyway, since they wouldn't warn you on say Linux if we found libacl, but it didn't actually have all the features we required. Signed-off-by: Rob Browning Tested-by: Rob Browning --- Documentation/bup-features.md | 34 +++++++++++++++++++++++++ lib/bup/metadata.py | 4 --- lib/cmd/features-cmd.py | 48 +++++++++++++++++++++++++++++++++++ note/0.31 | 4 +++ 4 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 Documentation/bup-features.md create mode 100755 lib/cmd/features-cmd.py diff --git a/Documentation/bup-features.md b/Documentation/bup-features.md new file mode 100644 index 0000000..959905e --- /dev/null +++ b/Documentation/bup-features.md @@ -0,0 +1,34 @@ +% bup-features(1) Bup %BUP_VERSION% +% Rob Browning +% %BUP_DATE% + +# NAME + +bup-features - report the current status and capabilities of bup itself + +# SYNOPSIS + +bup features + +# DESCRIPTION + +`bup features` reports information about the current bup installation, +for example, whether command line editing is supported by `bup ftp`, +or POSIX ACLs can be saved and restored. + +# EXAMPLES + + $ bup features + bup 0.31~a7ff2d5b8c12b24b97858aad1251d28c18f8c1e1 + source a7ff2d5b8c12b24b97858aad1251d28c18f8c1e1 2020-07-05 14:54:06 -0500 + Command line editing (e.g. bup ftp): yes + Saving and restoring POSIX ACLs: yes + .... + +# SEE ALSO + +`bup-version`(1) + +# BUP + +Part of the `bup`(1) suite. diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index eeec559..0a7514d 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -43,10 +43,6 @@ if sys.platform.startswith('linux'): try: from bup._helpers import read_acl, apply_acl except ImportError: - if not (sys.platform.startswith('cygwin') or - sys.platform.startswith('darwin') or - sys.platform.startswith('netbsd')): - log('Warning: POSIX ACL support missing; recompile with libacl1-dev/libacl-devel.\n') read_acl = apply_acl = None try: diff --git a/lib/cmd/features-cmd.py b/lib/cmd/features-cmd.py new file mode 100755 index 0000000..c049535 --- /dev/null +++ b/lib/cmd/features-cmd.py @@ -0,0 +1,48 @@ +#!/bin/sh +"""": # -*-python-*- +# https://sourceware.org/bugzilla/show_bug.cgi?id=26034 +export "BUP_ARGV_0"="$0" +arg_i=1 +for arg in "$@"; do + export "BUP_ARGV_${arg_i}"="$arg" + shift + arg_i=$((arg_i + 1)) +done +# Here to end of preamble replaced during install +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? +exec "$bup_python" "$0" +""" +# end of bup preamble + +from __future__ import absolute_import, print_function +import os.path, sys + +sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..'] + +from bup import _helpers, compat, metadata, options, version +from bup.io import byte_stream + +out = None + +def show_support(out, bool_opt, what): + out.write(b' %s: %s\n' % (what, b'yes' if bool_opt else b'no')) + +optspec = """ +bup features +""" +o = options.Options(optspec) +opt, flags, extra = o.parse(compat.argv[1:]) + +sys.stdout.flush() +out = byte_stream(sys.stdout) + +out.write(b'bup %s\n' % version.version) +out.write(b'Source %s %s\n' % (version.commit, version.date)) + +have_readline = getattr(_helpers, 'readline', None) +have_libacl = getattr(_helpers, 'read_acl', None) +have_xattr = metadata.xattr + +show_support(out, have_readline, b'Command line editing (e.g. bup ftp)') +show_support(out, have_libacl, b'Saving and restoring POSIX ACLs') +show_support(out, have_xattr, b'Saving and restoring extended attributes (xattrs)') diff --git a/note/0.31 b/note/0.31 index debd3f0..db6e460 100644 --- a/note/0.31 +++ b/note/0.31 @@ -4,6 +4,10 @@ Notable changes in 0.31 ======================= +* `bup features` has been added. It reports information about bup + itself, including the current availability of features like readline + and support for POSIX ACLs. + May require attention --------------------- -- 2.39.2