gitAndTools.transcrypt: query dependencies in helper scripts

adds a tool to get the paths of the dependencies needed by the helper scripts
(which are written only once and are never updated) to the output and patches
them to use it expand their path
This commit is contained in:
hyperfekt 2019-02-23 19:31:53 +01:00 committed by Lassulus
parent 13b97cffae
commit de5a9dea88
2 changed files with 45 additions and 0 deletions

View File

@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
buildInputs = [ makeWrapper git openssl coreutils utillinux gnugrep gnused gawk ];
patches = [ ./helper-scripts_depspathprefix.patch ];
installPhase = ''
install -m 755 -D transcrypt $out/bin/transcrypt
install -m 644 -D man/transcrypt.1 $out/share/man/man1/transcrypt.1
@ -21,6 +23,12 @@ stdenv.mkDerivation rec {
wrapProgram $out/bin/transcrypt \
--prefix PATH : "${stdenv.lib.makeBinPath [ git openssl coreutils utillinux gnugrep gnused gawk ]}"
cat > $out/bin/transcrypt-depspathprefix << EOF
#!${stdenv.shell}
echo "${stdenv.lib.makeBinPath [ git openssl coreutils gawk ]}:"
EOF
chmod +x $out/bin/transcrypt-depspathprefix
'';
meta = with stdenv.lib; {

View File

@ -0,0 +1,37 @@
diff --git a/transcrypt b/transcrypt
index a0b562d..7888f5d 100755
--- a/transcrypt
+++ b/transcrypt
@@ -278,6 +278,7 @@ save_helper_scripts() {
cat <<-'EOF' > "${GIT_DIR}/crypt/clean"
#!/usr/bin/env bash
+ PATH="$(transcrypt-depspathprefix 2>/dev/null)$PATH"
filename=$1
# ignore empty files
if [[ -s $filename ]]; then
@@ -300,6 +301,7 @@ save_helper_scripts() {
cat <<-'EOF' > "${GIT_DIR}/crypt/smudge"
#!/usr/bin/env bash
+ PATH="$(transcrypt-depspathprefix 2>/dev/null)$PATH"
tempfile=$(mktemp 2> /dev/null || mktemp -t tmp)
trap 'rm -f "$tempfile"' EXIT
cipher=$(git config --get --local transcrypt.cipher)
@@ -309,6 +311,7 @@ save_helper_scripts() {
cat <<-'EOF' > "${GIT_DIR}/crypt/textconv"
#!/usr/bin/env bash
+ PATH="$(transcrypt-depspathprefix 2>/dev/null)$PATH"
filename=$1
# ignore empty files
if [[ -s $filename ]]; then
@@ -351,7 +354,7 @@ save_configuration() {
git config merge.renormalize 'true'
# add a git alias for listing encrypted files
- git config alias.ls-crypt "!git ls-files | git check-attr --stdin filter | awk 'BEGIN { FS = \":\" }; /crypt$/{ print \$1 }'"
+ git config alias.ls-crypt "!PATH=\"\$(transcrypt-depspathprefix 2>/dev/null)\$PATH\"; git ls-files | git check-attr --stdin filter | awk 'BEGIN { FS = \":\" }; /crypt$/{ print \$1 }'"
}
# display the current configuration settings