Skip to content
This repository
Browse code

Shore up a number of shell quoting issues

When interpolating in strings passed to Formula#system, it should be
done in such a way that if any interpolated variables contain spaces,
they are either (a) passed as part of a list or (b) protected by quotes
if they are part of a long string (which is subject to shell expansion).
Otherwise, they will be split on the space when expanded by the shell
and passed as multiple arguments to whatever process is being executed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
commit 417d7880702a645a5efd272a42dd03a8e7419035 1 parent 5d32174
Jack Nagel authored May 15, 2012

Showing 75 changed files with 110 additions and 104 deletions. Show diff stats Hide diff stats

  1. 6  Library/Formula/abcde.rb
  2. 2  Library/Formula/asciitex.rb
  3. 2  Library/Formula/assimp.rb
  4. 6  Library/Formula/audiofile.rb
  5. 2  Library/Formula/avanor.rb
  6. 2  Library/Formula/bibutils.rb
  7. 2  Library/Formula/camlp5.rb
  8. 2  Library/Formula/catdoc.rb
  9. 5  Library/Formula/cd-discid.rb
  10. 2  Library/Formula/cfitsio.rb
  11. 2  Library/Formula/chuck.rb
  12. 2  Library/Formula/clam.rb
  13. 2  Library/Formula/clay.rb
  14. 2  Library/Formula/clhep.rb
  15. 4  Library/Formula/couchdb-lucene.rb
  16. 2  Library/Formula/daemon.rb
  17. 2  Library/Formula/direnv.rb
  18. 2  Library/Formula/dnsmasq.rb
  19. 2  Library/Formula/dvtm.rb
  20. 2  Library/Formula/dwm.rb
  21. 2  Library/Formula/eigen.rb
  22. 8  Library/Formula/freeimage.rb
  23. 2  Library/Formula/git-sh.rb
  24. 2  Library/Formula/git-url-sub.rb
  25. 2  Library/Formula/gitslave.rb
  26. 2  Library/Formula/httping.rb
  27. 2  Library/Formula/innotop.rb
  28. 2  Library/Formula/iodine.rb
  29. 2  Library/Formula/ioping.rb
  30. 2  Library/Formula/jbigkit.rb
  31. 2  Library/Formula/john.rb
  32. 2  Library/Formula/jruby.rb
  33. 2  Library/Formula/lasi.rb
  34. 2  Library/Formula/latex2rtf.rb
  35. 2  Library/Formula/lcov.rb
  36. 2  Library/Formula/ledger.rb
  37. 5  Library/Formula/ledit.rb
  38. 2  Library/Formula/libmusicbrainz.rb
  39. 2  Library/Formula/libplist.rb
  40. 2  Library/Formula/libutf.rb
  41. 2  Library/Formula/magit.rb
  42. 2  Library/Formula/mg.rb
  43. 2  Library/Formula/mhash.rb
  44. 2  Library/Formula/mkvtoolnix.rb
  45. 2  Library/Formula/mongrel2.rb
  46. 2  Library/Formula/mupdf.rb
  47. 2  Library/Formula/mytop.rb
  48. 2  Library/Formula/nacl.rb
  49. 6  Library/Formula/noweb.rb
  50. 6  Library/Formula/nss.rb
  51. 4  Library/Formula/num-utils.rb
  52. 2  Library/Formula/o-make.rb
  53. 2  Library/Formula/objective-caml.rb
  54. 2  Library/Formula/opentracker.rb
  55. 2  Library/Formula/parmetis.rb
  56. 2  Library/Formula/percona-toolkit.rb
  57. 12  Library/Formula/polipo.rb
  58. 2  Library/Formula/poppler.rb
  59. 2  Library/Formula/putty.rb
  60. 2  Library/Formula/pyside.rb
  61. 2  Library/Formula/qhull.rb
  62. 2  Library/Formula/rakudo-star.rb
  63. 11  Library/Formula/sbcl.rb
  64. 2  Library/Formula/sc68.rb
  65. 3  Library/Formula/sedna.rb
  66. 2  Library/Formula/sigar.rb
  67. 2  Library/Formula/sipp.rb
  68. 2  Library/Formula/tabbed.rb
  69. 2  Library/Formula/unifdef.rb
  70. 8  Library/Formula/vtk.rb
  71. 2  Library/Formula/wxmac.rb
  72. 2  Library/Formula/xmp.rb
  73. 2  Library/Formula/xspringies.rb
  74. 4  Library/Formula/zeromq.rb
  75. 6  Library/Formula/zint.rb
6  Library/Formula/abcde.rb
@@ -14,8 +14,8 @@ class Abcde < Formula
14 14
   depends_on 'mkcue'
15 15
 
16 16
   def install
17  
-    # Makefile hardcodes installing files owned by root; don't do this.
18  
-    inreplace 'Makefile', '-o 0', ''
19  
-    system "export prefix=#{prefix};export DESTDIR=$prefix;make -e install"
  17
+    bin.install 'abcde', 'cddb-tool'
  18
+    etc.install 'abcde.conf' unless (etc/'abcde.conf').exist?
  19
+    man1.install 'abcde.1', 'cddb-tool.1'
20 20
   end
21 21
 end
2  Library/Formula/asciitex.rb
@@ -13,6 +13,6 @@ def install
13 13
   end
14 14
 
15 15
   def test
16  
-    system "#{bin}/asciiTeX -f #{prefix}/EXAMPLES"
  16
+    system "#{bin}/asciiTeX", "-f", "#{prefix}/EXAMPLES"
17 17
   end
18 18
 end
2  Library/Formula/assimp.rb
@@ -14,6 +14,6 @@ def install
14 14
   end
15 15
 
16 16
   def test
17  
-    system "#{bin}/assimp version"
  17
+    system "#{bin}/assimp", "version"
18 18
   end
19 19
 end
