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

gmic-qt: build from Git source to avoid mutable tarball #312997

Merged
merged 1 commit into from
May 20, 2024

Conversation

amarshall
Copy link
Member

@amarshall amarshall commented May 19, 2024

The previous tarball src sometimes gets mutated (see e.g. this comment). This was changed from the Git src in fd3e2b4 (see also upstream discussion). However the delta seems simple; it had error:

In file included from /build/source/src/GmicProcessor.cpp:48:
/nix/store/jk1dp7v01pisw0flybqwyjg63in6r9fp-gmic-3.3.5-dev/include/gmic.h:191:21: fatal error: gmic.cpp: No such file or directory
  191 | #define cimg_plugin "gmic.cpp"

workaround this by linking gmic.cpp into the expected location as it appears in the tarball.

Remove the now-unneeded updateScript, as it is trivial GitHub tags now.

Unclear to me why cimg was not needed in buildInputs before, but it is now.

This may appear to be downgrading, but this is only because the previous drv used the gmic version, not the gmic-qt version.

Description of changes

Things done

nix-build -A gmic-qt.passthru.tests; tested in GIMP as plugin.

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Member

@lilyinstarlight lilyinstarlight left a comment

Choose a reason for hiding this comment

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

Unclear to me why cimg was not needed in buildInputs before, but it is now.

The tarball also includes CImg.h and now it no longer does, hence the need for the build input

I do still hate that the build system requires more than just the header and shared object for libgmic (although it does also use both and still links to it...), but this looks like a reasonable enough hack (I hate having to use the bespoke tarballs anyway... only trouble for gmic package itself is the stdlib has a bootstrap problem so we still have to download that prebuilt header which could change too)

I left one comment but otherwise this looks good, thank you!

@@ -107,24 +111,6 @@ stdenv.mkDerivation (finalAttrs: {
gimp-plugin = gimpPlugins.gmic;
inherit cimg gmic;
};

updateScript = writeShellScript "gmic-qt-update-script" ''
Copy link
Member

Choose a reason for hiding this comment

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

We should still have an update script because as-is nix-update and nixpkgs-update/r-ryantm will have a hard time finding updates both due to the lack of GitHub upstream releases (rather than just tags) and the fact that the tags have weird version strings. Maybe something like this?

    updateScript = nix-update-script {
      extraArgs = [ "--version-regex" "^v\\.(.*)" ];
    };

Also please remove the now-unused arguments from the top of the file

Copy link
Member

@jopejoe1 jopejoe1 May 20, 2024

Choose a reason for hiding this comment

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

Using gitUpdater would be nicer for this, as it is specifically designed for git tags, which this is using for versions.

    updateScript = gitUpdater { 
      rev-prefix = "v.";
    };

Copy link
Member

Choose a reason for hiding this comment

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

Both that and nix-update-script are specifically designed for it I guess (nix-update just usually deals with edge cases better), but I'm largely indifferent as long as there is just something there :)

Copy link
Member

@lilyinstarlight lilyinstarlight May 20, 2024

Choose a reason for hiding this comment

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

Actually this is one of the edge cases that gitUpdater does not handle. If I add that updateScript then it tries to "update" it to version 2.2.0 rather than keeping the version at 3.3.5

So please use nix-update-script unless there is an option/argument for gitUpdater to fix that

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review! Pushed amended commit based on feedback.

The previous tarball src sometimes gets mutated (see e.g. [this
comment][1]). This was changed from the Git src in
fd3e2b4 (see also [upstream
discussion][2]). However the delta seems simple; it had error:

```
In file included from /build/source/src/GmicProcessor.cpp:48:
/nix/store/jk1dp7v01pisw0flybqwyjg63in6r9fp-gmic-3.3.5-dev/include/gmic.h:191:21: fatal error: gmic.cpp: No such file or directory
  191 | #define cimg_plugin "gmic.cpp"
```

workaround this by linking `gmic.cpp` into the expected location as it
appears in the tarball.

cimg is now needed in buildInputs as it is bundled in the tarball, but
not the Git src.

Change the updateScript to simpler one that can use the Git tags.

This may appear to be downgrading, but this is only because the previous
drv used the gmic version, not the gmic-qt version.

[1]: NixOS#311734 (comment)
[2]: c-koi/gmic-qt#175
Copy link
Member

@lilyinstarlight lilyinstarlight left a comment

Choose a reason for hiding this comment

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

Looks good to me now!

Will merge when ofborg is green if there are no objections

@ofborg ofborg bot requested a review from lilyinstarlight May 20, 2024 14:03
@lilyinstarlight lilyinstarlight merged commit 35380b2 into NixOS:master May 20, 2024
23 of 24 checks passed
@amarshall amarshall deleted the gmic-qt-from-git branch May 20, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants