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

brew-check-for-deleted: support one repo workflow #133

Merged
merged 1 commit into from Jan 5, 2020

Conversation

@dawidd6
Copy link
Member

dawidd6 commented Jan 4, 2020

With this change, it is possible to make use of homebrew/master branch (which we already have set up for merges).

If no parameters are passed to the script, it checks out homebrew/master branch to get the list of available formulae in homebrew-core, then switches to master to get the list of formulae from linuxbrew-core while excluding those linux specific ones.

I tried not to break the existing functionality and it seems to be kept.

end

def linux_only?(formula)
File.open("#{linuxbrew_repo_dir}/Formula/#{formula}").grep("# tag \"linux").any?

This comment has been minimized.

Copy link
@dawidd6

dawidd6 Jan 4, 2020

Author Member

This grep line wasn't working for me.

Copy link
Member

issyl0 left a comment

Thanks! The git way does make more sense!

EDIT: I can't read code at this time of night.

def homebrew_core_formulae
@homebrew_core_formulae ||= Dir.entries("#{homebrew_repo_dir}/Formula").reject! { |f| File.directory?(f) }.sort
def homebrew_repo_dir
@homebrew_repo_dir ||= ARGV.value("homebrew-repo-dir") || ENV["HOMEBREW_REPO_DIR"] || CoreTap.instance.path

This comment has been minimized.

Copy link
@issyl0

issyl0 Jan 4, 2020

Member
Suggested change
@homebrew_repo_dir ||= ARGV.value("homebrew-repo-dir") || ENV["HOMEBREW_REPO_DIR"] || CoreTap.instance.path
@homebrew_repo_dir ||= ARGV.value("homebrew-repo-dir") || CoreTap.instance.path

Not sure we need the envvar now - I think that's just too many different ways? Having thought about it some more, ,the git solution is better, and if people (erm, me) want other ways then the args are easy enough.

This comment has been minimized.

Copy link
@dawidd6

dawidd6 Jan 5, 2020

Author Member

Done.

end

odie "Specify the location of Homebrew/homebrew-core on your machine with `--homebrew-repo-dir` or `HOMEBREW_REPO_DIR`." unless homebrew_repo_dir
def linuxbrew_core_formulae
quiet_system("git", "-C", homebrew_repo_dir, "checkout", "master") if git?

This comment has been minimized.

Copy link
@issyl0

issyl0 Jan 4, 2020

Member

Oh, heh, it switches to master. That explains it. I was caught out by the - on the other checkout lines. 🙄

@issyl0
issyl0 approved these changes Jan 4, 2020
Copy link
Member

issyl0 left a comment

There's a tiny adjustment on the number of available ways to specify the Homebrew repo dir, but LGTM!

@dawidd6 dawidd6 force-pushed the dawidd6:check branch from 6bb8151 to 6ba1aea Jan 5, 2020
@dawidd6

This comment has been minimized.

Copy link
Member Author

dawidd6 commented Jan 5, 2020

Thanks for review @issyl0.

I also added some info about the behavior of the script when no arguments are passed.

@dawidd6 dawidd6 merged commit 9b111ea into Homebrew:master Jan 5, 2020
1 check passed
1 check passed
test
Details
@dawidd6 dawidd6 deleted the dawidd6:check branch Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.