git.iko.soy/typeable/nixpkgs
on master help sign in
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

commitde5a9dea8812f0d57c31aaaf2b938a85876bd321 authorhyperfekt <git@hyperfekt.net> dateSat 23 Feb 2019, 19:31 (8 years ago) parent13b97cf
2 files changed+45
pkgs/applications/version-management/git-and-tools/transcrypt/default.nix+8 pkgs/applications/version-management/git-and-tools/transcrypt/helper-scripts_depspathprefix.patch+37
pkgs/applications/version-management/git-and-tools/transcrypt/default.nix+8
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
1313
1414 buildInputs = [ makeWrapper git openssl coreutils utillinux gnugrep gnused gawk ];
1515
16+ patches = [ ./helper-scripts_depspathprefix.patch ];
17+
1618 installPhase = ''
1719 install -m 755 -D transcrypt $out/bin/transcrypt
1820 install -m 644 -D man/transcrypt.1 $out/share/man/man1/transcrypt.1
@@ -21,6 +23,12 @@ stdenv.mkDerivation rec {
2123
2224 wrapProgram $out/bin/transcrypt \
2325 --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
2432 '';
2533
2634 meta = with stdenv.lib; {
pkgs/applications/version-management/git-and-tools/transcrypt/helper-scripts_depspathprefix.patchnew file+37
@@ -0,0 +1,37 @@
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