Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/mxcl/homebrew into powerpc
Browse files Browse the repository at this point in the history
  • Loading branch information
robert914 committed Mar 7, 2012
2 parents 7f5ece4 + 504d51b commit 5aba729
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 16 deletions.
9 changes: 7 additions & 2 deletions Library/Contributions/manpages/brew.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,20 @@ For the full command list, see the COMMANDS section.
* `cat` <formula>:
Display the source to <formula>.

* `cleanup [--force] [-n]` [<formulae>]:
* `cleanup [--force] [-ns]` [<formulae>]:
For all installed or specific formulae, remove any older versions from the
cellar. By default, does not remove out-of-date keg-only brews, as other
software may link directly to specific versions.
software may link directly to specific versions. In addition old downloads from
the Homebrew download-cache are deleted.

If `--force` is passed, remove out-of-date keg-only brews as well.

If `-n` is passed, show what would be removed, but do not actually remove anything.

If `-s` is passed, scrubs the cache, removing downloads for even the latest
versions of formula. Note downloads for any installed formula will still not be
deleted. If you want to delete those too: `rm -rf $(brew --cache)`

* `create [--autotools|--cmake] [--no-fetch]` <URL>:
Generate a formula for the downloadable file at <URL> and open it in
`EDITOR`. Homebrew will attempt to automatically derive the formula name
Expand Down
12 changes: 6 additions & 6 deletions Library/Formula/git.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
require 'formula'

class GitManuals < Formula
url 'http://git-core.googlecode.com/files/git-manpages-1.7.9.2.tar.gz'
sha1 'd6992d899fb70e40983f94a2f96ad24b8ee93557'
url 'http://git-core.googlecode.com/files/git-manpages-1.7.9.3.tar.gz'
sha1 '223daa871a64facc60bdf643c50c78eac21c88f4'
end

class GitHtmldocs < Formula
url 'http://git-core.googlecode.com/files/git-htmldocs-1.7.9.2.tar.gz'
sha1 '3cf13b03b2f64d0458212232cc18983231f8251e'
url 'http://git-core.googlecode.com/files/git-htmldocs-1.7.9.3.tar.gz'
sha1 '2d488c3975da1c2ea90965b82233a986c498a8c2'
end

class Git < Formula
homepage 'http://git-scm.com'
url 'http://git-core.googlecode.com/files/git-1.7.9.2.tar.gz'
sha1 '7aff1048480a8637de94e8d82744d312c0b5e060'
url 'http://git-core.googlecode.com/files/git-1.7.9.3.tar.gz'
sha1 '6216153da1139c25cb96cfb4441eff327013ec4f'

depends_on 'pcre' if ARGV.include? '--with-pcre'

Expand Down
26 changes: 26 additions & 0 deletions Library/Formula/libmp3splt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,41 @@ class Libmp3splt < Formula
md5 '62025951f483334f14f1b9be58162094'

depends_on 'pkg-config' => :build
depends_on 'automake' => :build unless MacOS.lion?
depends_on 'gettext'
depends_on 'pcre'
depends_on 'libid3tag'
depends_on 'mad'
depends_on 'libvorbis'

# autogen.sh calls `libtoolize`, while OS X installs under the name `glibtoolize`
# reported upstream at https://sourceforge.net/tracker/?func=detail&aid=3497957&group_id=55130&atid=476061
def patches
DATA
end

def install
if !MacOS.lion?
system "./autogen.sh"
system "autoconf"
end
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
end

__END__
diff --git a/autogen.sh b/autogen.sh
index 68962f2..916b868 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -53,7 +53,7 @@ echo -n "1/6 Running autopoint... " \
&& echo -n "3/6 Running autoheader... " \
&& autoheader && echo "done" \
&& echo -n "4/6 Running libtoolize... " \
-&& libtoolize -c --force && echo "done" \
+&& glibtoolize -c --force && echo "done" \
&& echo -n "5/6 Running autoconf... " \
&& autoconf && echo "done" \
&& echo -n "6/6 Running automake... " \
22 changes: 18 additions & 4 deletions Library/Homebrew/cmd/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'cmd/prune'

module Homebrew extend self

