-
Notifications
You must be signed in to change notification settings - Fork 63
Enhancements to the release build script #165
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
Merged
cmcgee1024
merged 8 commits into
swiftlang:main
from
cmcgee1024:release-script-enhancement
Oct 18, 2024
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5237b8e
Enhancements to the release build script
cmcgee1024 2a8b985
Add license files to the Linux release archive
cmcgee1024 6002287
Add license files to macOS pkg bundle
cmcgee1024 a9a796a
Update the releasing document with the new release instructions
cmcgee1024 2bbd1ec
Update the self-update logic to work with new the release artifacts a…
cmcgee1024 13a4b32
Fix mock and adapt to swift.org API change
cmcgee1024 beec426
Import GPG keys on every install to get new signing keys from swift.org
cmcgee1024 da04070
Remove universal check for the macOS release build system requirement…
cmcgee1024 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,44 +193,21 @@ public struct Linux: Platform { | |
| throw Error(message: msg) | ||
| } | ||
|
|
||
| let foundKeys = (try? self.runProgram( | ||
| "gpg", | ||
| "--list-keys", | ||
| "[email protected]", | ||
| "[email protected]", | ||
| quiet: true | ||
| )) != nil | ||
| if !foundKeys { | ||
| // Import the swift keys if they aren't here already | ||
| // Import the latest swift keys, but only once per session, which will help with the performance in tests | ||
| if !swiftGPGKeysRefreshed { | ||
| let tmpFile = self.getTempFilePath() | ||
| FileManager.default.createFile(atPath: tmpFile.path, contents: nil, attributes: [.posixPermissions: 0o600]) | ||
| defer { | ||
| try? FileManager.default.removeItem(at: tmpFile) | ||
| } | ||
|
|
||
| guard let url = URL(string: "https://swift.org/keys/all-keys.asc") else { | ||
| guard let url = URL(string: "https://www.swift.org/keys/all-keys.asc") else { | ||
| throw Error(message: "malformed URL to the swift gpg keys") | ||
| } | ||
|
|
||
| try await httpClient.downloadFile(url: url, to: tmpFile) | ||
| try self.runProgram("gpg", "--import", tmpFile.path, quiet: true) | ||
| } | ||
|
|
||
| // We only need to refresh the keys once per session, which will help with performance in tests | ||
| if !swiftGPGKeysRefreshed { | ||
| SwiftlyCore.print("Refreshing Swift PGP keys...") | ||
| do { | ||
| try self.runProgram( | ||
| "gpg", | ||
| "--quiet", | ||
| "--keyserver", | ||
| "hkp://keyserver.ubuntu.com", | ||
| "--refresh-keys", | ||
| "Swift" | ||
| ) | ||
| } catch { | ||
| throw Error(message: "Failed to refresh PGP keys: \(error)") | ||
| } | ||
| swiftGPGKeysRefreshed = true | ||
| } | ||
| } | ||
|
|
@@ -290,6 +267,23 @@ public struct Linux: Platform { | |
| } | ||
| } | ||
|
|
||
| public func extractSwiftlyAndInstall(from archive: URL) throws { | ||
| guard archive.fileExists() else { | ||
| throw Error(message: "\(archive) doesn't exist") | ||
| } | ||
|
|
||
| let tmpDir = self.getTempFilePath() | ||
| try FileManager.default.createDirectory(atPath: tmpDir.path, withIntermediateDirectories: true) | ||
|
|
||
| SwiftlyCore.print("Extracting new swiftly...") | ||
| try extractArchive(atPath: archive) { name in | ||
| // Extract to the temporary directory | ||
| tmpDir.appendingPathComponent(String(name)) | ||
| } | ||
|
|
||
| try self.runProgram(tmpDir.appendingPathComponent("swiftly").path, "init") | ||
| } | ||
|
|
||
| public func uninstall(_ toolchain: ToolchainVersion) throws { | ||
| let toolchainDir = self.swiftlyToolchainsDir.appendingPathComponent(toolchain.name) | ||
| try FileManager.default.removeItem(at: toolchainDir) | ||
|
|
@@ -410,7 +404,7 @@ public struct Linux: Platform { | |
| do { | ||
| try self.runProgram("gpg", "--verify", sigFile.path, archive.path) | ||
| } catch { | ||
| throw Error(message: "Toolchain signature verification failed: \(error).") | ||
| throw Error(message: "Signature verification failed: \(error).") | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we are only building for Amazon Linux 2 image compared to all platforms? Also, should we use static sdk to build for multiple platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazon Linux 2 has the oldest glibc of the supported Linux distributions, so compiling with it will help guarantee binary compatibility with the rest. We have an issue open to use static Linux sdk / musl #119 for a future release. In the meantime time, the release needs to be made from AL2.