add being able to pass a `CacheFlags()` to `isprecompiled` to verify against a set of custom flags
This makes it easier to also update isprecompiled to check for staleness with custom flags
This is the second take of https://github.com/JuliaLang/julia/pull/53316.
Sounds good to me, but haven't done a code review.
I had to scale this back a bit (see latest commit) because we cannot recreate the command line flags from the CacheFlags object (--pkgimages=existing) so it became a bit awkward. Now you can verify a compile file against a CacheFlags at least.
Corresponding commit in Pkg: https://github.com/JuliaLang/Pkg.jl/pull/3792/commits/7279a85a76485ee17714d7f367b650a3a7ff91b3
Let's try this then. I'm adding a backport label because there is somewhat of a regression in Pkg now that it has to add itself to the test environment in 1.11 due to Pkg not being in the sysimage and this would help avoid that.