6  Library/Formula/audiofile.rb
@@ -47,9 +47,9 @@ def test
47 47
     end
48 48
 
49 49
     mktemp do
50  
-      system "#{conv_bin} #{inn} #{out} format wave"
51  
-      system "#{info_bin} --short --reporterror #{out}"
52  
-      system "#{hear_bin} -p #{out}" if ARGV.verbose?
  50
+      system conv_bin, inn, out, 'format', 'wave'
  51
+      system info_bin, '--short', '--reporterror', out
  52
+      system hear_bin, '-p', out if ARGV.verbose?
53 53
     end
54 54
   end
55 55
 end
2  Library/Formula/avanor.rb
@@ -11,7 +11,7 @@ def install
11 11
       s.gsub! "LD = gpp", "LD = cpp"
12 12
     end
13 13
 
14  
-    system "make DATA_DIR=#{share}/avanor/"
  14
+    system "make", "DATA_DIR=#{share}/avanor/"
15 15
     bin.install "avanor"
16 16
     (share+"avanor").install "manual"
17 17
   end
2  Library/Formula/bibutils.rb
@@ -6,7 +6,7 @@ class Bibutils < Formula
6 6
   md5 '395f46393eca8e184652c5e8e1ae83b6'
7 7
 
8 8
   def install
9  
-    system "./configure --install-dir #{prefix}"
  9
+    system "./configure", "--install-dir", prefix
10 10
 
11 11
     # The configure script replaces the CC variable wrong, so fix it here
12 12
     inreplace 'Makefile' do |s|
2  Library/Formula/camlp5.rb
@@ -20,7 +20,7 @@ def install
20 20
       strictness = "-transitional"
21 21
     end
22 22
 
23  
-    system "./configure -prefix #{prefix} -mandir #{man} #{strictness}"
  23
+    system "./configure", "-prefix", prefix, "-mandir", man, strictness
24 24
     # this build fails if jobs are parallelized
25 25
     ENV.deparallelize
26 26
     system "make world.opt"
2  Library/Formula/catdoc.rb
@@ -8,7 +8,7 @@ class Catdoc < Formula
8 8
   def install
9 9
     # catdoc configure says it respects --mandir=, but does not.
10 10
     ENV['man1dir'] = man1
11  
-    system "./configure --disable-debug --disable-dependency-tracking --prefix=#{prefix}"
  11
+    system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}"
12 12
     # The INSTALL file confuses make on case insensitive filesystems.
13 13
     system "mv INSTALL INSTALL.txt"
14 14
     system "make"
5  Library/Formula/cd-discid.rb
@@ -12,6 +12,9 @@ def patches
12 12
   end
13 13
 
14 14
   def install
15  
-    system "export prefix=#{prefix}; make -e install"
  15
+    system "make", "prefix=#{prefix}",
  16
+                   "CC=#{ENV.cc}",
  17
+                   "CFLAGS=#{ENV.cflags}",
  18
+                   "install"
16 19
   end
17 20
 end
2  Library/Formula/cfitsio.rb
@@ -31,7 +31,7 @@ def install
31 31
         Dir['*.c'].each do |f|
32 32
           # compressed_fits.c does not work (obsolete function call)
33 33
           next if f == 'compress_fits.c'
34  
-          system "#{ENV.cc} #{f} -I#{include} -L#{lib} -lcfitsio -lm -o bin/#{f.sub('.c','')}"
  34
+          system ENV.cc, f, "-I#{include}", "-L#{lib}", "-lcfitsio", "-lm", "-o", "bin/#{f.sub('.c', '')}"
35 35
         end
36 36
         bin.install Dir['bin/*']
37 37
       end
2  Library/Formula/chuck.rb
@@ -6,7 +6,7 @@ class Chuck < Formula
6 6
   md5 'ac8459b4067c2491fbdeb61d122a5985'
7 7
 
8 8
   def install
9  
-    system "make -C src/ osx-#{Hardware.cpu_type}"
  9
+    system "make", "-C", "src", "osx-#{Hardware.cpu_type}"
10 10
     bin.install "src/chuck"
11 11
     (share+'chuck').install "examples/"
12 12
   end
2  Library/Formula/clam.rb
@@ -16,7 +16,7 @@ class Clam < Formula
16 16
   depends_on 'id3lib'
17 17
 
18 18
   def install
19  
-    system "scons configure prefix=#{prefix} with_ladspa=no xmlbackend=none"
  19
+    system "scons", "configure", "prefix=#{prefix}", "with_ladspa=no", "xmlbackend=none"
20 20
     system "scons"
21 21
     system "scons install"
22 22
   end
2  Library/Formula/clay.rb
@@ -16,6 +16,6 @@ def install
16 16
   end
17 17
 
18 18
   def test
19  
-    system "#{bin}/clay -e 'println(\"Hello, Clay!\");'"
  19
+    system "#{bin}/clay", "-e", "println(\"Hello, Clay!\");"
20 20
   end
21 21
 end
2  Library/Formula/clhep.rb
@@ -9,7 +9,7 @@ class Clhep < Formula
9 9
 
10 10
   def install
11 11
     mkdir 'clhep-build' do
12  
-      system "cmake #{std_cmake_parameters} -DCMAKE_PREFIX_PATH=#{prefix} ../CLHEP"
  12
+      system "cmake #{std_cmake_parameters} -DCMAKE_PREFIX_PATH='#{prefix}' ../CLHEP"
13 13
       system "make install"
14 14
     end
15 15
   end
4  Library/Formula/couchdb-lucene.rb
@@ -11,8 +11,8 @@ class CouchdbLucene < Formula
11 11
   def install
12 12
     system "mvn"
13 13
 
14  
-    system "tar -xzf target/couchdb-lucene-#{version}-dist.tar.gz"
15  
-    system "mv couchdb-lucene-#{version}/* #{prefix}"
  14
