Skip to content

[FIX] macOS PKG: exclude pyopenms python_modules from the installer to fix notarization - #9827

Merged
timosachsenberg merged 3 commits into
developfrom
claude/laughing-wozniak-rjjrhf
Jul 30, 2026
Merged

timosachsenberg merged 3 commits into
developfrom
claude/laughing-wozniak-rjjrhf

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

The nightly Release workflow's macos-15 job has been failing at the "Notarize macOS Package" step (e.g. run 30506465700). Apple rejected OpenMS-<version>-macOS-Silicon-python_modules.pkg with errors like:

"message": "The binary is not signed with a valid Developer ID certificate."
"message": "The signature does not include a secure timestamp."

Root cause: productbuild packages the python_modules CPack component (the pyopenms extension .so modules, installed to DESTINATION pyopenms per src/pyOpenMS/CMakeLists.txt) into its own sub-.pkg. cmake/package_mac_productbuild.cmake never set CPACK_COMPONENTS_ALL, so productbuild defaulted to packaging every known component — including python_modules, which was never signed like the other components. .deb/.rpm packaging (cmake/package_deb.cmake / cmake/package_rpm.cmake) already excludes python_modules via an explicit CPACK_COMPONENTS_ALL; only macOS picked it up by accident.

Per @jpfeuffer's review feedback, pyopenms doesn't belong in the desktop application installer at all — it's already shipped separately as wheels via pyopenms-wheels-cibuildwheel.yml. This PR excludes it from the macOS .pkg instead of signing it, using get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) (CMake's own list of every component that received an install(... COMPONENT ...) call) followed by list(REMOVE_ITEM CPACK_COMPONENTS_ALL python_modules), so it stays correct as components are added/removed elsewhere rather than relying on a hardcoded list. No workaround (e.g. skipping notarization) was used — the actual packaging bug is fixed.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes (this is a macOS-only packaging path exercised by the Release workflow on macos-15; not covered by unit tests, cannot be exercised in this Linux dev environment)
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

…eeds

The productbuild generator packages the python_modules component (the
pyopenms extension modules, installed to DESTINATION pyopenms per
src/pyOpenMS/CMakeLists.txt) into its own sub-pkg. That component was
never covered by the existing codesign install(CODE) steps, which only
sign the Dependencies (bin) and library components plus THIRDPARTY.
Apple's notarization service then rejected the nightly macOS package
because the pyopenms *.so binaries were unsigned and lacked a secure
timestamp.

Add an equivalent codesign --options runtime --timestamp step scoped to
COMPONENT python_modules so those binaries get signed like the rest of
the install tree before the .pkg is submitted for notarization.
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The macOS productbuild configuration now removes the python_modules component from the components packaged into the desktop application installer, replacing the previous signing step.

Changes

PyOpenMS macOS packaging

Layer / File(s) Summary
Exclude Python modules from productbuild
cmake/package_mac_productbuild.cmake
Retrieves CPACK_COMPONENTS_ALL and removes python_modules before productbuild packaging instead of recursively signing its installed files.

Suggested reviewers: poshul

Poem

