From 6df1c56223496ac21598f24aa409e8e46cbeb5e2 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 14 Jun 2023 05:42:44 +0000 Subject: [PATCH 1/3] sequoia: 0.28.0 -> 0.30.1 and fetch from the new upstream, since sequoia-sq (the CLI) was split out of the main sequoia repo (the library). - for the record, python bindings were deprecated and split out into their own repo in 0.25.0, but our build script wasn't updated and has been silently not building bindings since then. - python ffi library: - commit which removed them: --- pkgs/tools/security/sequoia/default.nix | 69 ++++--------------------- pkgs/top-level/all-packages.nix | 4 +- pkgs/top-level/python-packages.nix | 5 +- 3 files changed, 13 insertions(+), 65 deletions(-) diff --git a/pkgs/tools/security/sequoia/default.nix b/pkgs/tools/security/sequoia/default.nix index aed53b57f55d..939e8ab6b77d 100644 --- a/pkgs/tools/security/sequoia/default.nix +++ b/pkgs/tools/security/sequoia/default.nix @@ -1,81 +1,38 @@ { stdenv , fetchFromGitLab -, fetchpatch , lib , darwin -, git , nettle , nix-update-script -, cargo -, rustc , rustPlatform , pkg-config , openssl , sqlite -, capnproto -, ensureNewerSourcesForZipFilesHook -, pythonSupport ? true -, pythonPackages ? null }: -assert pythonSupport -> pythonPackages != null; - rustPlatform.buildRustPackage rec { pname = "sequoia"; - # Upstream has separate version numbering for the library and the CLI frontend. - # This derivation provides the CLI frontend, and thus uses its version number. - version = "0.28.0"; + version = "0.30.1"; src = fetchFromGitLab { owner = "sequoia-pgp"; - repo = "sequoia"; - rev = "sq/v${version}"; - hash = "sha256-T7WOYMqyBeVHs+4w8El99t0NTUKqMW1QeAkNGKcaWr0="; + repo = "sequoia-sq"; + rev = "v${version}"; + hash = "sha256-uFcmuyz0JsUTvKqCb+3t8JdB4Dn4hJq00jeEhvMNW18="; }; - cargoHash = "sha256-zaAAEFBumfHU4hGzAOmLvBu3X4J7LAlmexqixHtVPr8="; - - patches = [ - (fetchpatch { - url = "https://gitlab.com/sequoia-pgp/sequoia/-/commit/4dc6e624c2394936dc447f18aedb4a4810bb2ddb.patch"; - hash = "sha256-T6hh7U1gvKvyn/OCuJBvLM7TG1VFnpvpAiWS72m3P6I="; - }) - ]; + cargoHash = "sha256-9UQojec2jy9DVwQQplaKuPWYCeRXtWtdzj1d/LLyfJQ="; nativeBuildInputs = [ pkg-config - cargo - rustc - git rustPlatform.bindgenHook - ensureNewerSourcesForZipFilesHook - capnproto - ] ++ - lib.optionals pythonSupport [ pythonPackages.setuptools ] - ; - - nativeCheckInputs = lib.optionals pythonSupport [ - pythonPackages.pytest - pythonPackages.pytest-runner ]; buildInputs = [ openssl sqlite nettle - ] ++ lib.optionals pythonSupport [ pythonPackages.python pythonPackages.cffi ] - ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ] - ; - - makeFlags = [ - "PREFIX=${placeholder "out"}" - # Defaults to "ginstall" from some reason, although upstream's Makefiles check uname - "INSTALL=install" - ]; - - buildFlags = [ - "build-release" - ]; + ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; # Sometimes, tests fail on CI (ofborg) & hydra without this checkFlags = [ @@ -84,24 +41,20 @@ rustPlatform.buildRustPackage rec { "--skip=macros::time_it" ]; - preInstall = lib.optionalString pythonSupport '' - export installFlags="PYTHONPATH=$PYTHONPATH:$out/${pythonPackages.python.sitePackages}" - '' + lib.optionalString (!pythonSupport) '' - export makeFlags="PYTHON=disable" + # Install manual pages, see https://gitlab.com/sequoia-pgp/sequoia-sq#building + postInstall = '' + mkdir -p $out/share/man + SQ_MAN=$out/share/man/man1 cargo run ''; - # Don't use buildRustPackage phases, only use it for rust deps setup - configurePhase = null; - buildPhase = null; doCheck = true; - checkPhase = null; - installPhase = null; passthru.updateScript = nix-update-script { }; meta = with lib; { description = "A cool new OpenPGP implementation"; homepage = "https://sequoia-pgp.org/"; + changelog = "https://gitlab.com/sequoia-pgp/sequoia-sq/-/blob/v${version}/NEWS"; license = licenses.gpl2Plus; maintainers = with maintainers; [ minijackson doronbehar ]; mainProgram = "sq"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 119a086fc789..35ab8bef5587 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12371,9 +12371,7 @@ with pkgs; seqdiag = with python3Packages; toPythonApplication seqdiag; - sequoia = callPackage ../tools/security/sequoia { - pythonPackages = python3Packages; - }; + sequoia = callPackage ../tools/security/sequoia { }; sequoia-chameleon-gnupg = callPackage ../tools/security/sequoia-chameleon-gnupg { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4c260b693c24..f42dd57a954a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11104,10 +11104,7 @@ self: super: with self; { seqeval = callPackage ../development/python-modules/seqeval { }; - sequoia = disabledIf isPyPy (toPythonModule (pkgs.sequoia.override { - pythonPackages = self; - pythonSupport = true; - })); + sequoia = disabledIf isPyPy (toPythonModule pkgs.sequoi); serialio = callPackage ../development/python-modules/serialio { }; From 51c7b1f7f6010b524cc5f602f947f12f0a34b06c Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 23 Jun 2023 21:31:59 +0000 Subject: [PATCH 2/3] python3Packages.pysequoia: init at 0.1.14 Also, make `python3Packages.sequoia` throw a message regarding it's replacement of `python3Packages.sequoia`. The main sequoia-pgp/sequoia repository doesn't ship Python code since 0.25.0, just a binary. --- .../manual/release-notes/rl-2311.section.md | 2 + .../python-modules/pysequoia/default.nix | 61 +++++++++++++++++++ pkgs/top-level/python-aliases.nix | 1 + pkgs/top-level/python-packages.nix | 4 +- pkgs/top-level/python2-packages.nix | 2 - 5 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/python-modules/pysequoia/default.nix diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index fd710aa1bf88..39917af14532 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -20,6 +20,8 @@ ## Backward Incompatibilities {#sec-release-23.11-incompatibilities} +- `python3.pkgs.sequoia` was removed in favor of `python3.pkgs.pysequoia`. The latter package is based on upstream's dedicated repository for sequoia's Python bindings, where the Python bindings from [gitlab:sequoia-pgp/sequoia](https://gitlab.com/sequoia-pgp/sequoia) were removed long ago. + - `writeTextFile` now requires `executable` to be boolean, values like `null` or `""` will now fail to evaluate. - The latest version of `clonehero` now stores custom content in `~/.clonehero`. See the [migration instructions](https://clonehero.net/2022/11/29/v23-to-v1-migration-instructions.html). Typically, these content files would exist along side the binary, but the previous build used a wrapper script that would store them in `~/.config/unity3d/srylain Inc_/Clone Hero`. diff --git a/pkgs/development/python-modules/pysequoia/default.nix b/pkgs/development/python-modules/pysequoia/default.nix new file mode 100644 index 000000000000..ffc7486cf20a --- /dev/null +++ b/pkgs/development/python-modules/pysequoia/default.nix @@ -0,0 +1,61 @@ +{ lib +, buildPythonPackage +, fetchFromGitLab +, pkg-config +, rustPlatform +, cargo +, rustc +, bzip2 +, nettle +, openssl +, pcsclite +, stdenv +, darwin +}: + +buildPythonPackage rec { + pname = "pysequoia"; + version = "0.1.14"; + format = "pyproject"; + + src = fetchFromGitLab { + owner = "sequoia-pgp"; + repo = "pysequoia"; + rev = "v${version}"; + hash = "sha256-63kUUxZTG33cB/IiD4AiDpLOI6Uew/fETgqhaGc7zp0="; + }; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + hash = "sha256-S/j3bGgU46nvVQFs35ih05teVEIJrFN4Ryq4B7rLFDE="; + }; + + nativeBuildInputs = [ + pkg-config + rustPlatform.bindgenHook + rustPlatform.cargoSetupHook + rustPlatform.maturinBuildHook + cargo + rustc + ]; + + buildInputs = [ + bzip2 + nettle + openssl + pcsclite + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.CoreFoundation + darwin.apple_sdk.frameworks.Security + ]; + + pythonImportsCheck = [ "pysequoia" ]; + + meta = with lib; { + description = "This library provides OpenPGP facilities in Python through the Sequoia PGP library"; + homepage = "https://sequoia-pgp.gitlab.io/pysequoia"; + license = licenses.asl20; + maintainers = with maintainers; [ doronbehar ]; + }; +} diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 1d887b287660..5da3cedbae7c 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -291,6 +291,7 @@ mapAliases ({ scikitimage = scikit-image; # added 2023-05-14 scikitlearn = scikit-learn; # added 2021-07-21 selectors34 = throw "selectors34 has been removed: functionality provided by Python itself; archived by upstream."; # added 2021-06-10 + sequoia = throw "python3Packages.sequoia was replaced by pysequoia - built from a dedicated repository, with a new API."; # added 2023-06-24 setuptools_scm = setuptools-scm; # added 2021-06-03 sharkiqpy = sharkiq; # added 2022-05-21 ssh-mitm = throw "ssh-mitm was removed in favor of the top-level ssh-mitm"; # added 2023-05-09 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f42dd57a954a..6e8a8c421a80 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7785,6 +7785,8 @@ self: super: with self; { pysbd = callPackage ../development/python-modules/pysbd { }; + pysequoia = callPackage ../development/python-modules/pysequoia { }; + pyschemes = callPackage ../development/python-modules/pyschemes { }; pyschlage = callPackage ../development/python-modules/pyschlage { }; @@ -11104,8 +11106,6 @@ self: super: with self; { seqeval = callPackage ../development/python-modules/seqeval { }; - sequoia = disabledIf isPyPy (toPythonModule pkgs.sequoi); - serialio = callPackage ../development/python-modules/serialio { }; serpent = callPackage ../development/python-modules/serpent { }; diff --git a/pkgs/top-level/python2-packages.nix b/pkgs/top-level/python2-packages.nix index a79dc31ed9dd..1a19118678eb 100644 --- a/pkgs/top-level/python2-packages.nix +++ b/pkgs/top-level/python2-packages.nix @@ -71,8 +71,6 @@ with self; with super; { scandir = callPackage ../development/python2-modules/scandir { }; - sequoia = disabled super.sequoia; - setuptools = callPackage ../development/python2-modules/setuptools { }; setuptools-scm = callPackage ../development/python2-modules/setuptools-scm { }; From 2ae2b4e4a059dca2970aed379b2b4e736a8c963a Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 26 Jun 2023 13:14:33 +0300 Subject: [PATCH 3/3] sequoia: Rename to sequoia-sq --- pkgs/tools/security/{sequoia => sequoia-sq}/default.nix | 2 +- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename pkgs/tools/security/{sequoia => sequoia-sq}/default.nix (98%) diff --git a/pkgs/tools/security/sequoia/default.nix b/pkgs/tools/security/sequoia-sq/default.nix similarity index 98% rename from pkgs/tools/security/sequoia/default.nix rename to pkgs/tools/security/sequoia-sq/default.nix index 939e8ab6b77d..4da70b5155bf 100644 --- a/pkgs/tools/security/sequoia/default.nix +++ b/pkgs/tools/security/sequoia-sq/default.nix @@ -11,7 +11,7 @@ }: rustPlatform.buildRustPackage rec { - pname = "sequoia"; + pname = "sequoia-sq"; version = "0.30.1"; src = fetchFromGitLab { diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 6527b83e63b6..cc378246a4bb 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1528,6 +1528,7 @@ mapAliases ({ seeks = throw "seeks has been removed from nixpkgs, as it was unmaintained"; # Added 2020-06-21 sepolgen = throw "sepolgen was merged into selinux-python"; # Added 2021-11-11 session-desktop-appimage = session-desktop; + sequoia = sequoia-sq; # Added 2023-06-26 sget = throw "sget has been removed from nixpkgs, as it is not supported upstream anymore see https://github.com/sigstore/sget/issues/145"; # Added 2023-05-26 shared_mime_info = throw "'shared_mime_info' has been renamed to/replaced by 'shared-mime-info'"; # Converted to throw 2022-02-22 inherit (libsForQt5.mauiPackages) shelf; # added 2022-05-17 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 35ab8bef5587..ac2fc99dd6eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12371,7 +12371,7 @@ with pkgs; seqdiag = with python3Packages; toPythonApplication seqdiag; - sequoia = callPackage ../tools/security/sequoia { }; + sequoia-sq = callPackage ../tools/security/sequoia-sq { }; sequoia-chameleon-gnupg = callPackage ../tools/security/sequoia-chameleon-gnupg { };