def cleanup
if ARGV.named.empty?
HOMEBREW_CELLAR.children.each do |rack|
Expand All @@ -12,8 +13,9 @@ def cleanup
# instead of core formulae.
end
end
clean_cache
# seems like a good time to do some additional cleanup
Homebrew.prune unless ARGV.include? '-n'
Homebrew.prune unless ARGV.switch? 'n'
else
ARGV.formulae.each do |f|
cleanup_formula f
Expand All @@ -35,9 +37,8 @@ def cleanup_formula f
if f.installed? and f.rack.directory?
f.rack.children.each do |keg|
if f.installed_prefix != keg
print "Removing #{keg}..."
rm_rf keg unless ARGV.include? '-n'
puts
puts "Removing #{keg}..."
rm_rf keg unless ARGV.switch? 'n'
end
end
elsif f.rack.children.length > 1
Expand All @@ -47,4 +48,17 @@ def cleanup_formula f
end
end

def clean_cache
HOMEBREW_CACHE.children.each do |pn|
pn.stem =~ /^(.+)-(.+)$/ # greedy so works even if formula-name has hyphens in it
if $1 and $2
f = Formula.factory($1) rescue nil
if not f or (f.version != $2 or ARGV.switch? "s" and not f.installed?)
puts "Removing #{pn}..."
rm pn unless ARGV.switch? 'n'
end
end
end
end

end
16 changes: 16 additions & 0 deletions Library/Homebrew/cmd/doctor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,22 @@ def check_for_bad_python_symlink
end
end

def check_for_outdated_homebrew
HOMEBREW_PREFIX.cd do
timestamp = if File.directory? ".git"
`git log -1 --format="%ct" HEAD`.to_i
else
(HOMEBREW_PREFIX/"Library").mtime.to_i
end

if Time.now.to_i - timestamp > 60 * 60 * 24 then <<-EOS.undent
Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!
EOS
end
end
end

end # end class Checks

module Homebrew extend self
Expand Down
10 changes: 10 additions & 0 deletions Library/Homebrew/extend/ARGV.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ def flag? flag
return false
end

# eg. `foo -ns -i --bar` has three switches, n, s and i
def switch? switch_character
return false if switch_character.length > 1
options_only.each do |arg|
next if arg[1..1] == '-'
return true if arg.include? switch_character
end
return false
end

def usage
require 'cmd/help'
Homebrew.help_s
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def cp dst

# extended to support common double extensions
def extname
return $1 if to_s =~ /(\.bottle\.tar\.gz)$/
/(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s
return $1 if $1
return File.extname(to_s)
Expand Down
17 changes: 16 additions & 1 deletion Library/Homebrew/test/test_ARGV.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,20 @@ def test_ARGV
assert_equal 1, ARGV.kegs.length
assert_raises(FormulaUnavailableError) { ARGV.formulae }
end


def test_switch?
ARGV.reset
ARGV.unshift "-ns"
ARGV.unshift "-i"
ARGV.unshift "--bar"
assert ARGV.switch?('n')
assert ARGV.switch?('s')
assert ARGV.switch?('i')
assert !ARGV.switch?('b')
assert !ARGV.switch?('ns')
assert !ARGV.switch?('bar')
assert !ARGV.switch?('--bar')
assert !ARGV.switch?('-n')
end

end
9 changes: 6 additions & 3 deletions share/man/man1/brew.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BREW" "1" "February 2012" "Homebrew" "brew"
.TH "BREW" "1" "March 2012" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The missing package manager for OS X
Expand Down Expand Up @@ -61,15 +61,18 @@ If no \fIformulae\fR are provided, all of them are checked\.
Display the source to \fIformula\fR\.
.
.TP
\fBcleanup [\-\-force] [\-n]\fR [\fIformulae\fR]
For all installed or specific formulae, remove any older versions from the cellar\. By default, does not remove out\-of\-date keg\-only brews, as other software may link directly to specific versions\.
\fBcleanup [\-\-force] [\-ns]\fR [\fIformulae\fR]
For all installed or specific formulae, remove any older versions from the cellar\. By default, does not remove out\-of\-date keg\-only brews, as other software may link directly to specific versions\. In addition old downloads from the Homebrew download\-cache are deleted\.
.
.IP
If \fB\-\-force\fR is passed, remove out\-of\-date keg\-only brews as well\.
.
.IP
If \fB\-n\fR is passed, show what would be removed, but do not actually remove anything\.
.
.IP
If \fB\-s\fR is passed, scrubs the cache, removing downloads for even the latest versions of formula\. Note downloads for any installed formula will still not be deleted\. If you want to delete those too: \fBrm \-rf $(brew \-\-cache)\fR
.
.TP
\fBcreate [\-\-autotools|\-\-cmake] [\-\-no\-fetch]\fR \fIURL\fR
Generate a formula for the downloadable file at \fIURL\fR and open it in \fBEDITOR\fR\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The wget formula serves as a simple example\.
Expand Down

0 comments on commit 5aba729

Please sign in to comment.