Request for comments: Multi-repository support for homebrew-alt
- From:
- Charlie Sharpsteen
- Date:
- 2011-03-27 @ 06:36
Hey everyone,
Since Adam started the homebrew-alt repository, we now have a great home for
system duplicates, past versions and other formulae that are not suitable
for the master branch for one reason or another. The alt repository also
simplifies matters by keeping these formula seperate from the Homebrew core
and Formula which makes them easier to track and manage. Forking Adam's
repository has also given me an excellent place to store oddball formula
that were unwieldy to maintain as branches of my homebrew fork.
Working with an alternate repository, I quickly felt the need for a tool
that would help me discover and clone repos and then run brew commands such
as install, options, info, etc against the formulae contained within. A
simple bash script that I wrote to fill this need evolved into a homebrew
external command that I think is getting close to pull request material.
The command is called `brew-tap` and is available in a branch of the same
name in my fork:
https://github.com/Sharpie/homebrew/tree/brew-tap
brew-tap offers a variety of subcommands for scanning the fork network of
Adam's homebrew-alt repository, cloning those forks and resolving formula
arguments to standard brew commands like 'install' to paths within the
cloned repositories. Things are definitely at a beta stage, but it works
well enough for my daily usage. One major limitation is that the tool does
not support dependency resolution outside of the formula provided by the
master repository---this seems to be a tricky problem and I haven't tackled
it yet.
Before I thing about submitting this tool in a pull request, I would love to
hear any comments concerning the implementation: things that are right,
things that are wrong, things that are missing, etc. Also, any bug reports
would be awesome.
Keep on brewin'!
-Charlie
Re: [homebrew] Request for comments: Multi-repository support for homebrew-alt
- From:
- Mike McQuaid
- Date:
- 2011-03-28 @ 20:00
On 27 Mar 2011, at 07:36, Charlie Sharpsteen wrote:
> Before I thing about submitting this tool in a pull request, I would
love to hear any comments concerning the implementation: things that are
right, things that are wrong, things that are missing, etc. Also, any bug
reports would be awesome.
Will try and look at this properly later but I think it should be
definitely linked from the wiki but possibly not included until we
actually have full multirepo support in Homebrew itself.
Thanks for your work Charlie!
--
Mike McQuaid
http://mikemcquaid.com
Re: [homebrew] Request for comments: Multi-repository support for homebrew-alt
- From:
- Charlie Sharpsteen
- Date:
- 2011-03-31 @ 22:00
On Mon, Mar 28, 2011 at 1:00 PM, Mike McQuaid <mike@mikemcquaid.com> wrote:
>
> On 27 Mar 2011, at 07:36, Charlie Sharpsteen wrote:
>
> > Before I thing about submitting this tool in a pull request, I would love
> to hear any comments concerning the implementation: things that are right,
> things that are wrong, things that are missing, etc. Also, any bug reports
> would be awesome.
>
> Will try and look at this properly later but I think it should be
> definitely linked from the wiki but possibly not included until we actually
> have full multirepo support in Homebrew itself.
>
When designing `brew-tap`, I tried to make the code compatible with the
Homebrew core. Most of the functionality is encapsulated in two classes:
The Brewery serves as an abstraction of a GitHub repository and the Taproom
controls a folder into which repositories can be cloned and manages the task
of matching formula names to brewfiles contained in the cloned repositories.
Combined with Adam's work on allowing `brew` to operate on arbitrary paths,
I feel this forms a pretty solid first attempt at multirepository
support---minus dependency resolution among external formulae.
If there are no projects currently underway to add multirepo support to
Homebrew, I would love to submit my work as a foundation for future efforts.
-Charlie
Re: [homebrew] Request for comments: Multi-repository support for homebrew-alt
- From:
- Charlie Sharpsteen
- Date:
- 2011-04-04 @ 05:03
Update: `brew-tap` now supports dependency resolution among alternate
formulae!
The solution I came up with scans formulae for dependencies of the form:
depends_on 'repo/[optional/subdirectories]/formula' => :alt
If a brewfile for the formula cannot be found, `brew-tap` attempts to clone
`repo` and performs the search again before giving up. An example of a
formula that uses such a dependency can be found in my homebrew-science
repository:
https://github.com/Sharpie/homebrew-science/blob/for-science/scientific/hdf-eos2.rb
Implementing this approach required one tiny 2-line change to the Homebrew
core in formula.rb so that `brew` will accept and ignore dependencies tagged
with `:alt` without throwing errors. So far, this is the only core change
required by `brew-tap`.
If this form of dependency resolution for alternate repositories works out,
I feel that `brew-tap` may be ready for inclusion as an external command.
-Charlie