A rabbit hops past signed-up files,
And leaves them out in packaging piles.
The desktop bundle stays serene,
While Python modules skip the scene.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: excluding python_modules from the macOS PKG installer to resolve notarization issues.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/laughing-wozniak-rjjrhf

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmake/package_mac_productbuild.cmake`:
- Around line 131-133: Update the execute_process invocation in the pyOpenMS
signing install(CODE) block to fail packaging whenever codesign exits non-zero,
using COMMAND_ERROR_IS_FATAL ANY with the existing captured output or explicitly
checking a RESULT_VARIABLE and issuing message(FATAL_ERROR). Preserve the
current signing command and diagnostic output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d038ce4e-471f-43fe-a3e0-47bcaad18a43

📥 Commits

Reviewing files that changed from the base of the PR and between 193b2e7 and 0ffc723.

📒 Files selected for processing (1)
  • cmake/package_mac_productbuild.cmake

Comment thread cmake/package_mac_productbuild.cmake Resolved
Capture the find/codesign RESULT_VARIABLE for the python_modules signing
step and abort with a FATAL_ERROR instead of silently continuing when
signing fails, matching what CodeRabbit flagged.

Copy link
Copy Markdown
Contributor Author

Good catch — pushed 722bb78 to capture RESULT_VARIABLE from the find/codesign invocation and abort with message(FATAL_ERROR ...) if signing fails, instead of continuing silently.


Generated by Claude Code

@timosachsenberg
timosachsenberg requested a review from poshul July 30, 2026 07:15
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@poshul @pjones This PR was generated automatically. Any insight on the issue?

@pjones

pjones commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

I'm afraid that I know nothing about package signing on macOS.

Is this a new issue caused by the recent merge of the release workflow, or has this been happening longer than that?

Copy link
Copy Markdown
Contributor Author

This has been broken since the Release workflow was introduced — not a regression from the merge into develop. Looking at the run history for release.yml, every run I can find going back to June 16 (via the pjones/release branch, before #9523 landed on develop) ends in failure, and the ones that got far enough all fail at the same "Notarize macOS Package" step with the same errors (e.g. this nightly run):

"message": "The binary is not signed with a valid Developer ID certificate."
"message": "The signature does not include a secure timestamp."

Root cause: cmake/package_mac_productbuild.cmake runs codesign --options runtime --timestamp for the Dependencies (TOPP binaries), library, and THIRDPARTY CPack components, but never for python_modules — the pyopenms extension .so files installed to DESTINATION pyopenms in src/pyOpenMS/CMakeLists.txt. productbuild packages python_modules into its own sub-.pkg, and since nothing ever signed those .so files, Apple's notarization service rejects the whole package. This PR adds the same signing step for that component that already exists for the others.


Generated by Claude Code

@jpfeuffer

Copy link
Copy Markdown
Contributor

I don't think the python modules should be part of the PKG at all. So just remove that/those targets as a packagable component.

…of signing it

Per @jpfeuffer's review feedback: the pyopenms Python extension modules
don't belong in the desktop application installer at all - they're
already shipped separately as wheels via
pyopenms-wheels-cibuildwheel.yml. The .deb/.rpm packages already
exclude the python_modules component (see package_deb.cmake /
package_rpm.cmake); only the macOS productbuild generator picked it up
by default because it never set CPACK_COMPONENTS_ALL.

Replace the codesign-it-instead approach from the previous commits with
an explicit exclusion, computed from CMake's global COMPONENTS property
so it stays in sync with whatever components actually exist rather than
a hardcoded list.

Copy link
Copy Markdown
Contributor Author

Makes sense — pushed 021fb28 to go that route instead.

The .deb/.rpm packages already exclude python_modules explicitly (cmake/package_deb.cmake / cmake/package_rpm.cmake both set CPACK_COMPONENTS_ALL to a fixed list that never included it). The macOS productbuild generator never set CPACK_COMPONENTS_ALL at all, so it defaulted to packaging every known component, including python_modules — that's why this only showed up here.

Rather than hardcode a component list (risky, since the set of thirdparty search-engine components varies per platform/run), I used get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) to grab CMake's own list of every component that got an install(... COMPONENT ...) call, then list(REMOVE_ITEM ... python_modules). That's called at the end of package_mac_productbuild.cmake, after every install() in the project (including src/pyOpenMS/CMakeLists.txt) has already registered its component, so it stays correct even as components are added/removed elsewhere. Reverted the codesign-the-component change from the earlier commits since it's no longer needed.


Generated by Claude Code

@timosachsenberg timosachsenberg changed the title [FIX] macOS package: codesign pyopenms .so files so notarization succeeds [FIX] macOS PKG: exclude pyopenms python_modules from the installer to fix notarization Jul 30, 2026
@pjones

pjones commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

So then this is probably caused by the fact that the new build workflow always includes -DPYOPENMS=ON.

Copy link
Copy Markdown
Contributor Author

Confirmed — .github/actions/build/action.yml:157 unconditionally passes -DPYOPENMS=ON, and that action is what both test.yml and release.yml (the new workflows from #9523) use to build. So on every macOS run of the new workflows, pyopenms gets built and installed into the python_modules component, and since productbuild had no CPACK_COMPONENTS_ALL restriction it always ended up in the .pkg. This PR's fix (excluding python_modules explicitly) means the packaging is correct regardless of whether -DPYOPENMS is on or off, so it shouldn't need to change in the build action itself.


Generated by Claude Code

@jpfeuffer

jpfeuffer commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Yes I think this can be merged. One thing to check. Do you really want to configure with pyopenms=On when you build an installer? I guess it depends. I think previously we auto-deactivated when pkging is on.
Of course this would mean if you want to save build time, you need to reconfigure after packaging is done. I think that is how we did it before. Can be done in many ways I guess.

Copy link
Copy Markdown
Contributor Author

Good point, and worth tracking, but I'd suggest keeping it out of this PR: this fix makes packaging correct regardless of whether -DPYOPENMS is on or off, so it's not blocking. Auto-deactivating (or reconfiguring) PYOPENMS based on PACKAGE_TYPE would be a build-time-only optimization, and it'd touch .github/actions/build/action.yml / CMakeLists.txt option logic shared by both test.yml and release.yml — I'd rather not bundle an unrelated build-time change into the fix for a currently-broken nightly CI without a maintainer weighing in on the preferred approach (e.g. skip the whole add_subdirectory(pyOpenMS) when PACKAGE_TYPE isn't "none", vs. reconfigure-before-packaging like before).

Happy to open a follow-up issue for it if you'd like, but leaving this PR scoped to just the notarization/packaging fix.


Generated by Claude Code

@timosachsenberg
timosachsenberg merged commit e7716da into develop Jul 30, 2026
34 checks passed
@timosachsenberg
timosachsenberg deleted the claude/laughing-wozniak-rjjrhf branch July 30, 2026 13:21
timosachsenberg added a commit that referenced this pull request Aug 3, 2026
…9835, #9836 (#9841)

Backfills the QPX export spec-conformance series, the macOS PKG
notarization fix, and the Windows GUI DLL export fix that merged into
develop without changelog entries. #9805 and #9821 were intentionally
skipped (test-only / comment-only, no user-visible behavior change),
and #9818 was already documented.


Claude-Session: https://claude.ai/code/session_0118Yt3TZEMzhMhH6FwZPDVt

Co-authored-by: Claude <[email protected]>
timosachsenberg added a commit that referenced this pull request Aug 3, 2026
Backfills CHANGELOG entries for three merged PRs not yet covered by
the recent #9826 backfill: the QPX feature/pg export spec-conformance
fix, the macOS installer notarization fix, and the Windows GUI DLL
export fix for Annotation1DItem.


Claude-Session: https://claude.ai/code/session_01RSKvhJ2dEd2zE4dohdv8af

Co-authored-by: Claude <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Aug 4, 2026
Two independent backfill commits (#9833 and #9841) each added an
entry for these three PRs, so every one of them was listed twice
with slightly different wording. Kept the more detailed version from
#9841 and dropped the duplicate.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016kxG5jpwHZaYGfrhU2wLHg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants