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

Cleanup generate_keys and fix URLs for localized release notes #1664

Merged
merged 3 commits into from
Oct 13, 2020

Conversation

gwynne
Copy link
Contributor

@gwynne gwynne commented Oct 12, 2020

This PR includes the following changes:

  • generate_keys/main.swift reorganized somewhat and cleaned up significantly. The code has been heavily commented, failure messages are displayed consistently (and where the context allows, using ANSI color), error messages and informational text has been rewritten for grammar and clarity, and top-level code has been encapsulated in function context for consistency. The remaining vestiges of the abandoned "syncable keychain item" implementation have been removed.

  • generate_keys now has a "lookup mode", enabled by passing the -p flag on the command line. In this mode, generate_keys looks up whether a key already exists - if so, it outputs the public key as a single line of Base64 and immediately exits with success; if not, an error is printed and it exits with failure. This mode is intended to assist other tools and scripts in retrieving the public signing key automatically, without having to hardcode Sparkle's keychain matching parameters or any assumptions about how the data in the keychain item is laid out. An obvious use of this would be in a shell script Xcode build phase which automatically updates the value of SUPublicEDKey in an app's Info.plist.

  • generate_appcast now generates full URLs for links to localized release notes in an appcast, utilizing the same logic used to generate the link to "base" release notes (use a release notes URL prefix if specified, otherwise use the feed URL if available). Previously, localized release notes links would be specified only as filenames. Before:

<sparkle:releaseNotesLink>https://bucket.s3.amazonaws.com/release%20notes-123.html</sparkle:releaseNotesLink>
<sparkle:releaseNotesLink xml:lang="de">release notes-123.de.html</sparkle:releaseNotesLink>
<sparkle:releaseNotesLink xml:lang="zh">release notes-123.zh.html</sparkle:releaseNotesLink>

After:

<sparkle:releaseNotesLink>https://bucket.s3.amazonaws.com/release%20notes-123.html</sparkle:releaseNotesLink>
<sparkle:releaseNotesLink xml:lang="de">https://bucket.s3.amazonaws.com/release%20notes-123.de.html</sparkle:releaseNotesLink>
<sparkle:releaseNotesLink xml:lang="zh">https://bucket.s3.amazonaws.com/release%20notes-123.zh.html</sparkle:releaseNotesLink>

This change guarantees that localized release notes always load correctly when applicable even when their filenames contain otherwise problematic characters such as spaces - previously, in many cases they would simply fail to load.

gwynne added 3 commits October 6, 2020 07:54
… as full URLs instead of unescaped filenames. This makes them load reliably in complex contexts (such as the presence of characters like spaces in the filenames).
@kornelski
Copy link
Member

That's great. Thank you

@kornelski kornelski merged commit 94d0533 into sparkle-project:2.x Oct 13, 2020
@gwynne gwynne deleted the improve-generator-tools branch October 13, 2020 13:52
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.

2 participants