From e182281c206d210a7ba13ad54b677775985e339d Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 6 Dec 2023 18:39:52 +0100 Subject: [PATCH 1/6] pcsclite: add passthru.updateScript --- pkgs/tools/security/pcsclite/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index a4ae25715c3f..aae0c3dec11b 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -10,6 +10,7 @@ , polkit , systemdLibs , IOKit +, gitUpdater , pname ? "pcsclite" , polkitSupport ? false }: @@ -63,6 +64,10 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.isDarwin [ IOKit ] ++ lib.optionals polkitSupport [ dbus polkit ]; + passthru.updateScript = gitUpdater { + url = "https://salsa.debian.org/rousseau/PCSC.git"; + }; + meta = with lib; { description = "Middleware to access a smart card using SCard API (PC/SC)"; homepage = "https://pcsclite.apdu.fr/"; From 5d04db1493e1fcc95ebf564a16f97def6374795e Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 6 Dec 2023 18:40:08 +0100 Subject: [PATCH 2/6] pcsclite: add anthonyroussel to maintainers --- pkgs/tools/security/pcsclite/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index aae0c3dec11b..0d214c0c778d 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -72,6 +72,7 @@ stdenv.mkDerivation rec { description = "Middleware to access a smart card using SCard API (PC/SC)"; homepage = "https://pcsclite.apdu.fr/"; license = licenses.bsd3; + maintainers = [ maintainers.anthonyroussel ]; platforms = with platforms; unix; }; } From 9ac6715549ce35ce0170a4dbf9965e477f5878b4 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 6 Dec 2023 18:41:16 +0100 Subject: [PATCH 3/6] pcsclite: 1.9.5 -> 2.0.1 https://salsa.debian.org/rousseau/PCSC/-/compare/1.9.5...2.0.1 https://salsa.debian.org/rousseau/PCSC/-/blob/2.0.1/ChangeLog --- pkgs/tools/security/pcsclite/default.nix | 28 +++++------ .../pcsclite/no-dropdir-literals.patch | 47 ------------------- 2 files changed, 13 insertions(+), 62 deletions(-) delete mode 100644 pkgs/tools/security/pcsclite/no-dropdir-literals.patch diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index 0d214c0c778d..653825758d78 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -3,6 +3,7 @@ , fetchurl , autoreconfHook , autoconf-archive +, flex , pkg-config , perl , python3 @@ -17,22 +18,15 @@ stdenv.mkDerivation rec { inherit pname; - version = "1.9.5"; + version = "2.0.1"; outputs = [ "bin" "out" "dev" "doc" "man" ]; src = fetchurl { url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2"; - hash = "sha256-nuP5szNTdWIXeJNVmtT3uNXCPr6Cju9TBWwC2xQEnQg="; + hash = "sha256-XtyvXUVEQDvatu4rXWwCxvl+pk7r8IJbjQ+mG6QX2to="; }; - patches = [ ./no-dropdir-literals.patch ]; - - postPatch = '' - sed -i configure.ac \ - -e "s@polkit_policy_dir=.*@polkit_policy_dir=$bin/share/polkit-1/actions@" - ''; - configureFlags = [ "--enable-confdir=/etc" # The OS should care on preparing the drivers into this location @@ -44,11 +38,9 @@ stdenv.mkDerivation rec { "--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system" ]; - postConfigure = '' - sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ { - s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/ - }' config.h - ''; + makeFlags = [ + "POLICY_DIR=$(out)/share/polkit-1/actions" + ]; postInstall = '' # pcsc-spy is a debugging utility and it drags python into the closure @@ -57,7 +49,13 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - nativeBuildInputs = [ autoreconfHook autoconf-archive pkg-config perl ]; + nativeBuildInputs = [ + autoreconfHook + autoconf-archive + flex + pkg-config + perl + ]; buildInputs = [ python3 ] ++ lib.optionals stdenv.isLinux [ systemdLibs ] diff --git a/pkgs/tools/security/pcsclite/no-dropdir-literals.patch b/pkgs/tools/security/pcsclite/no-dropdir-literals.patch deleted file mode 100644 index 4c6d5554d77a..000000000000 --- a/pkgs/tools/security/pcsclite/no-dropdir-literals.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/src/hotplug_libudev.c b/src/hotplug_libudev.c -index 51bd95f..84f959b 100644 ---- a/src/hotplug_libudev.c -+++ b/src/hotplug_libudev.c -@@ -120,7 +120,8 @@ static LONG HPReadBundleValues(void) - - if (NULL == hpDir) - { -- Log1(PCSC_LOG_ERROR, "Cannot open PC/SC drivers directory: " PCSCLITE_HP_DROPDIR); -+ Log2(PCSC_LOG_ERROR, "Cannot open PC/SC drivers directory: %s", -+ PCSCLITE_HP_DROPDIR); - Log1(PCSC_LOG_ERROR, "Disabling USB support for pcscd."); - return -1; - } -@@ -741,7 +742,7 @@ ULONG HPRegisterForHotplugEvents(void) - - if (driverSize <= 0) - { -- Log1(PCSC_LOG_INFO, "No bundle files in pcsc drivers directory: " -+ Log2(PCSC_LOG_INFO, "No bundle files in pcsc drivers directory: %s", - PCSCLITE_HP_DROPDIR); - Log1(PCSC_LOG_INFO, "Disabling USB support for pcscd"); - return 0; -diff --git a/src/hotplug_libusb.c b/src/hotplug_libusb.c -index 0ada9f5..d49a407 100644 ---- a/src/hotplug_libusb.c -+++ b/src/hotplug_libusb.c -@@ -142,7 +142,8 @@ static LONG HPReadBundleValues(void) - - if (hpDir == NULL) - { -- Log1(PCSC_LOG_ERROR, "Cannot open PC/SC drivers directory: " PCSCLITE_HP_DROPDIR); -+ Log2(PCSC_LOG_ERROR, "Cannot open PC/SC drivers directory: %s", -+ PCSCLITE_HP_DROPDIR); - Log1(PCSC_LOG_ERROR, "Disabling USB support for pcscd."); - return -1; - } -@@ -282,7 +283,8 @@ static LONG HPReadBundleValues(void) - - if (driverSize == 0) - { -- Log1(PCSC_LOG_INFO, "No bundle files in pcsc drivers directory: " PCSCLITE_HP_DROPDIR); -+ Log2(PCSC_LOG_INFO, "No bundle files in pcsc drivers directory: %s", -+ PCSCLITE_HP_DROPDIR); - Log1(PCSC_LOG_INFO, "Disabling USB support for pcscd"); - } - #ifdef DEBUG_HOTPLUG From 4988c9de461646b7f8cf7de5fb2be2fc22c5429c Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 6 Dec 2023 18:49:26 +0100 Subject: [PATCH 4/6] pcsclite: switch to fetchFromGitlab --- pkgs/tools/security/pcsclite/default.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index 653825758d78..ca7f3de3fff6 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -1,6 +1,6 @@ { stdenv , lib -, fetchurl +, fetchFromGitLab , autoreconfHook , autoconf-archive , flex @@ -11,7 +11,7 @@ , polkit , systemdLibs , IOKit -, gitUpdater +, nix-update-script , pname ? "pcsclite" , polkitSupport ? false }: @@ -22,9 +22,12 @@ stdenv.mkDerivation rec { outputs = [ "bin" "out" "dev" "doc" "man" ]; - src = fetchurl { - url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2"; - hash = "sha256-XtyvXUVEQDvatu4rXWwCxvl+pk7r8IJbjQ+mG6QX2to="; + src = fetchFromGitLab { + domain = "salsa.debian.org"; + owner = "rousseau"; + repo = "PCSC"; + rev = "refs/tags/${version}"; + hash = "sha256-7NGlU4byGxtGBticewg8K4FUiDSQZAiB7Q/y+LaqKPo="; }; configureFlags = [ @@ -62,9 +65,7 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.isDarwin [ IOKit ] ++ lib.optionals polkitSupport [ dbus polkit ]; - passthru.updateScript = gitUpdater { - url = "https://salsa.debian.org/rousseau/PCSC.git"; - }; + passthru.updateScript = nix-update-script { }; meta = with lib; { description = "Middleware to access a smart card using SCard API (PC/SC)"; From c22069226be743893403c1eb994fca48dce98de0 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 6 Dec 2023 18:53:21 +0100 Subject: [PATCH 5/6] pcsclite: add passthru.tests.version --- pkgs/tools/security/pcsclite/default.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index ca7f3de3fff6..158c1722c73b 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -11,12 +11,13 @@ , polkit , systemdLibs , IOKit +, testers , nix-update-script , pname ? "pcsclite" , polkitSupport ? false }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { inherit pname; version = "2.0.1"; @@ -26,7 +27,7 @@ stdenv.mkDerivation rec { domain = "salsa.debian.org"; owner = "rousseau"; repo = "PCSC"; - rev = "refs/tags/${version}"; + rev = "refs/tags/${finalAttrs.version}"; hash = "sha256-7NGlU4byGxtGBticewg8K4FUiDSQZAiB7Q/y+LaqKPo="; }; @@ -65,7 +66,13 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.isDarwin [ IOKit ] ++ lib.optionals polkitSupport [ dbus polkit ]; - passthru.updateScript = nix-update-script { }; + passthru = { + tests.version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "pcscd --version"; + }; + updateScript = nix-update-script { }; + }; meta = with lib; { description = "Middleware to access a smart card using SCard API (PC/SC)"; @@ -74,4 +81,4 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.anthonyroussel ]; platforms = with platforms; unix; }; -} +}) From 56603eb6ae5af788797d184383473579d5d72ab2 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 6 Dec 2023 18:45:02 +0100 Subject: [PATCH 6/6] pcsclite: add meta.{changelog,mainProgram} --- pkgs/tools/security/pcsclite/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index 158c1722c73b..08a4b5b08d02 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -77,7 +77,9 @@ stdenv.mkDerivation (finalAttrs: { meta = with lib; { description = "Middleware to access a smart card using SCard API (PC/SC)"; homepage = "https://pcsclite.apdu.fr/"; + changelog = "https://salsa.debian.org/rousseau/PCSC/-/blob/${finalAttrs.version}/ChangeLog"; license = licenses.bsd3; + mainProgram = "pcscd"; maintainers = [ maintainers.anthonyroussel ]; platforms = with platforms; unix; };