Files
leonarski_fandClaude Opus 5.5 a45dcfee2e SPDX: compound expressions for adapted files, LicenseRef-HDF5, tags on untagged files
- Files adapted from other projects carry both licences: StrongPixelSet.cpp,
  SpotExtractorGPU.cu and the four GEMMI-derived structure_refinement files
  "GPL-3.0-only AND MPL-2.0"; FFBIDXIndexerCPU.cpp, LMSolver.{h,cpp} and
  xds-plugin/plugin.* "GPL-3.0-only AND BSD-3-Clause"; fpga/hls/parallel_stream.h
  "CERN-OHL-S-2.0 AND Apache-2.0"; fpga/hls/icmp.cpp and ip_header_checksum.h
  (HPCN UAM, with PSI modifications) "CERN-OHL-S-2.0 AND BSD-3-Clause".
- writer/H5FDpoison_sec2.{c,h} and tests/enospc_shim.c: "OR HDF5" is not an
  SPDX id; now "OR LicenseRef-HDF5", with the text named (licenses/hdf5.txt).
  The poison driver wraps the stock sec2 driver rather than copying it (only
  the H5FD_class_t initialiser layout matches H5FDsec2.c), so the files stay
  dual-licensed (OR), not derived (AND).
- 151 first-party files without a tag (CMake, shell, Python, frontend, docs
  JS, a few C++) get one: GPL-3.0-only, CERN-OHL-S-2.0 for fpga/, fpga/hls/
  and fpga/scripts/, with the copyright line of the neighbouring files and the
  year the file was added. Generated and vendored code is not touched;
  fpga/pcie_driver/postinstall.sh and preuninstall.sh are left untagged, as
  they say they are taken from a blog post.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
2026-11-15 16:18:09 +01:00

63 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
# SPDX-License-Identifier: GPL-3.0-only
# Notarize the macOS release artefacts with Apple and staple the ticket where one can be stapled.
#
# tools/notarize_macos.sh <jfjoch-viewer-*.dmg | rugnux-*.tar.gz> ...
#
# The programs inside must already carry a Developer ID signature with hardened runtime and secure
# timestamp: configure with -DJFJOCH_MACOS_SIGNING_IDENTITY=<certificate SHA-1> and let cpack produce
# the artefact (see the top-level CMakeLists.txt). The same certificate signs the .dmg here: the
# one JFJOCH_MACOS_SIGNING_IDENTITY names, else the Developer ID Application in the keychain. Needs
# notarytool credentials stored once on the machine, under the profile named by JFJOCH_NOTARY_PROFILE
# (default jfjoch-notary). On an unattended machine store them in the login keychain file: without
# --keychain they go into the data-protection keychain, which is unreadable while the screen is
# locked, and the step then fails with "No Keychain password item found".
#
# xcrun notarytool store-credentials jfjoch-notary --apple-id <apple id> --team-id <team id> \
# --keychain ~/Library/Keychains/login.keychain-db
#
# .dmg signed with the same Developer ID, submitted, the ticket stapled to the image.
# .tar.gz the rugnux binary inside is zipped and submitted; Apple then knows its hash, which is
# all Gatekeeper needs (a bare executable has nowhere to staple a ticket). The archive is
# shipped unchanged.
set -euo pipefail
profile=${JFJOCH_NOTARY_PROFILE:-jfjoch-notary}
identity=${JFJOCH_MACOS_SIGNING_IDENTITY:-$(security find-identity -v -p codesigning | sed -n 's/^ *[0-9]*) \([0-9A-F]*\) "Developer ID Application: .*/\1/p' | head -1)}
if [ -z "$identity" ]; then echo "no Developer ID Application identity in the keychain"; exit 1; fi
submit() { # submit <file>: wait for Apple's verdict, print the log on rejection
local out id status
out=$(xcrun notarytool submit "$1" --keychain-profile "$profile" --wait --output-format plist)
id=$(echo "$out" | plutil -extract id raw -)
status=$(echo "$out" | plutil -extract status raw -)
echo "notarization of $(basename "$1"): $status (submission $id)"
if [ "$status" != "Accepted" ]; then
xcrun notarytool log "$id" --keychain-profile "$profile"
exit 1
fi
}
for file in "$@"; do
case "$file" in
*.dmg)
codesign --force --timestamp --sign "$identity" "$file"
submit "$file"
xcrun stapler staple "$file"
spctl -a -t open --context context:primary-signature -v "$file"
;;
*.tar.gz|*.tgz)
tmp=$(mktemp -d)
tar xf "$file" -C "$tmp"
bin=$(find "$tmp" -name rugnux -type f)
ditto -c -k "$bin" "$tmp/rugnux.zip"
submit "$tmp/rugnux.zip"
rm -rf "$tmp"
;;
*)
echo "don't know how to notarize $file"; exit 1
;;
esac
done