+    system "tar", "-xzf", "target/couchdb-lucene-#{version}-dist.tar.gz"
  15
+    prefix.install Dir["couchdb-lucene-#{version}/*"]
16 16
 
17 17
     (etc + "couchdb/local.d/couchdb-lucene.ini").write ini_file
18 18
     plist_path.write startup_plist
2  Library/Formula/daemon.rb
@@ -8,7 +8,7 @@ class Daemon < Formula
8 8
   def install
9 9
     system "./config"
10 10
     system "make"
11  
-    system "make PREFIX=#{prefix} install"
  11
+    system "make", "PREFIX=#{prefix}", "install"
12 12
   end
13 13
 
14 14
   def test
2  Library/Formula/direnv.rb
@@ -8,7 +8,7 @@ class Direnv < Formula
8 8
   head 'https://github.com/zimbatm/direnv.git'
9 9
 
10 10
   def install
11  
-    system "make install DESTDIR=#{prefix}"
  11
+    system "make", "install", "DESTDIR=#{prefix}"
12 12
   end
13 13
 
14 14
   def caveats; <<-EOS.undent
2  Library/Formula/dnsmasq.rb
@@ -28,7 +28,7 @@ def install
28 28
       s.change_make_var! "CFLAGS", ENV.cflags
29 29
     end
30 30
 
31  
-    system "make install PREFIX=#{prefix}"
  31
+    system "make", "install", "PREFIX=#{prefix}"
32 32
 
33 33
     prefix.install "dnsmasq.conf.example"
34 34
     plist_path.write startup_plist
2  Library/Formula/dvtm.rb
@@ -9,6 +9,6 @@ class Dvtm < Formula
9 9
   def install
10 10
     inreplace 'config.mk', 'LIBS = -lc -lutil -lncursesw', 'LIBS = -lc -lutil -lncurses'
11 11
     inreplace 'Makefile', 'strip -s', 'strip'
12  
-    system "make PREFIX=#{prefix} install"
  12
+    system "make", "PREFIX=#{prefix}", "install"
13 13
   end
14 14
 end
2  Library/Formula/dwm.rb
@@ -13,7 +13,7 @@ def install
13 13
     '{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },',
14 14
     '{ MODKEY|ControlMask,           XK_q,      quit,           {0} },'
15 15
     inreplace 'dwm.1', '.B Mod1\-Shift\-q', '.B Mod1\-Control\-q'
16  
-    system "make PREFIX=#{prefix} install"
  16
+    system "make", "PREFIX=#{prefix}", "install"
17 17
   end
18 18
 
19 19
   def caveats
2  Library/Formula/eigen.rb
@@ -10,7 +10,7 @@ class Eigen < Formula
10 10
   def install
11 11
     ENV.fortran
12 12
     mkdir 'eigen-build' do
13  
-      system "cmake #{std_cmake_parameters} -DCMAKE_BUILD_TYPE=Release -Dpkg_config_libdir=#{lib} .."
  13
+      system "cmake #{std_cmake_parameters} -DCMAKE_BUILD_TYPE=Release -Dpkg_config_libdir='#{lib}' .."
14 14
       system "make install"
15 15
     end
16 16
   end
8  Library/Formula/freeimage.rb
@@ -25,10 +25,10 @@ def patches
25 25
 
26 26
   def install
27 27
     ENV.universal_binary if ARGV.build_universal?
28  
-    system "gnumake -f Makefile.gnu"
29  
-    system "gnumake -f Makefile.gnu install PREFIX=#{prefix}"
30  
-    system "gnumake -f Makefile.fip"
31  
-    system "gnumake -f Makefile.fip install PREFIX=#{prefix}"
  28
+    system "make", "-f", "Makefile.gnu"
  29
+    system "make", "-f", "Makefile.gnu", "install", "PREFIX=#{prefix}"
  30
+    system "make", "-f", "Makefile.fip"
  31
+    system "make", "-f", "Makefile.fip", "install", "PREFIX=#{prefix}"
32 32
   end
33 33
 end
34 34
 
2  Library/Formula/git-sh.rb
@@ -13,6 +13,6 @@ class GitSh < Formula
13 13
 
14 14
   def install
15 15
     system "make"
16  
-    system "make install PREFIX=#{prefix}"
  16
+    system "make", "install", "PREFIX=#{prefix}"
17 17
   end
18 18
 end
2  Library/Formula/git-url-sub.rb
@@ -6,6 +6,6 @@ class GitUrlSub < Formula
6 6
   md5       '5d2dad29dcd53eedc0730f42014bec51'
7 7
 
8 8
   def install
9  
-    system "make install PREFIX=#{prefix}"
  9
+    system "make", "install", "PREFIX=#{prefix}"
10 10
   end
11 11
 end
2  Library/Formula/gitslave.rb
@@ -6,6 +6,6 @@ class Gitslave < Formula
6 6
   md5 '7fed63110ae1a656af10462f60592000'
7 7
 
8 8
   def install
9  
-    system "make install prefix=#{prefix}"
  9
+    system "make", "install", "prefix=#{prefix}"
10 10
   end
11 11
 end
2  Library/Formula/httping.rb
@@ -11,6 +11,6 @@ def patches
11 11
   end
12 12
 
13 13
   def install
14  
-    system "make install PREFIX=#{prefix}"
  14
+    system "make", "install", "PREFIX=#{prefix}"
15 15
   end
16 16
 end
2  Library/Formula/innotop.rb
@@ -8,7 +8,7 @@ class Innotop < Formula
8 8
   depends_on 'DBD::mysql' => :perl
9 9
 
10 10
   def install
11  
-    system "perl Makefile.PL PREFIX=#{prefix}"
  11
+    system "perl", "Makefile.PL", "PREFIX=#{prefix}"
12 12
     system "make install"
13 13
   end
14 14
 end
