--- Makefile | 1 + debian/rules | 7 ++++++- lib/git-subrepo | 22 +++++----------------- test/setup | 3 --- 4 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile index e7643a7..79898f5 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ $(DOCKER_TESTS): install: install -d -m 0755 $(INSTALL_LIB)/ install -C -m 0755 $(LIB) $(INSTALL_LIB)/ + sed -i 's!^SUBREPO_EXT_DIR=.*!SUBREPO_EXT_DIR=$(INSTALL_EXT)!' $(INSTALL_LIB)/$(NAME) install -d -m 0755 $(INSTALL_EXT)/ install -C -m 0755 $(EXTS) $(INSTALL_EXT)/ install -d -m 0755 $(INSTALL_MAN1)/ diff --git a/debian/rules b/debian/rules index a6231a2..558e5cb 100755 --- a/debian/rules +++ b/debian/rules @@ -1,9 +1,14 @@ #!/usr/bin/make -f #export DH_VERBOSE = 1 +DESTDIR=debian/tmp export PREFIX=/usr +export INSTALL_LIB=$(DESTDIR)/usr/share/git-subrepo +export INSTALL_EXT=$(INSTALL_LIB) %: - dh $@ --with=bash-completion + dh $@ \ + -Smakefile --with=bash-completion \ + -P$(DESTDIR) override_dh_auto_test: # Tests are broken without a .git directory, see diff --git a/lib/git-subrepo b/lib/git-subrepo index a6d5d96..7072887 100755 --- a/lib/git-subrepo +++ b/lib/git-subrepo @@ -12,21 +12,9 @@ set -e export FILTER_BRANCH_SQUELCH_WARNING=1 # Import Bash+ helper functions: -SOURCE=${BASH_SOURCE[0]} -while [[ -h $SOURCE ]]; do - DIR=$( cd -P "$( dirname "$SOURCE" )" && pwd ) - SOURCE=$(readlink "$SOURCE") - [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE -done -SOURCE_DIR=$(dirname "$SOURCE") - -if [[ -z $GIT_SUBREPO_ROOT ]]; then - # If `make install` installation used: - source "${SOURCE_DIR}/git-subrepo.d/bash+.bash" -else - # If `source .rc` method used: - source "${SOURCE_DIR}/../ext/bashplus/lib/bash+.bash" -fi + +SUBREPO_EXT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")/git-subrepo.d" # replaced by `make install` +source "${SUBREPO_EXT_DIR}/bash+.bash" bash+:import :std can version-check @@ -394,7 +382,7 @@ command:config() { # Launch the manpage viewer: command:help() { - source "${SOURCE_DIR}/git-subrepo.d/help-functions.bash" + source "${SUBREPO_EXT_DIR}/help-functions.bash" local cmd=${command_arguments[0]} if [[ $cmd ]]; then if can "help:$cmd"; then @@ -1952,7 +1940,7 @@ OK() { usage-error() { local msg="git-subrepo: $1" usage= if [[ $GIT_SUBREPO_TEST_ERRORS != true ]]; then - source "${SOURCE_DIR}/git-subrepo.d/help-functions.bash" + source "${SUBREPO_EXT_DIR}/help-functions.bash" if can "help:$command"; then msg=$'\n'"$msg"$'\n'"$("help:$command")"$'\n' fi diff --git a/test/setup b/test/setup index a05f7ff..ea4df6e 100644 --- a/test/setup +++ b/test/setup @@ -5,9 +5,6 @@ git config core.autocrlf input set -e -# Set the GIT_SUBREPO_ROOT for testing. -source "$PWD"/.rc - # Get the location of this script SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -- 2.39.2