From 73f4b83af6c73a0ba48e448883856bf24aacbf7d Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Fri, 29 May 2020 21:50:25 -0500 Subject: [PATCH] Split src tree python use to config/bin/python and dev/bup-python Replace cmd/bup-python with config/bin/python, which is just a symlink to the configured python, and dev/bup-python, which is what "bup python" used to be. Adjust all the code to use config/bin/python when we can (i.e. when we don't need bup modules), and dev/bup-python otherwise. Drop "bup python", since we don't need it anymore. Signed-off-by: Rob Browning --- Makefile | 25 +++++++++++++------------ bup | 7 +------ config/configure | 5 +++++ dev/bup-python | 10 ++++++++++ lib/cmd/bloom-cmd.py | 2 +- lib/cmd/bup | 2 +- lib/cmd/cat-file-cmd.py | 2 +- lib/cmd/daemon-cmd.py | 2 +- lib/cmd/damage-cmd.py | 2 +- lib/cmd/drecurse-cmd.py | 2 +- lib/cmd/fsck-cmd.py | 2 +- lib/cmd/ftp-cmd.py | 2 +- lib/cmd/fuse-cmd.py | 2 +- lib/cmd/gc-cmd.py | 2 +- lib/cmd/get-cmd.py | 2 +- lib/cmd/help-cmd.py | 2 +- lib/cmd/import-duplicity-cmd.py | 2 +- lib/cmd/index-cmd.py | 2 +- lib/cmd/init-cmd.py | 2 +- lib/cmd/join-cmd.py | 2 +- lib/cmd/list-idx-cmd.py | 2 +- lib/cmd/ls-cmd.py | 2 +- lib/cmd/margin-cmd.py | 2 +- lib/cmd/memtest-cmd.py | 2 +- lib/cmd/meta-cmd.py | 2 +- lib/cmd/midx-cmd.py | 2 +- lib/cmd/mux-cmd.py | 2 +- lib/cmd/on--server-cmd.py | 2 +- lib/cmd/on-cmd.py | 2 +- lib/cmd/prune-older-cmd.py | 2 +- lib/cmd/random-cmd.py | 2 +- lib/cmd/restore-cmd.py | 2 +- lib/cmd/rm-cmd.py | 2 +- lib/cmd/save-cmd.py | 2 +- lib/cmd/server-cmd.py | 2 +- lib/cmd/split-cmd.py | 2 +- lib/cmd/tag-cmd.py | 2 +- lib/cmd/tick-cmd.py | 2 +- lib/cmd/version-cmd.py | 2 +- lib/cmd/web-cmd.py | 2 +- lib/cmd/xstat-cmd.py | 2 +- t/cleanup-mounts-under | 2 +- t/data-size | 2 +- t/echo-argv-bytes | 2 +- t/hardlink-sets | 2 +- t/id-other-than | 2 +- t/lib.sh | 6 ++---- t/make-random-paths | 2 +- t/mksock | 2 +- t/ns-timestamp-resolutions | 2 +- t/root-status | 2 +- t/sparse-test-data | 2 +- t/subtree-hash | 2 +- t/test-argv | 2 +- t/test-ftp | 2 +- t/test-fuse.sh | 4 ++-- t/test-get | 2 +- t/test-ls | 8 ++++---- t/test-meta.sh | 13 +++++++------ t/test-prune-older | 2 +- t/test-restore-map-owner.sh | 2 +- t/test-save-errors | 18 ++++++------------ t/test-sparse-files.sh | 4 ++-- t/test-web.sh | 2 +- t/unknown-owner | 2 +- wvtest.py | 2 +- 66 files changed, 108 insertions(+), 104 deletions(-) mode change 100755 => 120000 bup create mode 100755 dev/bup-python diff --git a/Makefile b/Makefile index 86c973c..4ca1a03 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,10 @@ SHELL := bash .DEFAULT_GOAL := all # See config/config.vars.in (sets bup_python, among other things) -include config/config.vars +-include config/config.vars pf := set -o pipefail +cfg_py := $(CURDIR)/config/bin/python define isok && echo " ok" || echo " no" @@ -42,7 +43,8 @@ endif initial_setup := $(shell ./configure-version --update $(isok)) initial_setup := $(call shout,$(initial_setup),Version configuration failed)) -config/config.vars: configure config/configure config/configure.inc \ +config/config.vars: \ + configure config/configure config/configure.inc \ $(wildcard config/*.in) MAKE="$(MAKE)" ./configure @@ -61,7 +63,9 @@ readline_cflags += $(addprefix -DBUP_RL_EXPECTED_XOPEN_SOURCE=,$(readline_xopen) CFLAGS += $(readline_cflags) LDFLAGS += $(shell pkg-config readline --libs) -bup_cmds := cmd/bup-python \ +config/bin/python: config/config.vars + +bup_cmds := \ $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \ $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh)) @@ -106,7 +110,7 @@ install: all test -z "$(man_html)" || $(INSTALL) -m 0644 $(man_html) $(dest_docdir) dev/install-python-script lib/cmd/bup "$(dest_libdir)/cmd/bup" set -e; \ - for cmd in $$(ls cmd/bup-* | grep -v cmd/bup-python); do \ + for cmd in $$(ls cmd/bup-*); do \ dev/install-python-script "$$cmd" "$(dest_libdir)/$$cmd"; \ done cd "$(dest_bindir)" && \ @@ -131,9 +135,9 @@ lib/bup/_helpers$(SOEXT): \ config/config.h lib/bup/bupsplit.h \ lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py @rm -f $@ - cd lib/bup && $(bup_python) csetup.py build "$(CFLAGS)" "$(LDFLAGS)" + cd lib/bup && $(cfg_py) csetup.py build "$(CFLAGS)" "$(LDFLAGS)" # Make sure there's just the one file we expect before we copy it. - "$(bup_python)" -c \ + $(cfg_py) -c \ "import glob; assert(len(glob.glob('lib/bup/build/*/_helpers*$(SOEXT)')) == 1)" cp lib/bup/build/*/_helpers*$(SOEXT) "$@" @@ -253,9 +257,6 @@ check: test distcheck: all ./wvtest run t/test-release-archive.sh -cmd/bup-python: config/config.var/bup-python - cd cmd && ln -sf "$$(< $(CURDIR)/config/config.var/bup-python)" bup-python - long-test: export BUP_TEST_LEVEL=11 long-test: test @@ -311,10 +312,10 @@ import-docs: Documentation/clean $(pf); git archive origin/html | (cd Documentation && tar -xvf -) $(pf); git archive origin/man | (cd Documentation && tar -xvf -) -clean: Documentation/clean cmd/bup-python +clean: Documentation/clean config/bin/python + cd config && rm -rf config.var cd config && rm -f *~ .*~ \ ${CONFIGURE_DETRITUS} ${CONFIGURE_FILES} ${GENERATED_FILES} - cd config && rm -rf config.var rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \ .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \ *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \ @@ -334,4 +335,4 @@ clean: Documentation/clean cmd/bup-python ./configure-version --clean t/configure-sampledata --clean # Remove last so that cleanup tools can depend on it - rm -f cmd/bup-python + rm -rf config/bin diff --git a/bup b/bup deleted file mode 100755 index 0d15289..0000000 --- a/bup +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# This is just a convenience wrapper. It's not a symlink because bup -# finds its code relative to dirname(__file__). - -exec $(dirname "$0")/cmd/bup "$@" diff --git a/bup b/bup new file mode 120000 index 0000000..e1c0ca8 --- /dev/null +++ b/bup @@ -0,0 +1 @@ +lib/cmd/bup \ No newline at end of file diff --git a/config/configure b/config/configure index 3eab5d3..6dacf8b 100755 --- a/config/configure +++ b/config/configure @@ -186,6 +186,11 @@ AC_CHECK_FIELD tm tm_gmtoff time.h AC_OUTPUT config.vars +if test -e config.var; then rm -r config.var; fi mkdir -p config.var echo -n "$MAKE" > config.var/bup-make echo -n "$bup_python" > config.var/bup-python + +if test -e bin; then rm -r bin; fi +mkdir -p bin +cd bin && ln -s "$bup_python" python diff --git a/dev/bup-python b/dev/bup-python new file mode 100755 index 0000000..384a8fd --- /dev/null +++ b/dev/bup-python @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +script_home="$(cd "$(dirname "$0")" && pwd -P)" +python="$script_home/../config/bin/python" +libdir="$script_home/../lib" + +export PYTHONPATH="$libdir${PYTHONPATH:+:$PYTHONPATH}" +exec "$python" "$@" diff --git a/lib/cmd/bloom-cmd.py b/lib/cmd/bloom-cmd.py index fdf8145..850382e 100755 --- a/lib/cmd/bloom-cmd.py +++ b/lib/cmd/bloom-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/bup b/lib/cmd/bup index 5c45041..a23b595 100755 --- a/lib/cmd/bup +++ b/lib/cmd/bup @@ -21,7 +21,7 @@ while test -L "$cmdpath"; do done script_home="$(cd "$(dirname "$cmdpath")" && pwd -P)" cd "$top" -exec "$script_home/bup-python" "$0" +exec "$script_home/../../config/bin/python" "$0" """ # end of bup preamble diff --git a/lib/cmd/cat-file-cmd.py b/lib/cmd/cat-file-cmd.py index 7fbc256..388ca03 100755 --- a/lib/cmd/cat-file-cmd.py +++ b/lib/cmd/cat-file-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/daemon-cmd.py b/lib/cmd/daemon-cmd.py index 5506ea1..ffe79dd 100755 --- a/lib/cmd/daemon-cmd.py +++ b/lib/cmd/daemon-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/damage-cmd.py b/lib/cmd/damage-cmd.py index c7c712a..85995ed 100755 --- a/lib/cmd/damage-cmd.py +++ b/lib/cmd/damage-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/drecurse-cmd.py b/lib/cmd/drecurse-cmd.py index 6cb0fc4..1c67918 100755 --- a/lib/cmd/drecurse-cmd.py +++ b/lib/cmd/drecurse-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/fsck-cmd.py b/lib/cmd/fsck-cmd.py index e5eea32..0a1bdb0 100755 --- a/lib/cmd/fsck-cmd.py +++ b/lib/cmd/fsck-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/ftp-cmd.py b/lib/cmd/ftp-cmd.py index 1aada9a..732082a 100755 --- a/lib/cmd/ftp-cmd.py +++ b/lib/cmd/ftp-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/fuse-cmd.py b/lib/cmd/fuse-cmd.py index bb6d98d..1b8bd9c 100755 --- a/lib/cmd/fuse-cmd.py +++ b/lib/cmd/fuse-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/gc-cmd.py b/lib/cmd/gc-cmd.py index 7368eca..71e4e75 100755 --- a/lib/cmd/gc-cmd.py +++ b/lib/cmd/gc-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/get-cmd.py b/lib/cmd/get-cmd.py index c319824..4880cbf 100755 --- a/lib/cmd/get-cmd.py +++ b/lib/cmd/get-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/help-cmd.py b/lib/cmd/help-cmd.py index aeacc70..0561742 100755 --- a/lib/cmd/help-cmd.py +++ b/lib/cmd/help-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/import-duplicity-cmd.py b/lib/cmd/import-duplicity-cmd.py index 77b53eb..348be8c 100755 --- a/lib/cmd/import-duplicity-cmd.py +++ b/lib/cmd/import-duplicity-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/index-cmd.py b/lib/cmd/index-cmd.py index a47e208..a479ca9 100755 --- a/lib/cmd/index-cmd.py +++ b/lib/cmd/index-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/init-cmd.py b/lib/cmd/init-cmd.py index 13bff7d..b0b0399 100755 --- a/lib/cmd/init-cmd.py +++ b/lib/cmd/init-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/join-cmd.py b/lib/cmd/join-cmd.py index 55d9eed..0cf6ef8 100755 --- a/lib/cmd/join-cmd.py +++ b/lib/cmd/join-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/list-idx-cmd.py b/lib/cmd/list-idx-cmd.py index ebafdfa..e7e7600 100755 --- a/lib/cmd/list-idx-cmd.py +++ b/lib/cmd/list-idx-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/ls-cmd.py b/lib/cmd/ls-cmd.py index 6cc047b..f034c09 100755 --- a/lib/cmd/ls-cmd.py +++ b/lib/cmd/ls-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/margin-cmd.py b/lib/cmd/margin-cmd.py index 825102b..09411bc 100755 --- a/lib/cmd/margin-cmd.py +++ b/lib/cmd/margin-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/memtest-cmd.py b/lib/cmd/memtest-cmd.py index 6f4dfd0..c5d8677 100755 --- a/lib/cmd/memtest-cmd.py +++ b/lib/cmd/memtest-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/meta-cmd.py b/lib/cmd/meta-cmd.py index 15eed43..e9a3d61 100755 --- a/lib/cmd/meta-cmd.py +++ b/lib/cmd/meta-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/midx-cmd.py b/lib/cmd/midx-cmd.py index b5ed7c4..35e2bc2 100755 --- a/lib/cmd/midx-cmd.py +++ b/lib/cmd/midx-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/mux-cmd.py b/lib/cmd/mux-cmd.py index 1050262..a3b4d57 100755 --- a/lib/cmd/mux-cmd.py +++ b/lib/cmd/mux-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/on--server-cmd.py b/lib/cmd/on--server-cmd.py index 12fee08..0c151b0 100755 --- a/lib/cmd/on--server-cmd.py +++ b/lib/cmd/on--server-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/on-cmd.py b/lib/cmd/on-cmd.py index 0644a46..9eaabef 100755 --- a/lib/cmd/on-cmd.py +++ b/lib/cmd/on-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/prune-older-cmd.py b/lib/cmd/prune-older-cmd.py index 07bf7da..c25bb81 100755 --- a/lib/cmd/prune-older-cmd.py +++ b/lib/cmd/prune-older-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/random-cmd.py b/lib/cmd/random-cmd.py index 086dfff..1dd1ff3 100755 --- a/lib/cmd/random-cmd.py +++ b/lib/cmd/random-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/restore-cmd.py b/lib/cmd/restore-cmd.py index 43071d1..7c8ca26 100755 --- a/lib/cmd/restore-cmd.py +++ b/lib/cmd/restore-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/rm-cmd.py b/lib/cmd/rm-cmd.py index 4016c00..1af1e59 100755 --- a/lib/cmd/rm-cmd.py +++ b/lib/cmd/rm-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/save-cmd.py b/lib/cmd/save-cmd.py index c67e1ed..5cdedf6 100755 --- a/lib/cmd/save-cmd.py +++ b/lib/cmd/save-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/server-cmd.py b/lib/cmd/server-cmd.py index a818445..ada92d2 100755 --- a/lib/cmd/server-cmd.py +++ b/lib/cmd/server-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/split-cmd.py b/lib/cmd/split-cmd.py index 6735d70..3105eb8 100755 --- a/lib/cmd/split-cmd.py +++ b/lib/cmd/split-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/tag-cmd.py b/lib/cmd/tag-cmd.py index c2b6fae..0d52677 100755 --- a/lib/cmd/tag-cmd.py +++ b/lib/cmd/tag-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/tick-cmd.py b/lib/cmd/tick-cmd.py index dcafc81..697057e 100755 --- a/lib/cmd/tick-cmd.py +++ b/lib/cmd/tick-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/version-cmd.py b/lib/cmd/version-cmd.py index 7dcd279..f158c91 100755 --- a/lib/cmd/version-cmd.py +++ b/lib/cmd/version-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/web-cmd.py b/lib/cmd/web-cmd.py index 7b8b7b6..d765463 100755 --- a/lib/cmd/web-cmd.py +++ b/lib/cmd/web-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/lib/cmd/xstat-cmd.py b/lib/cmd/xstat-cmd.py index 8a56ba5..9935b07 100755 --- a/lib/cmd/xstat-cmd.py +++ b/lib/cmd/xstat-cmd.py @@ -9,7 +9,7 @@ for arg in "$@"; do arg_i=$((arg_i + 1)) done # Here to end of preamble replaced during install -bup_python="$(dirname "$0")/bup-python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/cleanup-mounts-under b/t/cleanup-mounts-under index b43d960..c0c2671 100755 --- a/t/cleanup-mounts-under +++ b/t/cleanup-mounts-under @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ diff --git a/t/data-size b/t/data-size index ce94f78..e5068da 100755 --- a/t/data-size +++ b/t/data-size @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/echo-argv-bytes b/t/echo-argv-bytes index 127f85d..5347b5a 100755 --- a/t/echo-argv-bytes +++ b/t/echo-argv-bytes @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../lib/cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/hardlink-sets b/t/hardlink-sets index 0e6458a..2d17e37 100755 --- a/t/hardlink-sets +++ b/t/hardlink-sets @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../lib/cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/id-other-than b/t/id-other-than index 9c240fa..e54696a 100755 --- a/t/id-other-than +++ b/t/id-other-than @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/lib.sh b/t/lib.sh index 4d67341..3ea7226 100644 --- a/t/lib.sh +++ b/t/lib.sh @@ -2,10 +2,8 @@ bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd) || exit $? -bup-python() -{ - "$bup_t_lib_script_home/../cmd/bup-python" "$@" -} +bup-cfg-py() { "$bup_t_lib_script_home/../config/bin/python" "$@"; } +bup-python() { "$bup_t_lib_script_home/../dev/bup-python" "$@"; } force-delete() { diff --git a/t/make-random-paths b/t/make-random-paths index d500fb4..af80643 100755 --- a/t/make-random-paths +++ b/t/make-random-paths @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/mksock b/t/mksock index 3a580db..88372c3 100755 --- a/t/mksock +++ b/t/mksock @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/ns-timestamp-resolutions b/t/ns-timestamp-resolutions index b9970f8..d138749 100755 --- a/t/ns-timestamp-resolutions +++ b/t/ns-timestamp-resolutions @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../lib/cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/root-status b/t/root-status index 7127f8c..c37806d 100755 --- a/t/root-status +++ b/t/root-status @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/sparse-test-data b/t/sparse-test-data index d777f3c..096d042 100755 --- a/t/sparse-test-data +++ b/t/sparse-test-data @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ diff --git a/t/subtree-hash b/t/subtree-hash index bcc21bb..1077393 100755 --- a/t/subtree-hash +++ b/t/subtree-hash @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/test-argv b/t/test-argv index 6d83b76..818619f 100755 --- a/t/test-argv +++ b/t/test-argv @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/test-ftp b/t/test-ftp index 6aed724..a438241 100755 --- a/t/test-ftp +++ b/t/test-ftp @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/test-fuse.sh b/t/test-fuse.sh index 1ed3554..d219d55 100755 --- a/t/test-fuse.sh +++ b/t/test-fuse.sh @@ -40,7 +40,7 @@ bup() { "$top/bup" "$@"; } savename() { readonly secs="$1" - WVPASS bup-python -c "from time import strftime, localtime; \ + WVPASS bup-cfg-py -c "from time import strftime, localtime; \ print(strftime('%Y-%m-%d-%H%M%S', localtime($secs)))" } @@ -49,7 +49,7 @@ export TZ=UTC WVPASS bup init WVPASS cd "$tmpdir" -savestamp1=$(WVPASS bup-python -c 'import time; print(int(time.time()))') || exit $? +savestamp1=$(WVPASS bup-cfg-py -c 'import time; print(int(time.time()))') || exit $? savestamp2=$(($savestamp1 + 1)) savename1="$(savename "$savestamp1")" || exit $? diff --git a/t/test-get b/t/test-get index 4c28fe5..0c849ab 100755 --- a/t/test-get +++ b/t/test-get @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../lib/cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/test-ls b/t/test-ls index 2912476..23e15d7 100755 --- a/t/test-ls +++ b/t/test-ls @@ -51,9 +51,9 @@ WVPASS bup save -n src -d 242312160 --strip src WVPASS bup tag some-tag src uid="$(WVPASS id -u)" || exit $? -gid="$(WVPASS bup-python -c 'import os; print(os.stat("src").st_gid)')" || exit $? +gid="$(WVPASS bup-cfg-py -c 'import os; print(os.stat("src").st_gid)')" || exit $? user="$(WVPASS id -un)" || exit $? -group="$(WVPASS bup-python -c 'import grp, os; +group="$(WVPASS bup-cfg-py -c 'import grp, os; print(grp.getgrgid(os.stat("src").st_gid)[0])')" || exit $? src_commit_hash=$(git log --format=%H -n1 src) src_tree_hash=$(git log --format=%T -n1 src) @@ -169,7 +169,7 @@ bad_symlink_date="$(WVPASS echo "$bad_symlink_bup_info" \ test "$bad_symlink_date" || exit 1 if test "$(uname -s)" != NetBSD; then - bad_symlink_size="$(WVPASS bup-python -c "import os + bad_symlink_size="$(WVPASS bup-cfg-py -c "import os print(os.lstat('src/bad-symlink').st_size)")" || exit $? else # NetBSD appears to return varying sizes, so for now, just ignore it. @@ -190,7 +190,7 @@ symlink_date="$(WVPASS echo "$symlink_bup_info" \ test "$symlink_date" || exit 1 if test "$(uname -s)" != NetBSD; then - symlink_size="$(WVPASS bup-python -c "import os + symlink_size="$(WVPASS bup-cfg-py -c "import os print(os.lstat('src/symlink').st_size)")" || exit $? else # NetBSD appears to return varying sizes, so for now, just ignore it. diff --git a/t/test-meta.sh b/t/test-meta.sh index eb1f97b..3af9346 100755 --- a/t/test-meta.sh +++ b/t/test-meta.sh @@ -43,7 +43,8 @@ id-other-than() genstat() { ( - export PATH="$TOP:$PATH" # pick up bup + export PATH="$TOP/bin:$PATH" # pick up bup + bup version # Skip atime (test elsewhere) to avoid the observer effect. WVPASS find . -print0 | WVPASS sort -z \ | WVPASS xargs -0 bup xstat \ @@ -439,9 +440,9 @@ src/foo/3" tmpdir="$(WVPASS wvmktempdir)" || exit $? # FIXME: binary groups - first_group="$(WVPASS bup-python -c 'import os,grp; \ + first_group="$(WVPASS bup-cfg-py -c 'import os,grp; \ print(grp.getgrgid(os.getgroups()[0])[0])')" || exit $? - last_group="$(bup-python -c 'import os,grp; \ + last_group="$(bup-cfg-py -c 'import os,grp; \ print(grp.getgrgid(os.getgroups()[-1])[0])')" || exit $? last_group_erx="$(escape-erx "$last_group")" @@ -719,7 +720,7 @@ if [ "$root_status" = root ]; then WVPASS cd "$testfs_limited"/src-restore WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \ | WVPASS grep -e '^Linux chattr:' \ - | WVPASS bup-python -c \ + | WVPASS bup-cfg-py -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 3)' ) || exit $? ) || exit $? @@ -743,7 +744,7 @@ if [ "$root_status" = root ]; then WVFAIL bup meta --extract --file "$testfs"/src.meta WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \ | WVPASS grep -e "^xattr\.set u\?'" \ - | WVPASS bup-python -c \ + | WVPASS bup-cfg-py -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 2)' ) || exit $? @@ -765,7 +766,7 @@ if [ "$root_status" = root ]; then WVPASS cd "$testfs_limited"/src-restore WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \ | WVPASS grep -e '^POSIX1e ACL applyto:' \ - | WVPASS bup-python -c \ + | WVPASS bup-cfg-py -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 2)' ) || exit $? diff --git a/t/test-prune-older b/t/test-prune-older index 5b07993..068ba6f 100755 --- a/t/test-prune-older +++ b/t/test-prune-older @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../cmd/bup-python" || exit $? +bup_python="$(dirname "$0")/../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble diff --git a/t/test-restore-map-owner.sh b/t/test-restore-map-owner.sh index 84f3b08..4e67610 100755 --- a/t/test-restore-map-owner.sh +++ b/t/test-restore-map-owner.sh @@ -82,7 +82,7 @@ WVPASS grep -qE "^uid: $other_uid\$" foo-xstat WVPASS grep -qE "^group: $other_group\$" foo-xstat WVPASS grep -qE "^gid: $other_gid\$" foo-xstat -has_uid_gid_0=$(WVPASS bup-python -c " +has_uid_gid_0=$(WVPASS bup-cfg-py -c " import grp, pwd try: pwd.getpwuid(0) diff --git a/t/test-save-errors b/t/test-save-errors index 312a9f5..14fd47f 100755 --- a/t/test-save-errors +++ b/t/test-save-errors @@ -33,9 +33,7 @@ WVPASS bup index "$tmpdir/save" # essentially, we create a bup-save command for ourselves # that gets an error for the .../5 file in metadata.from_path() cat > "$tmpdir/bup-save" << EOF -#!/usr/bin/env $top/cmd/bup-python -import os.path, sys -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../../../lib'] +#!/usr/bin/env $top/dev/bup-python from bup import metadata orig_from_path = metadata.from_path @@ -45,7 +43,7 @@ def from_path(path, *args, **kw): return orig_from_path(path, *args, **kw) metadata.from_path = from_path -exec(open("$top/cmd/bup-save", "rb").read()) +exec(open("$top/lib/cmd/bup-save", "rb").read()) EOF chmod +x "$tmpdir/bup-save" @@ -72,9 +70,7 @@ WVPASS bup index --clear WVPASS bup index "$tmpdir/save" cat > "$tmpdir/bup-save" << EOF -#!/usr/bin/env $top/cmd/bup-python -import os.path, sys -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../../../lib'] +#!/usr/bin/env $top/dev/bup-python from bup import metadata orig_from_path = metadata.from_path @@ -84,7 +80,7 @@ def from_path(path, *args, **kw): return orig_from_path(path, *args, **kw) metadata.from_path = from_path -exec(open("$top/cmd/bup-save", "rb").read()) +exec(open("$top/lib/cmd/bup-save", "rb").read()) EOF chmod +x "$tmpdir/bup-save" @@ -107,9 +103,7 @@ WVPASS bup index --clear WVPASS bup index "$tmpdir/save" cat > "$tmpdir/bup-save" << EOF -#!/usr/bin/env $top/cmd/bup-python -import os.path, sys -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../../../lib'] +#!/usr/bin/env $top/dev/bup-python from bup import index Reader = index.Reader @@ -122,7 +116,7 @@ class DupReader(index.Reader): yield transname, ent index.Reader = DupReader -exec(open("$top/cmd/bup-save", "rb").read()) +exec(open("$top/lib/cmd/bup-save", "rb").read()) EOF chmod +x "$tmpdir/bup-save" diff --git a/t/test-sparse-files.sh b/t/test-sparse-files.sh index fdbfa4b..1a207e9 100755 --- a/t/test-sparse-files.sh +++ b/t/test-sparse-files.sh @@ -18,7 +18,7 @@ WVPASS cd "$tmpdir" # The 3MB guess is semi-arbitrary, but we've been informed that # Lustre, for example, uses 1MB, so guess higher than that, at least. -block_size=$(bup-python -c \ +block_size=$(bup-cfg-py -c \ "import os; print(getattr(os.stat('.'), 'st_blksize', 0)) or $mb * 3") \ || exit $? data_size=$((block_size * 10)) @@ -142,7 +142,7 @@ WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" WVPASS "$top/t/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (short zero runs around boundary)" -WVPASS bup-python > src/foo < src/foo <