Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix-env --query: fix --json ignoring --drv-path #9257

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

Artturin
Copy link
Member

{
  "AMB-plugins": {
    "drvPath": "/nix/store/l99cb7h2hy8dg005arsjbd9kx0w05d3h-AMB-plugins-0.8.1.drv",
    "name": "AMB-plugins-0.8.1",
    "outputName": "out",
    "outputs": {
      "out": null
    },
    "pname": "AMB-plugins",
    "system": "x86_64-linux",
    "version": "0.8.1"
  },
  "ArchiSteamFarm": {
    "drvPath": "/nix/store/nhplgyjj34fz6hjmnyih25gxscfh8s7b-ArchiSteamFarm-5.4.12.5.drv",
    "name": "ArchiSteamFarm-5.4.12.5",
    "outputName": "out",
    "outputs": {
      "out": null
    },
    "pname": "ArchiSteamFarm",
    "system": "x86_64-linux",
    "version": "5.4.12.5"
  },
...

Motivation

Context

Priorities

Add 👍 to pull requests you find important.

@Artturin Artturin added bug cli The old and/or new command line interface labels Nov 1, 2023
@@ -953,6 +953,11 @@ static void queryJSON(Globals & globals, std::vector<DrvInfo> & elems, bool prin
}
}

if (printDrvPath) {
auto drvPath = i.queryDrvPath();
if (drvPath) pkgObj["drvPath"] = globals.state->store->printStorePath(*drvPath);
Copy link
Member Author

@Artturin Artturin Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ref this is the code used in the non-json path

            if (printDrvPath) {
                auto drvPath = i.queryDrvPath();
                if (xmlOutput) {
                    if (drvPath) attrs["drvPath"] = store.printStorePath(*drvPath);
                } else
                    columns.push_back(drvPath ? store.printStorePath(*drvPath) : "-");
            }

@Ericson2314
Copy link
Member

@Artturin Can you add a test (and maybe also release notes)?

#9242 also tests JSON which is non-deteriministic due to the store path, so it might be useful to look at that.

@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Nov 2, 2023
@Artturin
Copy link
Member Author

Artturin commented Nov 2, 2023

@Artturin Can you add a test (and maybe also release notes)?

#9242 also tests JSON which is non-deteriministic due to the store path, so it might be useful to look at that.

Done

macos test failure is unrelated

doc/manual/src/release-notes/rl-next.md Outdated Show resolved Hide resolved
```json
{
  "AMB-plugins": {
    "drvPath": "/nix/store/l99cb7h2hy8dg005arsjbd9kx0w05d3h-AMB-plugins-0.8.1.drv",
    "name": "AMB-plugins-0.8.1",
    "outputName": "out",
    "outputs": {
      "out": null
    },
    "pname": "AMB-plugins",
    "system": "x86_64-linux",
    "version": "0.8.1"
  },
  "ArchiSteamFarm": {
    "drvPath": "/nix/store/nhplgyjj34fz6hjmnyih25gxscfh8s7b-ArchiSteamFarm-5.4.12.5.drv",
    "name": "ArchiSteamFarm-5.4.12.5",
    "outputName": "out",
    "outputs": {
      "out": null
    },
    "pname": "ArchiSteamFarm",
    "system": "x86_64-linux",
    "version": "5.4.12.5"
  },
...
```
@Artturin Artturin changed the title nix-env --query: Respect --drv-path with --json nix-env --query: fix --json ignoring --drv-path Nov 9, 2023
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-11-17-nix-team-meeting-minutes-104/35753/1

@Artturin
Copy link
Member Author

Artturin commented Nov 20, 2023

@fricklerhandwerk Please either approve or dismiss your review so the auto merge will work

@Ericson2314 Ericson2314 merged commit 516e7dd into NixOS:master Nov 20, 2023
8 checks passed
tebowy pushed a commit to tebowy/nix that referenced this pull request Jul 11, 2024
`nix-env --query`: fix `--json` ignoring `--drv-path`

(cherry picked from commit 516e7dd)
Change-Id: I84b5bccea9d0383e2e74544743b703942e7be547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli The old and/or new command line interface with-tests Issues related to testing. PRs with tests have some priority
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants