Create tool to check if linked issues/pull requests that are closed/merged

I am currently in the process of creating a package definition and have searched nixpkgs for references.

I noticed that a pull request was linked in a comment, that is now closed. So the workaround can get removed.

I considered creating an issue for this specific case or fixing it myself, but it would be more sustainable to create a tool that searches nixpkgs for linked issues and pull resuests (on GitHub, GitLab etc) and check if they are closed/merged now. That would help to clean up nixpkgs and improve quality.

Output can be the files where a link was found and the line number (like grep).

What do you think about this idea?

Such a tool could also be used in other projects. Maybe such a tool already exists.

Would you like to implement this? Should be a nice small project to do it in Python/Go/Rust/your favorite language.

1 Like

For that particular example, even though the PR has been merged upstream, there hasn’t been a 0.4.6 release yet, so the patch can’t be removed. When we do upgrade to 0.4.6 someday, the patch will fail to apply, so the person doing the upgrade will be forced to remove it, so in this case I don’t think we need any tool beyond the default functionality of patch and a nice comment.

One caveat is that the nixpkgs-update bot can’t upgrade this package, because it’s not smart enough to attempt the build with the cargoPatches removed. That’s possibly an area for automation improvement to consider.

2 Likes

Without the automation improvement, you can still use

# this will not break automatic updates and can later be removed during manual or automatic cleanup
patches = lib.optionals (lib.versionAtLeast version "42") [
  ./some.patch
]
1 Like