2  Library/Formula/iodine.rb
@@ -11,6 +11,6 @@ def install
11 11
         "arpa/nameser8_compat", "arpa/nameser_compat"
12 12
     end
13 13
 
14  
-    system "make install prefix=#{prefix}"
  14
+    system "make", "install", "prefix=#{prefix}"
15 15
   end
16 16
 end
2  Library/Formula/ioping.rb
@@ -8,6 +8,6 @@ class Ioping < Formula
8 8
 
9 9
   def install
10 10
     system "make"
11  
-    system "make install PREFIX=#{prefix}"
  11
+    system "make", "install", "PREFIX=#{prefix}"
12 12
   end
13 13
 end
2  Library/Formula/jbigkit.rb
@@ -38,7 +38,7 @@ def install
38 38
   def test
39 39
     mktemp do
40 40
       system "#{bin}/jbgtopbm #{prefix}/examples/ccitt7.jbg | #{bin}/pbmtojbg - testoutput.jbg"
41  
-      system "/usr/bin/cmp #{prefix}/examples/ccitt7.jbg testoutput.jbg"
  41
+      system "/usr/bin/cmp", "#{prefix}/examples/ccitt7.jbg", "testoutput.jbg"
42 42
     end
43 43
   end
44 44
 end
2  Library/Formula/john.rb
@@ -16,7 +16,7 @@ def install
16 16
     arch = Hardware.is_64_bit? ? '64' : 'sse2'
17 17
 
18 18
     cd 'src' do
19  
-      system "make clean macosx-x86-#{arch}"
  19
+      system "make", "clean", "macosx-x86-#{arch}"
20 20
     end
21 21
 
22 22
     rm 'README'
2  Library/Formula/jruby.rb
@@ -28,6 +28,6 @@ def install
28 28
   end
29 29
 
30 30
   def test
31  
-    system "#{bin}/jruby -e 'puts \"hello\"'"
  31
+    system "#{bin}/jruby", "-e", "puts 'hello'"
32 32
   end
33 33
 end
2  Library/Formula/lasi.rb
@@ -13,7 +13,7 @@ class Lasi < Formula
13 13
   depends_on 'doxygen'
14 14
 
15 15
   def install
16  
-    system "cmake -DCMAKE_INSTALL_PREFIX=#{prefix} ."
  16
+    system "cmake -DCMAKE_INSTALL_PREFIX='#{prefix}' ."
17 17
     system "make install"
18 18
   end
19 19
 end
2  Library/Formula/latex2rtf.rb
@@ -11,6 +11,6 @@ def install
11 11
       s.change_make_var! 'MAN_INSTALL', man1
12 12
     end
13 13
 
14  
-    system "make PREFIX=#{prefix} install"
  14
+    system "make", "PREFIX=#{prefix}", "install"
15 15
   end
16 16
 end
2  Library/Formula/lcov.rb
@@ -9,7 +9,7 @@ def install
9 9
     %w(bin/gendesc bin/genhtml bin/geninfo bin/genpng bin/lcov).each do |file|
10 10
       inreplace file, '/etc/lcovrc', "#{prefix}/etc/lcovrc"
11 11
     end
12  
-    system "make PREFIX=#{prefix} install"
  12
+    system "make", "PREFIX=#{prefix}", "install"
13 13
   end
14 14
 
15 15
   def patches
2  Library/Formula/ledger.rb
@@ -28,7 +28,7 @@ def install
28 28
       # gmp installs x86_64 only
29 29
       inreplace 'acprep', "'-arch', 'i386', ", "" if Hardware.is_64_bit?
30 30
       no_python = ((ARGV.include? '--no-python') ? '--no-python' : '')
31  
-      system "./acprep #{no_python} -j#{ENV.make_jobs} opt make -- --prefix=#{prefix}"
  31
+      system "./acprep", no_python, "-j#{ENV.make_jobs}", "opt", "make", "--", "--prefix=#{prefix}"
32 32
     end
33 33
     system 'make'
34 34
     ENV.deparallelize
5  Library/Formula/ledit.rb
@@ -11,7 +11,8 @@ class Ledit < Formula
11 11
   def install
12 12
     # like camlp5, this build fails if the jobs are parallelized
13 13
     ENV.deparallelize
14  
-    system "make BINDIR=#{bin} LIBDIR=#{lib} MANDIR=#{man}"
15  
-    system "make install BINDIR=#{bin} LIBDIR=#{lib} MANDIR=#{man}"
  14
+    args = %W[BINDIR=#{bin} LIBDIR=#{lib} MANDIR=#{man}]
  15
+    system "make", *args
  16
+    system "make", "install", *args
16 17
   end
17 18
 end
2  Library/Formula/libmusicbrainz.rb
@@ -10,7 +10,7 @@ class Libmusicbrainz < Formula
10 10
 
11 11
   def install
12 12
     neon = Formula.factory("neon")
13  
-    neon_args = "-DNEON_LIBRARIES:FILEPATH=#{neon.lib}/libneon.dylib -DNEON_INCLUDE_DIR:PATH=#{neon.include}/neon"
  13
+    neon_args = "-DNEON_LIBRARIES:FILEPATH='#{neon.lib}/libneon.dylib' -DNEON_INCLUDE_DIR:PATH='#{neon.include}/neon'"
14 14
 
15 15
     system "cmake #{std_cmake_parameters} #{neon_args} ."
16 16
     system "make install"
2  Library/Formula/libplist.rb
@@ -16,7 +16,7 @@ def patches
16 16
 
17 17
   def install
18 18
     ENV.deparallelize # make fails on an 8-core Mac Pro
19  
-    system "cmake #{std_cmake_parameters} -DCMAKE_INSTALL_NAME_DIR=#{lib} ."
  19
+    system "cmake #{std_cmake_parameters} -DCMAKE_INSTALL_NAME_DIR='#{lib}' ."
20 20
     system "make install"
21 21
 
22 22
     # Remove 'plutil', which duplicates the system-provided one. Leave the versioned one, though.
2  Library/Formula/libutf.rb
@@ -8,6 +8,6 @@ class Libutf < Formula
8 8
 
9 9
   def install
10 10
     inreplace 'Makefile', 'man/man7', 'share/man/man7'
11  
-    system "make PREFIX=#{prefix} install"
  11
+    system "make", "PREFIX=#{prefix}", "install"
12 12
   end
13 13
 end
2  Library/Formula/magit.rb
@@ -7,6 +7,6 @@ class Magit < Formula
7 7
   head 'https://github.com/magit/magit.git'
8 8
 
9 9
   def install
10  
-    system "make install DESTDIR=#{prefix} PREFIX="
  10
+    system "make", "install", "DESTDIR=#{prefix}", "PREFIX="
11 11
   end
12 12
 end
2  Library/Formula/mg.rb
@@ -9,6 +9,6 @@ def install
9 9
     # -Wno-error=unused-but-set-variable requires GCC 4.6+
10 10
     inreplace 'Makefile.in', '-Wno-error=unused-but-set-variable', ''
11 11
     system "./configure"
12  
-    system "make install prefix=#{prefix} mandir=#{man}"
  12
+    system "make", "install", "prefix=#{prefix}", "mandir=#{man}"
13 13
   end
14 14
 end
2  Library/Formula/mhash.rb
@@ -6,7 +6,7 @@ class Mhash < Formula
6 6
   md5 'ee66b7d5947deb760aeff3f028e27d25'
7 7
 
8 8
   def install
9  
-    system "./configure --prefix=#{prefix} --disable-debug --disable-dependency-tracking"
  9
+    system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
10 10
     system "make install"
11 11
   end
12 12
 end
2  Library/Formula/mkvtoolnix.rb
@@ -21,7 +21,7 @@ def install
21 21
                           "--prefix=#{prefix}",
22 22
                           "--with-boost-libdir=#{HOMEBREW_PREFIX}/lib", # For non-/usr/local prefix
23 23
                           "--with-boost-regex=boost_regex-mt" # via macports
24  
-    system "./drake -j#{ENV.make_jobs}"
  24
+    system "./drake", "-j#{ENV.make_jobs}"
25 25
     system "./drake install"
26 26
   end
27 27
 end
2  Library/Formula/mongrel2.rb
@@ -18,6 +18,6 @@ def install
18 18
     ENV['OPTLIBS'] = ENV.ldflags
19 19
 
20 20
     system "make all"
21  
-    system "make install PREFIX=#{prefix}"
  21
+    system "make", "install", "PREFIX=#{prefix}"
22 22
   end
23 23
 end
2  Library/Formula/mupdf.rb
@@ -33,7 +33,7 @@ def patches
33 33
 
34 34
   def install
35 35
     ENV.x11 # For LibPNG and Freetype
36  
-    system "make install prefix=#{prefix}"
  36
+    system "make", "install", "prefix=#{prefix}"
37 37
 
38 38
     # MuPDF comes with some handy command-line tools. However, their names can
39 39
     # clash with other tools installed by formulae such as Poppler. So, we
2  Library/Formula/mytop.rb
@@ -8,7 +8,7 @@ class Mytop < Formula
8 8
   depends_on 'DBD::mysql' => :perl
9 9
 
10 10
   def install
11  
-    system "perl Makefile.PL PREFIX=#{prefix}"
  11
+    system "perl", "Makefile.PL", "PREFIX=#{prefix}"
12 12
     system "make test install"
13 13
   end
14 14
 end
2  Library/Formula/nacl.rb
@@ -29,7 +29,7 @@ def install
29 29
     # but plenty of the key generation routines depend on it. Users shouldn't have to
30 30
     # know this.
31 31
     nacl_libdir = "build/#{hoststr}/lib/#{archstr}"
32  
-    system "ar -r #{nacl_libdir}/libnacl.a #{nacl_libdir}/randombytes.o"
  32
+    system "ar", "-r", "#{nacl_libdir}/libnacl.a", "#{nacl_libdir}/randombytes.o"
33 33
     lib.install "#{nacl_libdir}/libnacl.a"
34 34
   end
35 35
 end
6  Library/Formula/noweb.rb
@@ -15,17 +15,17 @@ def install
15 15
 
16 16
       if which 'kpsewhich'
17 17
         ohai 'TeX installation found. Installing TeX support files there might fail if your user does not have permission'
18  
-        texmf = "`kpsewhich -var-value=TEXMFLOCAL`"
  18
+        texmf = Pathname.new(`kpsewhich -var-value=TEXMFLOCAL`.chomp)
19 19
       else
20 20
         ohai 'No TeX installation found. Installing TeX support files in the noweb Cellar.'
21  
-        texmf = "#{prefix}"
  21
+        texmf = prefix
22 22
       end
23 23
 
24 24
       bin.mkpath
25 25
       lib.mkpath
26 26
       man.mkpath
  27
+      (texmf/'tex/generic/noweb').mkpath
27 28
 
28  
-      system "mkdir -p #{texmf}/tex/generic/noweb"
29 29
       system "make", "install", "BIN=#{bin}",
30 30
                                 "LIB=#{lib}",
31 31
                                 "MAN=#{man}",
6  Library/Formula/nss.rb
@@ -20,7 +20,7 @@ def install
20 20
     ]
21 21
     args << 'USE_64=1' if MacOS.prefer_64_bit?
22 22
 
23  
-    system "make build_coreconf build_dbm all -C mozilla/security/nss #{args.join ' '}"
  23
+    system "make", "build_coreconf", "build_dbm", "all", "-C", "mozilla/security/nss", *args
24 24
 
25 25
     # We need to use cp here because all files get cross-linked into the dist
26 26
     # hierarchy, and Homebrew's Pathname.install moves the symlink into the keg
@@ -52,8 +52,8 @@ def test
52 52
     # See: http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html
53 53
     mktemp do
54 54
       File.open('passwd', 'w') {|f| f.write("It's a secret to everyone.") }
55  
-      system "#{bin}/certutil -N -d #{Dir.getwd} -f passwd"
56  
-      system "#{bin}/certutil -L -d #{Dir.getwd}"
  55
+      system "#{bin}/certutil", "-N", "-d", pwd, "-f", "passwd"
  56
+      system "#{bin}/certutil", "-L", "-d", pwd
57 57
     end
58 58
   end
59 59
 
4  Library/Formula/num-utils.rb
... ...
@@ -1,13 +1,13 @@
1 1
 require 'formula'
2 2
 
3 3
 class NumUtils < Formula
  4
+  homepage 'http://suso.suso.org/programs/num-utils/'
4 5
   url "http://suso.suso.org/programs/num-utils/downloads/num-utils-0.5.tar.gz"
5 6
   md5 '58eed69761c2da97c3bfdfa422633427'
6  
-  homepage 'http://suso.suso.org/programs/num-utils/'
7 7
 
8 8
   def install
9 9
     %w(average bound interval normalize numgrep numprocess numsum random range round).each do |program|
10  
-      system "pod2man #{program} #{program}.1"
  10
+      system "pod2man", program, "#{program}.1"
11 11
       bin.install program
12 12
       man1.install "#{program}.1"
13 13
     end
2  Library/Formula/o-make.rb
@@ -13,7 +13,7 @@ def patches
13 13
   end
14 14
 
15 15
   def install
16  
-    system "make install PREFIX=#{prefix}"
  16
+    system "make", "install", "PREFIX=#{prefix}"
17 17
   end
18 18
 end
19 19
 
2  Library/Formula/objective-caml.rb
@@ -19,7 +19,7 @@ def install
19 19
     system "make world"
20 20
     system "make opt"
21 21
     system "make opt.opt"
22  
-    system "make PREFIX=#{prefix} install"
  22
+    system "make", "PREFIX=#{prefix}", "install"
23 23
     (lib+'ocaml/compiler-libs').install 'typing', 'parsing', 'utils'
24 24
 
25 25
     # site-lib in the Cellar will be a symlink to the HOMEBREW_PREFIX location,
2  Library/Formula/opentracker.rb
@@ -14,7 +14,7 @@ def install
14 14
     # First libowfat must be compiled and installed where opentracker is expecting it
15 15
     libowfat_include = Pathname.new(pwd) + 'libowfat'
16 16
     Libowfat.new.brew do
17  
-      system "make install INCLUDEDIR=#{libowfat_include} LIBDIR=#{libowfat_include} MAN3DIR=."
  17
+      system "make", "install", "INCLUDEDIR=#{libowfat_include}", "LIBDIR=#{libowfat_include}", "MAN3DIR=."
18 18
     end
19 19
 
20 20
     # Tell opentracker that libowfat headers are located in the same directory as itself
2  Library/Formula/parmetis.rb
@@ -8,7 +8,7 @@ class Parmetis < Formula
8 8
   depends_on 'cmake' => :build
9 9
 
10 10
   def install
11  
-    system "make config prefix=#{prefix}"
  11
+    system "make", "config", "prefix=#{prefix}"
12 12
     system 'make install'
13 13
   end
14 14
 end
2  Library/Formula/percona-toolkit.rb
@@ -9,7 +9,7 @@ class PerconaToolkit < Formula
9 9
   depends_on 'DBD::mysql' => :perl
10 10
 
11 11
   def install
12  
-    system "perl Makefile.PL PREFIX=#{prefix}"
  12
+    system "perl", "Makefile.PL", "PREFIX=#{prefix}"
13 13
     system "make"
14 14
     system "make test"
15 15
     system "make install"
12  Library/Formula/polipo.rb
@@ -9,9 +9,15 @@ class Polipo < Formula
9 9
   def install
10 10
     cache_root = (var + "cache/polipo")
11 11
     cache_root.mkpath
12  
-    make_opts = "PREFIX=#{prefix} LOCAL_ROOT=#{share}/polipo/www DISK_CACHE_ROOT=#{cache_root} MANDIR=#{man} INFODIR=#{info} PLATFORM_DEFINES=-DHAVE_IPv6"
13  
-    system "make all #{make_opts}"
14  
-    system "make install #{make_opts}"
  12
+    args = %W[PREFIX=#{prefix}
  13
+              LOCAL_ROOT=#{share}/polipo/www
  14
+              DISK_CACHE_ROOT=#{cache_root}
  15
+              MANDIR=#{man}
  16
+              INFODIR=#{info}
  17
+              PLATFORM_DEFINES=-DHAVE_IPv6]
  18
+
  19
+    system "make", "all", *args
  20
+    system "make", "install", *args
15 21
 
16 22
     plist_path.write startup_plist
17 23
     plist_path.chmod 0644
2  Library/Formula/poppler.rb
@@ -44,7 +44,7 @@ def install
44 44
 
45 45
     # Install poppler font data.
46 46
     PopplerData.new.brew do
47  
-      system "make install prefix=#{prefix}"
  47
+      system "make", "install", "prefix=#{prefix}"
48 48
     end
49 49
   end
50 50
 end
2  Library/Formula/putty.rb
@@ -12,7 +12,7 @@ def install
12 12
       system "./configure", "--prefix=#{prefix}",
13 13
                             "--disable-gtktest",
14 14
                             "--with-gtk-prefix=/dev/null"
15  
-      system "make VER=-DRELEASE=#{version} all-cli"
  15
+      system "make", "VER=-DRELEASE=#{version}", "all-cli"
16 16
       # install manually
17 17
       bin.install %w{ plink pscp psftp puttygen }
18 18
     end
2  Library/Formula/pyside.rb
@@ -24,7 +24,7 @@ def install
24 24
     ENV.append_to_cflags "-F#{qt.prefix}/Frameworks"
25 25
 
26 26
     # Also need `ALTERNATIVE_QT_INCLUDE_DIR` to prevent "missing file" errors.
27  
-    system "cmake #{std_cmake_parameters} -DALTERNATIVE_QT_INCLUDE_DIR=#{qt.prefix}/Frameworks -DSITE_PACKAGE=#{site_package_dir} -DBUILD_TESTS=NO ."
  27
+    system "cmake #{std_cmake_parameters} -DALTERNATIVE_QT_INCLUDE_DIR='#{qt.prefix}/Frameworks' -DSITE_PACKAGE=#{site_package_dir} -DBUILD_TESTS=NO ."
28 28
     system 'make install'
29 29
   end
30 30
 
2  Library/Formula/qhull.rb
@@ -21,7 +21,7 @@ def patches
21 21
   end
22 22
 
23 23
   def install
24  
-    system "cmake #{std_cmake_parameters} -DMAN_INSTALL_DIR=#{man1} ."
  24
+    system "cmake #{std_cmake_parameters} -DMAN_INSTALL_DIR='#{man1}' ."
25 25
     system "make install"
26 26
   end
27 27
 end
2  Library/Formula/rakudo-star.rb
@@ -10,7 +10,7 @@ class RakudoStar < Formula
10 10
   depends_on 'pcre' => :optional
11 11
 
12 12
   def install
13  
-    system "perl Configure.pl --prefix=#{prefix} --gen-parrot"
  13
+    system "perl", "Configure.pl", "--prefix=#{prefix}", "--gen-parrot"
14 14
     system "make"
15 15
     system "make install"
16 16
   end
11  Library/Formula/sbcl.rb
@@ -67,20 +67,17 @@ def install
67 67
       value =~ /[\x80-\xff]/
68 68
     end
69 69
 
70  
-    SbclBootstrapBinaries.new.brew {
  70
+    SbclBootstrapBinaries.new.brew do
71 71
       # We only need the binaries for bootstrapping, so don't install anything:
72 72
       command = Dir.pwd + "/src/runtime/sbcl"
73 73
       core = Dir.pwd + "/output/sbcl.core"
74 74
       xc_cmdline = "#{command} --core #{core} --disable-debugger --no-userinit --no-sysinit"
75 75
 
76 76
       cd buildpath do
77  
-        if ARGV.build_32_bit?
78  
-          system "SBCL_ARCH=x86 ./make.sh --prefix='#{prefix}' --xc-host='#{xc_cmdline}'"
79  
-        else
80  
-          system "./make.sh --prefix='#{prefix}' --xc-host='#{xc_cmdline}'"
81  
-        end
  77
+        ENV['SBCL_ARCH'] = 'x86' if ARGV.build_32_bit?
  78
+        system "./make.sh", "--prefix=#{prefix}", "--xc-host=#{xc_cmdline}"
82 79
       end
83  
-    }
  80
+    end
84 81
 
85 82
     ENV['INSTALL_ROOT'] = prefix
86 83
     system "sh install.sh"
2  Library/Formula/sc68.rb
@@ -15,6 +15,6 @@ def install
15 15
 
16 16
   def test
17 17
     # SC68 ships with a sample module; test attempts to print its metadata
18  
-    system "#{bin}/info68 #{share}/sc68/Sample/About-Intro.sc68 -C ': ' -N -L"
  18
+    system "#{bin}/info68", "#{share}/sc68/Sample/About-Intro.sc68", "-C", ": ", "-N", "-L"
19 19
   end
20 20
 end
3  Library/Formula/sedna.rb
@@ -8,10 +8,9 @@ class Sedna < Formula
8 8
   depends_on 'cmake' => :build
9 9
 
10 10
   def install
11  
-    path = pwd
12 11
     # Build needs to be created from outside the source directory.
13 12
     mktemp do
14  
-      system "cmake #{std_cmake_parameters} #{path}"
  13
+      system "cmake #{std_cmake_parameters} #{buildpath}"
15 14
       system "make install"
16 15
     end
17 16
   end
2  Library/Formula/sigar.rb
@@ -66,7 +66,7 @@ def install
66 66
 
67 67
     # Install Ruby bindings
68 68
     cd "bindings/ruby" do
69  
-      system "ruby", "extconf.rb", "--prefix='#{prefix}'"
  69
+      system "ruby", "extconf.rb", "--prefix=#{prefix}"
70 70
       system "make install"
71 71
     end if ARGV.include? "--ruby"
72 72
   end
2  Library/Formula/sipp.rb
@@ -7,7 +7,7 @@ class Sipp < Formula
7 7
   version '3.2'
8 8
 
9 9
   def install
10  
-    system "make DESTDIR=#{prefix}"
  10
+    system "make", "DESTDIR=#{prefix}"
11 11
     bin.install "sipp"
12 12
   end
13 13
 end
2  Library/Formula/tabbed.rb
@@ -12,6 +12,6 @@ def install
12 12
     inreplace 'config.def.h',
13 13
       '{ MODKEY|ShiftMask,             XK_Return, spawn,          { .v = (char*[]){ "surf", "-e", winid, NULL} } },',
14 14
       '{ MODKEY|ShiftMask,             XK_Return, spawn,          { .v = (char*[]){ "xterm", "-into", winid, NULL} } },'
15  
-    system "make  PREFIX=#{prefix} install"
  15
+    system "make", "PREFIX=#{prefix}", "install"
16 16
   end
17 17
 end
2  Library/Formula/unifdef.rb
@@ -9,7 +9,7 @@ class Unifdef < Formula
9 9
     "The unifdef provided by Xcode cannot compile gevent."
