Code Monkey home page Code Monkey logo

Comments (6)

cole-h avatar cole-h commented on September 27, 2024 1

OK, I see what you're saying now. My tests (specifically, decrypt_file_into_bytes and decrypt_file_into_strings) fail when using rustPlatform.buildRustPackage due to No data (gpg error 58). I'll look into it.

from passrs.

cole-h avatar cole-h commented on September 27, 2024

Good point about cargo test operating on your store by default. I've added a little "helper" that overrides the PASSWORD_STORE_DIR env var to point where it should in 614df96.

Could you maybe reword what you mean in your second paragraph? I'm having trouble parsing. nix-shell --pure --run "cargo test --test util" works fine for me, if that's what you were talking about.

from passrs.

cole-h avatar cole-h commented on September 27, 2024

I've found the issue! Unfortunately, I don't think there's anything I can do here. The tests require the presence of my test key located at tests/[email protected] -- it's on my system, since I created it, but it won't be in the sandbox. The following derivation should work:

{ rustPlatform
, fetchFromGitHub
, libgpgerror
, gpgme
, libgit2
, gnupg
}:

rustPlatform.buildRustPackage {
  pname = "passrs";
  version = "0.1.0";

  # src = fetchFromGitHub { ... };

  cargoSha256 = "09vqz51hg3zw48zygp4ask8d7sdml7qw6d33pcabq9advxvg9bwr";

  nativeBuildInputs = [
    gpgme # `gpgme-config` required by crate gpgme
    libgpgerror # `gpg-error-config` required by crate libgpg-error-sys
  ];

  buildInputs = [
    gpgme
    libgit2
    libgpgerror
  ];

  checkInputs = [
    gnupg
  ];

  # Some tests require the presence of a test key.
  preCheck = ''
    export GNUPGHOME=$(mktemp -d)
    gpg --import tests/[email protected]
    echo "4B0D9BBAC5C8329C035B125CF6EF0D39C5F84192:6:" | gpg --import-ownertrust
  '';
}

from passrs.

cole-h avatar cole-h commented on September 27, 2024

Sorry, I closed this by accident. I still need to find a solution to being able to run tests without the above workaround. gpgme might be able to import and set the trust level of a key.

from passrs.

cole-h avatar cole-h commented on September 27, 2024

As of 6f01544, this should be solved. Please let me know if that's not the case.

It doesn't look like gpgme has a way to manipulate ownertrust (though it can import keys), so I took the path of least resistance and spawn two gpg processes -- one to import the secret key itself, and one to import the ownertrust.

from passrs.

cole-h avatar cole-h commented on September 27, 2024

As of ce690f6, I've checked in the contents of a dummy GNUPGHOME, which will allow the tests to run without running gpg.

Thanks for bringing this to my attention!

from passrs.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.