-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
mysql: improve warnings when data directory is present. #60190
Closed
Closed
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
75c610a
[email protected]: Improve warnings when data directory is present.
peterb b9194c5
Pseudocode of what this should do.
peterb 4497d80
Add note about 5.6 changes which are also required.
peterb f5c2c71
Move pseudocode to comments and flesh out some working code.
peterb 943133e
Detect MySQL 5.6, refactor.
peterb a5ce548
Fix style issues.
peterb 6992d7a
MySQL 5.6 formula installation directory.
peterb ab78b97
Remove pseudocode.
peterb 17eb945
Add note about removing mysqlbug
peterb ee744af
Remove deprecated mysqlbug utility as it contains shims.
peterb 56d318b
Use tmpdir for socket in test.
peterb 93b8b07
Add notes on another ways of checking which the mysql version.
peterb e6936de
Update Formula/[email protected]
peterb 2dd4960
Simply legacy mysql formulae by specifying a separate data directory
peterb 94610a2
Merge branch 'patch-2' of https://github.com/peterb/homebrew-core int…
peterb d61101d
Remove custom socket as it appears that the CI error is unrelated.
peterb 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 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 |
---|---|---|
|
@@ -22,7 +22,19 @@ class MysqlAT56 < Formula | |
depends_on "[email protected]" | ||
|
||
def datadir | ||
var/"mysql" | ||
return var/"mysql" if default_datadir_already_in_use_by_this_version? | ||
|
||
var/"mysql56" | ||
end | ||
|
||
# TODO: Could also try running file on files in var/*.frm if they exist | ||
# e.g. | ||
# peter@Peters-iMac homebrew-core % file /usr/local/var/mysql56/mysql/columns_priv.frm | ||
# /usr/local/var/mysql56/mysql/columns_priv.frm: MySQL table definition file Version 9, | ||
# type MYISAM, MySQL version 50647 | ||
# | ||
def default_datadir_already_in_use_by_this_version? | ||
(var/"mysql").exist? && var.glob("mysql/*.dblwr").empty? && (var/"mysql/test").exist? | ||
end | ||
|
||
def install | ||
|
@@ -62,6 +74,9 @@ def install | |
system "./mysql-test-run.pl", "status", "--vardir=#{Dir.mktmpdir}" | ||
end | ||
|
||
# Remove deprecated bug reporting tool | ||
rm prefix/"bin/mysqlbug" | ||
|
||
# Remove the tests directory | ||
rm_rf prefix/"mysql-test" | ||
|
||
|
This file contains 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
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.
Think it's enough to just check for
(var/"mysql").exist?
?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.
Could also output something in the
caveats
based on this?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.
Sounds good, I think that a simpler check and a caveat explaining the location of the datadir to the user would be preferable to trying to work it out automatically for them. I'll modify as you suggest.
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.
Update: It turns out this is harder to do than I expected, as putting a conditional in the
datadir
method means it gets evaluated differently during various stages in the formula.