From f7cd362ae495365251c1ad48fdced79c68920fa4 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Sat, 6 Oct 2018 12:21:05 -0500 Subject: [PATCH 1/2] gnupg20: set version variable to fix gnupg1compat Presently, gnupg1compat only works with gnupg22. Without this change, the error ``` error: attribute 'version' missing, at .../nixpkgs/pkgs/tools/security/gnupg/1compat.nix:4:26 ``` is emitted when evaluating ``` pkgs.gnupg1compat.override { gnupg = pkgs.gnupg20; }' ``` --- pkgs/tools/security/gnupg/20.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/security/gnupg/20.nix b/pkgs/tools/security/gnupg/20.nix index 9404cb1d065516..6ae2bbc436ed52 100644 --- a/pkgs/tools/security/gnupg/20.nix +++ b/pkgs/tools/security/gnupg/20.nix @@ -12,7 +12,8 @@ with stdenv.lib; assert guiSupport -> pinentry != null; stdenv.mkDerivation rec { - name = "gnupg-2.0.30"; + name = "gnupg-${version}"; + version = "2.0.30"; src = fetchurl { url = "mirror://gnupg/gnupg/${name}.tar.bz2"; From 1e237142964793c9c3d55faaa3a8cdbe3315c855 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Sat, 6 Oct 2018 13:26:35 -0500 Subject: [PATCH 2/2] gnupg1compat: reintroduce symlinks, only when actually needed --- pkgs/tools/security/gnupg/1compat.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/security/gnupg/1compat.nix b/pkgs/tools/security/gnupg/1compat.nix index eadfbe230b3fbc..371a7ca67afde1 100644 --- a/pkgs/tools/security/gnupg/1compat.nix +++ b/pkgs/tools/security/gnupg/1compat.nix @@ -4,14 +4,22 @@ stdenv.mkDerivation { name = "gnupg1compat-${gnupg.version}"; builder = writeScript "gnupg1compat-builder" '' + PATH=${coreutils}/bin # First symlink all top-level dirs - ${coreutils}/bin/mkdir -p $out - ${coreutils}/bin/ln -s "${gnupg}/"* $out + mkdir -p $out + ln -s "${gnupg}/"* $out # Replace bin with directory and symlink it contents - ${coreutils}/bin/rm $out/bin - ${coreutils}/bin/mkdir -p $out/bin - ${coreutils}/bin/ln -s "${gnupg}/bin/"* $out/bin + rm $out/bin + mkdir -p $out/bin + ln -s "${gnupg}/bin/"* $out/bin + + # Add symlinks for any executables that end in 2 and lack any non-*2 version + for f in $out/bin/*2; do + [[ -x $f ]] || continue # ignore failed globs and non-executable files + [[ -e ''${f%2} ]] && continue # ignore commands that already have non-*2 versions + ln -s -- "''${f##*/}" "''${f%2}" + done ''; meta = gnupg.meta // {