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

authored by

hyperfekt and committed by
Lassulus
de5a9dea 13b97cff

+45
+8
pkgs/applications/version-management/git-and-tools/transcrypt/default.nix
··· 13 14 buildInputs = [ makeWrapper git openssl coreutils utillinux gnugrep gnused gawk ]; 15 16 installPhase = '' 17 install -m 755 -D transcrypt $out/bin/transcrypt 18 install -m 644 -D man/transcrypt.1 $out/share/man/man1/transcrypt.1 ··· 21 22 wrapProgram $out/bin/transcrypt \ 23 --prefix PATH : "${stdenv.lib.makeBinPath [ git openssl coreutils utillinux gnugrep gnused gawk ]}" 24 ''; 25 26 meta = with stdenv.lib; {
··· 13 14 buildInputs = [ makeWrapper git openssl coreutils utillinux gnugrep gnused gawk ]; 15 16 + patches = [ ./helper-scripts_depspathprefix.patch ]; 17 + 18 installPhase = '' 19 install -m 755 -D transcrypt $out/bin/transcrypt 20 install -m 644 -D man/transcrypt.1 $out/share/man/man1/transcrypt.1 ··· 23 24 wrapProgram $out/bin/transcrypt \ 25 --prefix PATH : "${stdenv.lib.makeBinPath [ git openssl coreutils utillinux gnugrep gnused gawk ]}" 26 + 27 + cat > $out/bin/transcrypt-depspathprefix << EOF 28 + #!${stdenv.shell} 29 + echo "${stdenv.lib.makeBinPath [ git openssl coreutils gawk ]}:" 30 + EOF 31 + chmod +x $out/bin/transcrypt-depspathprefix 32 ''; 33 34 meta = with stdenv.lib; {
+37
pkgs/applications/version-management/git-and-tools/transcrypt/helper-scripts_depspathprefix.patch
···
··· 1 + diff --git a/transcrypt b/transcrypt 2 + index a0b562d..7888f5d 100755 3 + --- a/transcrypt 4 + +++ b/transcrypt 5 + @@ -278,6 +278,7 @@ save_helper_scripts() { 6 + 7 + cat <<-'EOF' > "${GIT_DIR}/crypt/clean" 8 + #!/usr/bin/env bash 9 + + PATH="$(transcrypt-depspathprefix 2>/dev/null)$PATH" 10 + filename=$1 11 + # ignore empty files 12 + if [[ -s $filename ]]; then 13 + @@ -300,6 +301,7 @@ save_helper_scripts() { 14 + 15 + cat <<-'EOF' > "${GIT_DIR}/crypt/smudge" 16 + #!/usr/bin/env bash 17 + + PATH="$(transcrypt-depspathprefix 2>/dev/null)$PATH" 18 + tempfile=$(mktemp 2> /dev/null || mktemp -t tmp) 19 + trap 'rm -f "$tempfile"' EXIT 20 + cipher=$(git config --get --local transcrypt.cipher) 21 + @@ -309,6 +311,7 @@ save_helper_scripts() { 22 + 23 + cat <<-'EOF' > "${GIT_DIR}/crypt/textconv" 24 + #!/usr/bin/env bash 25 + + PATH="$(transcrypt-depspathprefix 2>/dev/null)$PATH" 26 + filename=$1 27 + # ignore empty files 28 + if [[ -s $filename ]]; then 29 + @@ -351,7 +354,7 @@ save_configuration() { 30 + git config merge.renormalize 'true' 31 + 32 + # add a git alias for listing encrypted files 33 + - git config alias.ls-crypt "!git ls-files | git check-attr --stdin filter | awk 'BEGIN { FS = \":\" }; /crypt$/{ print \$1 }'" 34 + + 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 }'" 35 + } 36 + 37 + # display the current configuration settings