Newer versions of python-xattr have pyxattr compatibility code
(since my pull request https://github.com/xattr/xattr/pull/38).
Modify bup to allow using it; prefer pyxattr since it's faster,
but sometimes due to other dependencies python-xattr might be
present already (and since it conflicts with pyxattr, it's not
possible to install both.)
Also add a .cirrus.yml task to test this on Debian.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
chown -R bup:bup .
su -l bup -c "eatmydata make -j3 -C '$(pwd)' check"
+task:
+ name: debian (xattr)
+ container:
+ image: debian:buster
+ cpu: 2
+ memory: 8
+ script: |
+ set -xe
+ dev/prep-for-debianish-build python2 xattr
+ dev/system-info
+ adduser --disabled-password --gecos '' bup
+ chown -R bup:bup .
+ su -l bup -c "eatmydata make -j3 -C '$(pwd)' check"
+
task:
name: freebsd
freebsd_instance:
usage()
{
- echo "Usage: prep-for-debianish-build [python2|python3]"
+ echo "Usage: prep-for-debianish-build [python2|python3] [pyxattr|xattr]"
}
export DEBIAN_FRONTEND=noninteractive
common_debs="$common_debs duplicity rdiff-backup rsnapshot"
pyver="${1:-python2}"
+xattr="${2:-pyxattr}"
case "$pyver" in
python2)
apt-get install -y \
$common_debs \
python2.7-dev python-fuse \
- python-pyxattr python-pylibacl python-tornado
+ python-"$xattr" python-pylibacl python-tornado
;;
python3)
apt-get install -y \
$common_debs \
python3.7-dev python3-distutils python3-fuse \
- python3-pyxattr python3-pylibacl python3-tornado
+ python3-"$xattr" python3-pylibacl python3-tornado
;;
*)
usage 1>&2
xattr = None
if sys.platform.startswith('linux'):
+ # prefer python-pyxattr (it's a lot faster), but fall back to python-xattr
+ # as the two are incompatible and only one can be installed on a system
try:
import xattr
except ImportError:
log('Warning: Linux xattr support missing; install python-pyxattr.\n')
- if xattr:
+ if xattr and getattr(xattr, 'get_all', None) is None:
try:
- xattr.get_all
- except AttributeError:
+ from xattr import pyxattr_compat as xattr
+ except ImportError:
log('Warning: python-xattr module is too old; '
- 'install python-pyxattr instead.\n')
+ 'upgrade or install python-pyxattr instead.\n')
xattr = None
posix1e = None