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

use idiomatic location for security directory and update location of configuration directory #3942

Merged
merged 4 commits into from
Dec 16, 2021

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Dec 14, 2021

motivation: use idiomatic location for security directory on macOS

changes:

  • allow users to customize security directory location with new --security-path CLI option
  • on macOS use /Library/org.swiftpm/security for security files and symlink from ~/.swiftpm/security
  • move configuration directory from /Library/org.swiftpm to /Library/org.swiftpm/configuration
  • add migration code from old configuraiton location to new one
  • add and adjust tests
  • update docker setup for new locations

Sources/Commands/SwiftTool.swift Outdated Show resolved Hide resolved
Sources/Basics/FileSystem+Extensions.swift Outdated Show resolved Hide resolved
@neonichu
Copy link
Contributor

We're talking about ~/Library/org.swift.swiftpm, right? Or are we creating a second location?

Sources/Basics/FileSystem+Extensions.swift Outdated Show resolved Hide resolved
Sources/Basics/FileSystem+Extensions.swift Outdated Show resolved Hide resolved
Sources/Basics/FileSystem+Extensions.swift Outdated Show resolved Hide resolved
…configuration directory

motivation: use idiomatic location for security directory on macOS

changes:
* allow users to customize security directory location with new --security-path CLI option
* on macOS use <user>/Library/org.swiftpm/security for security files and symlink from ~/.swiftpm/security
* move configuration directory from <user>/Library/org.swiftpm to <user>/Library/org.swiftpm/configuration
* add migration code from old configuraiton location to new one
* add and adjust tests
* update docker setup for new locationis
Copy link
Contributor

@yim-lee yim-lee left a comment

Choose a reason for hiding this comment

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

Let's make sure source compat test passes before merging?

We can use: swiftlang/swift#40524

Sources/Basics/FileSystem+Extensions.swift Show resolved Hide resolved
@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

@swift-ci please smoke test

@tomerd tomerd changed the title use idiomatic location for security directory and update location of … use idiomatic location for security directory and update location of configuration directory Dec 15, 2021
@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

@yim-lee revised per discussion + addressed other comments

@tomerd tomerd added the ready Author believes the PR is ready to be merged & any feedback has been addressed label Dec 15, 2021
@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

We're talking about ~/Library/org.swift.swiftpm, right? Or are we creating a second location?

@neonichu @abertelrud we have been using ~/Library/org.swift.swiftpm for configuration files thus far, in practice only for storing collections.json. With the new TOFU feature now need a location for security related files. As such, this PR transitions the configuration files to ~/Library/org.swift.swiftpm/configuration and uses ~/Library/org.swift.swiftpm/security for the latter.

note the migration code does not delete / move the old files, it copies them from ~/Library/org.swift.swiftpm into ~/Library/org.swift.swiftpm/configuration such that moving back to older toolchain/Xcode does not break (although they would use different copies).

on non-Darwin platform this moves the configuration files from ~/.swiftpm/config to ~/.swiftpm/configuration so that the names are aligned on all platforms, this is done with similar preservation of old files for the same reason.

one nice thing with this is that it also matched the changes we made earlier this year moving the "local" (package root) <package-root>/.swiftpm/config file into <package-root>/.swiftpm/configuration/mirrors.json

wdyt?

@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

@swift-ci please smoke test

@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

Let's make sure source compat test passes before merging?

that test passed, so we should be good

@neonichu
Copy link
Contributor

neonichu commented Dec 15, 2021

We have to make sure that users understand that there are two different config files, right now we're only warning one time on copy, correct? I think we need to warn on load as long as both locations exist.

@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

We have to make sure that users understand that there are two different config files, right now we're only warning one time on copy, correct? I think we need to warn on load as long as both locations exist.

2ba88d3

@tomerd
Copy link
Contributor Author

tomerd commented Dec 15, 2021

@swift-ci please smoke test

@tomerd tomerd merged commit 739c587 into swiftlang:main Dec 16, 2021
tomerd added a commit to tomerd/swift-package-manager that referenced this pull request Dec 16, 2021
…configuration directory (swiftlang#3942)

motivation: use idiomatic location for security directory on macOS

changes:
* allow users to customize security directory location with new --security-path CLI option
* on macOS use <user>/Library/org.swiftpm/security for security files and symlink from ~/.swiftpm/security
* move configuration directory from <user>/Library/org.swiftpm to <user>/Library/org.swiftpm/configuration
* add migration code from old configuraiton location to new one
* add and adjust tests
* update docker setup for new locationis
tomerd added a commit that referenced this pull request Dec 17, 2021
…configuration directory (#3942)

motivation: use idiomatic location for security directory on macOS

changes:
* allow users to customize security directory location with new --security-path CLI option
* on macOS use <user>/Library/org.swiftpm/security for security files and symlink from ~/.swiftpm/security
* move configuration directory from <user>/Library/org.swiftpm to <user>/Library/org.swiftpm/configuration
* add migration code from old configuraiton location to new one
* add and adjust tests
* update docker setup for new locationis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants