Add conflicts_with DSL method

conflicts_with is a thin wrapper around Requirement which simplifies
marking conflicts between formulae.

Closes #13687.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
This commit is contained in:
Misty De Meo committed 2012-07-30 13:47:12 -03:00
1 parent 08a18364e6
commit 2814e3a9fa
10 files changed
+69 -22

No files matched your search

+5 -2
View File
@@ -1,14 +1,17 @@
require 'formula'
class Mariadb < Formula
# You probably don't want to have this and MySQL's formula linked at the same time
# Just saying.
url 'http://ftp.osuosl.org/pub/mariadb/mariadb-5.3.7/kvm-tarbake-jaunty-x86/mariadb-5.3.7.tar.gz'
homepage 'http://mariadb.org/'
sha1 '1ee2ef4895aefabd66b4884c382ba2cd1f7bbe2d'
depends_on 'readline'
conflicts_with 'mysql',
:because => "mariadb and mysql install the same binaries."
conflicts_with 'percona-server',
:because => "mariadb and percona-server install the same binaries."
fails_with :clang do
build 318
end
+5
View File
@@ -10,6 +10,11 @@ class Mysql < Formula
depends_on 'readline'
depends_on 'pidof'
conflicts_with 'mariadb',
:because => "mysql and mariadb install the same binaries."
conflicts_with 'percona-server',
:because => "mysql and percona-server install the same binaries."
fails_with :llvm do
build 2326
cause "https://github.com/mxcl/homebrew/issues/issue/144"
+3
View File
@@ -5,6 +5,9 @@ class Par2 < Formula
url 'http://downloads.sourceforge.net/project/parchive/par2cmdline/0.4/par2cmdline-0.4.tar.gz'
sha1 '2fcdc932b5d7b4b1c68c4a4ca855ca913d464d2f'
conflicts_with "par2tbb",
:because => "par2 and par2tbb install the same binaries."
def patches
"http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/par2cmdline/files/par2cmdline-0.4-gcc4.patch?revision=1.1"
end
+5 -13
View File
@@ -1,12 +1,15 @@
require 'formula'
class Par2tbb < Formula
url 'http://chuchusoft.com/par2_tbb/par2cmdline-0.4-tbb-20100203.tar.gz'
homepage 'http://chuchusoft.com/par2_tbb/'
md5 'b1052a08c3c6eac8a7a0605addb161e7'
url 'http://chuchusoft.com/par2_tbb/par2cmdline-0.4-tbb-20100203.tar.gz'
sha1 '2fcdc932b5d7b4b1c68c4a4ca855ca913d464d2f'
depends_on 'tbb'
conficts_with "par2",
:because "par2tbb and par2 install the same binaries."
fails_with :clang do
build 318
end
@@ -21,11 +24,6 @@ class Par2tbb < Formula
# but only 10.6+ are available on Xcode4
inreplace 'Makefile.am', /^.*-mmacosx-version.*$/, ''
if Formula.factory('par2').installed?
opoo "par2tbb conflicts with par2. Your par2 binaries will be overwritten.
If this bothers you, you can restore par2 with `brew link par2`."
end
host_triplet = MacOS.prefer_64_bit? ? "x86_64-apple-darwin11" : "i686-apple-darwin11"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
@@ -34,12 +32,6 @@ class Par2tbb < Formula
system "make install"
end
def caveats
<<-EOS.undent
par2tbb is a modified fork of par2 and conflicts with its binaries.
EOS
end
def test
system "#{bin}/par2"
end
+5 -2
View File
@@ -6,12 +6,15 @@ class PerconaServer < Formula
version '5.5.25-27.1'
sha1 'f3388960311b159e46efd305ecdeb806fe2c7fdc'
keg_only "This brew conflicts with 'mysql'. It's safe to `brew link` if you haven't installed 'mysql'"
depends_on 'cmake' => :build
depends_on 'readline'
depends_on 'pidof'
conflicts_with 'mysql',
:because => "percona-server and mysql install the same binaries."
conflicts_with 'mariadb',
:because => "percona-server and mariadb install the same binaries."
skip_clean :all # So "INSTALL PLUGIN" can work.
fails_with :llvm do
+3 -5
View File
@@ -5,12 +5,10 @@ class Rarian < Formula
url 'http://rarian.freedesktop.org/Releases/rarian-0.8.1.tar.bz2'
md5 '75091185e13da67a0ff4279de1757b94'
def install
if Formula.factory('scrollkeeper').installed?
opoo "rarian conflicts with scrollkeeper. Your scrollkeeper binaries will be overwritten.
If this bothers you, you can restore scrollkeeper with `brew link scrollkeeper`."
end
conflicts_with 'scrollkeeper',
:because => "rarian and scrollkeeper install the same binaries."
def install
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
+3
View File
@@ -8,6 +8,9 @@ class Scrollkeeper < Formula
depends_on 'gettext'
depends_on 'docbook'
conflicts_with 'rarian',
:because => "scrollkeeper and rarian install the same binaries."
def install
system "./configure", "--prefix=#{prefix}",
"--mandir=#{man}",
+5
View File
@@ -68,6 +68,11 @@ module Homebrew extend self
end
puts "Depends on: #{f.deps*', '}" unless f.deps.empty?
conflicts = []
f.external_deps.each do |dep|
conflicts << dep.formula if dep.is_a? ConflictRequirement
end
puts "Conflicts with: #{conflicts*', '}" unless conflicts.empty?
if f.rack.directory?
kegs = f.rack.children
+20
View File
@@ -287,3 +287,23 @@ class MPIDependency < Requirement
end
end
class ConflictRequirement < Requirement
attr_reader :formula
def initialize formula, message
@formula = formula
@message = message
end
def message; @message; end
def satisfied?
keg = Formula.factory(@formula).prefix
not keg.exist? && Keg.new(keg).linked?
end
def fatal?
not ARGV.force?
end
end
+15
View File
@@ -626,6 +626,21 @@ private
dependencies.add(dep)
end
def conflicts_with formula, opts={}
message = <<-EOS.undent
#{formula} cannot be installed alongside #{name.downcase}.
EOS
message << "This is because #{opts[:reason]}\n" if opts[:reason]
if !ARGV.force? then message << <<-EOS.undent
Please `brew unlink` or `brew uninstall` #{formula} before continuing.
To install anyway, use:
brew install --force
EOS
end
dependencies.add ConflictRequirement.new(formula, message)
end
def skip_clean paths
if paths == :all
@skip_clean_all = true