10 10
 
11 11
   def install
12  
-    system "make prefix=#{prefix} install"
  12
+    system "make", "PREFIX=#{prefix}", "install"
13 13
   end
14 14
 
15 15
   def test
8  Library/Formula/vtk.rb
@@ -73,7 +73,7 @@ def install
73 73
     # to get the right RPATH in the python libraries (the .so files in the vtk egg).
74 74
     # Also readable: http://vtk.1045678.n5.nabble.com/VTK-Python-Wrappers-on-Red-Hat-td1246159.html
75 75
     args << "-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON"
76  
-    ENV['DYLD_LIBRARY_PATH'] = `pwd`.strip + "/build/bin"
  76
+    ENV['DYLD_LIBRARY_PATH'] = buildpath/'build/bin'
77 77
 
78 78
     args << ".."
79 79
 
@@ -84,10 +84,10 @@ def install
84 84
       #   collect2: ld returned 1 exit status
85 85
       #   make[2]: *** [bin/vtkpython] Error 1
86 86
       # We symlink such that the DCMAKE_INSTALL_NAME_DIR is available and points to the current build/bin
87  
-      mkpath "#{lib}" # create empty directories, because we need it here
88  
-      system "ln -s " + ENV['DYLD_LIBRARY_PATH'] + " '#{lib}/vtk-5.8'"
  87
+      lib.mkpath # create empty directories, because we need it here
  88
+      ln_s ENV['DYLD_LIBRARY_PATH'], lib/'vtk-5.8'
89 89
       system "make"
90  
-      system "rm '#{lib}/vtk-5.8'" # Remove our symlink, was only needed to make make succeed.
  90
+      rm lib/'vtk-5.8' # Remove our symlink, was only needed to make make succeed.
91 91
       # end work-a-round
92 92
       system "make install" # Finally move libs in their places.
93 93
     end
2  Library/Formula/wxmac.rb
@@ -132,7 +132,7 @@ def install
132 132
     unless ARGV.build_devel?
133 133
       # erlang needs contrib/stc during configure phase.
134 134
       %w{ gizmos stc ogl }.each do |c|
135  
-       system "make -C contrib/src/#{c} install"
  135
+       system "make", "-C", "contrib/src/#{c}", "install"
136 136
       end
137 137
     end
138 138
 
2  Library/Formula/xmp.rb
@@ -14,6 +14,6 @@ def install
14 14
   end
15 15
 
16 16
   def test
17  
-    system "#{bin}/xmp --load-only #{share}/SynthSong1"
  17
+    system "#{bin}/xmp", "--load-only", "#{share}/SynthSong1"
18 18
   end
19 19
 end
2  Library/Formula/xspringies.rb
@@ -10,6 +10,6 @@ def install
10 10
       s.change_make_var! "LIBS", '-L/usr/X11/lib -lm -lX11'
11 11
       s.gsub! 'mkdirhier', 'mkdir -p'
12 12
     end
13  
-    system "make -f Makefile.std DDIR=#{prefix}/ install"
  13
+    system "make", "-f", "Makefile.std", "DDIR=#{prefix}/", "install"
14 14
   end
15 15
 end
4  Library/Formula/zeromq.rb
@@ -29,13 +29,13 @@ def options
29 29
 
30 30
   def build_fat
31 31
     # make 32-bit
32  
-    system "CFLAGS=\"$CFLAGS -arch i386\" CXXFLAGS=\"$CXXFLAGS -arch i386\" ./configure --disable-dependency-tracking --prefix=#{prefix} #{pgm_flags}"
  32
+    system "CFLAGS=\"$CFLAGS -arch i386\" CXXFLAGS=\"$CXXFLAGS -arch i386\" ./configure --disable-dependency-tracking --prefix='#{prefix}' #{pgm_flags}"
33 33
     system "make"
34 34
     system "mv src/.libs src/libs-32"
35 35
     system "make clean"
36 36
 
37 37
     # make 64-bit
38  
-    system "CFLAGS=\"$CFLAGS -arch x86_64\" CXXFLAGS=\"$CXXFLAGS -arch x86_64\" ./configure --disable-dependency-tracking --prefix=#{prefix} #{pgm_flags}"
  38
+    system "CFLAGS=\"$CFLAGS -arch x86_64\" CXXFLAGS=\"$CXXFLAGS -arch x86_64\" ./configure --disable-dependency-tracking --prefix='#{prefix}' #{pgm_flags}"
39 39
     system "make"
40 40
     system "mv src/.libs/libzmq.1.dylib src/.libs/libzmq.64.dylib"
41 41
 
6  Library/Formula/zint.rb
@@ -11,15 +11,15 @@ class Zint < Formula
11 11
 
12 12
   def install
13 13
     mkdir 'zint-build' do
14  
-      system "cmake #{std_cmake_parameters} -DCMAKE_PREFIX_PATH=#{prefix} -DCMAKE_C_FLAGS=-I/usr/X11/include .."
  14
+      system "cmake #{std_cmake_parameters} -DCMAKE_PREFIX_PATH='#{prefix}' -DCMAKE_C_FLAGS=-I/usr/X11/include .."
15 15
       system "make install"
16 16
     end
17 17
   end
18 18
 
19 19
   def test
20 20
     mktemp do
21  
-      system "#{bin}/zint -o test-zing.png -d 'This Text'"
22  
-      system "/usr/bin/qlmanage -p test-zing.png"
  21
+      system "#{bin}/zint", "-o", "test-zing.png", "-d", "This Text"
  22
+      system "/usr/bin/qlmanage", "-p", "test-zing.png"
23 23
     end
24 24
   end
25 25
 end

0 notes on commit 417d788

Adam Vandenberg

Maybe we need a "try_install" method.

Please sign in to comment.
Something went wrong with that request. Please try again.