aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/disco.rb92
-rw-r--r--Library/Formula/discodex.rb16
2 files changed, 79 insertions, 29 deletions
diff --git a/Library/Formula/disco.rb b/Library/Formula/disco.rb
index 2efe7bc69..d45bebbd3 100644
--- a/Library/Formula/disco.rb
+++ b/Library/Formula/disco.rb
@@ -1,52 +1,86 @@
require 'formula'
class Disco < Formula
- homepage 'http://discoproject.com/'
- url 'https://github.com/tuulos/disco/archive/0.3.2.tar.gz'
- sha1 'c6e698d0ec1c73b55597251038ee20d9b8e5c289'
+ homepage 'http://discoproject.org/'
+ url 'https://github.com/discoproject/disco/archive/0.4.5.tar.gz'
+ sha1 'c098ad91aa1a0676944c5548f8f860fb9b223002'
# Periods in the install path cause disco-worker to complain so change to underscores.
- version '0_3_2'
- head 'https://github.com/tuulos/disco.git'
+ version '0_4_5'
depends_on 'erlang'
depends_on 'simplejson' => :python if MacOS.version == :leopard
depends_on 'libcmph'
+ def patches
+ # Modifies config for single-node operation
+ DATA
+ end
+
def install
inreplace "Makefile" do |s|
- s.change_make_var! "DESTDIR", prefix
- s.change_make_var! "PREFIX", ""
- s.change_make_var! "DISCO_ROOT", "#{var}/disco/"
+ s.change_make_var! "prefix", prefix
+ s.change_make_var! "sysconfdir", etc
+ s.change_make_var! "localstatedir", var
end
- # add some helpful config for local development
- inreplace "conf/gen.settings.sys-Darwin" do |s|
- s.gsub! "${DESTDIR}", HOMEBREW_PREFIX
- s.gsub! "DDFS_TAG_MIN_REPLICAS = 3", "DDFS_TAG_MIN_REPLICAS = 1"
- s.gsub! "DDFS_TAG_REPLICAS = 3", "DDFS_TAG_REPLICAS = 1"
- s.gsub! "DDFS_BLOB_REPLICAS = 3", "DDFS_BLOB_REPLICAS = 1\n" +
- "DISCO_MASTER_HOST = 'localhost'\n" +
- "DISCODEX_HOME = os.path.join(os.path.dirname(DISCO_HOME), 'discodex')"
- end
+ # Support for setup.py, which is called from within the Makefile
+ temp_site_packages = lib/which_python/'site-packages'
+ mkdir_p temp_site_packages
+ ENV['PYTHONPATH'] = temp_site_packages
+ py_install_opts = "--verbose --force --install-scripts=#{bin} " +
+ "--install-lib=#{temp_site_packages} --install-data=#{share} --install-headers=#{include}"
+
+ # Disco's "rebar" build tool refuses to build unless it's in a git repo, so
+ # make a dummy one
+ system "git init && git add master/rebar && git commit -a -m 'dummy commit'"
system "make"
- system "make install"
- ENV.delete('CC')
- system "make install-discodb install-discodex"
- bin.install %w[contrib/discodex/bin/discodex contrib/discodex/bin/discodexcli.py]
- prefix.install %w[contrib doc examples node]
+ system "make install PY_INSTALL_OPTS='#{py_install_opts}'"
+ prefix.install %w[contrib doc examples]
+
+ # Fix the config file to point at the linked files, not in to cellar
+ # This isn't ideal - if there's a settings.py file left over from a previous disco
+ # installation, it'll issue a Warning
+ inreplace "#{etc}/disco/settings.py" do |s|
+ s.gsub!("Cellar/disco/"+version+"/", "")
+ end
+
end
- def caveats; <<-EOS.undent
- Please symlink #{etc}/disco/settings.py to ~/.disco and edit accordingly:
- ln -s #{etc}/disco/settings.py ~/.disco
- To run the discodex server for development:
- cd #{opt_prefix}/contrib/discodex/www
- ./manage.py runserver 8080
+ def which_python
+ # Update this once we have something like [this](https://github.com/mxcl/homebrew/issues/11204)
+ "python" + `python -c 'import sys;print(sys.version[:3])'`.strip
+ end
+
+ def caveats; <<-EOS.undent
+ Disco is a Python script. You must install homebrew's python or add the path
+ #{HOMEBREW_PREFIX}/lib/python2.7/site-packages
+ to your PYTHONPATH before running disco or ddfs.
+ Please copy #{etc}/disco/settings.py to ~/.disco and edit it if necessary.
The DDFS_*_REPLICA settings have been set to 1 assuming a single-machine install.
- Please see http://discoproject.org/doc/start/install.html for further instructions.
+ Please see http://discoproject.org/doc/disco/start/install.html for further instructions.
EOS
end
end
+
+__END__
+diff -rupN disco-0.4.5/conf/gen.settings.sh my-edits/disco-0.4.5/conf/gen.settings.sh
+--- disco-0.4.5/conf/gen.settings.sh 2013-03-28 12:21:30.000000000 -0400
++++ my-edits/disco-0.4.5/conf/gen.settings.sh 2013-04-10 23:10:00.000000000 -0400
+@@ -23,8 +23,11 @@ DISCO_PORT = 8989
+ # DISCO_PROXY_ENABLED = "on"
+ # DISCO_HTTPD = "/usr/sbin/varnishd -a 0.0.0.0:\$DISCO_PROXY_PORT -f \$DISCO_PROXY_CONFIG -P \$DISCO_PROXY_PID -n/tmp -smalloc"
+
+-DDFS_TAG_MIN_REPLICAS = 3
+-DDFS_TAG_REPLICAS = 3
+-DDFS_BLOB_REPLICAS = 3
++# Settings appropriate for single-node operation
++DDFS_TAG_MIN_REPLICAS = 1
++DDFS_TAG_REPLICAS = 1
++DDFS_BLOB_REPLICAS = 1
++
++DISCO_MASTER_HOST = "localhost"
+
+ EOF
diff --git a/Library/Formula/discodex.rb b/Library/Formula/discodex.rb
new file mode 100644
index 000000000..bcbe498a1
--- /dev/null
+++ b/Library/Formula/discodex.rb
@@ -0,0 +1,16 @@
+require 'formula'
+
+class Discodex < Formula
+ homepage 'https://github.com/discoproject/discodex'
+ url 'https://github.com/discoproject/discodex/archive/fa3fa57aa9fcd9c2bd3b4cd2233dc0d051dafc2b.tar.gz'
+ version '2012-01-10' # No tags in the project; using date of last commit as a proxy
+ sha1 '03a9ce7a8d70c371f4dd3ce2a1e2c72cda1fc1f4'
+
+ depends_on 'disco'
+
+ def install
+ # The make target only installs python libs; must manually install the rest
+ system "make", "install", "prefix=#{prefix}"
+ prefix.install(%w[bin doc])
+ end
+end