Closes Homebrew/homebrew#27 (permissions to strict)

I went with 0555 as the permissions changing only occurs to bin, sbin and lib, so there shouldn't be any files in there for editing in general anyway.

Formulae can specify not to "clean" any particular file by reimplementing the skip_clean? function, in case some config file or what not ends up in there.

Also committing cosmetic fix to pretty_duration function.
This commit is contained in:
Max Howell 2009-09-03 20:58:33 +01:00
parent 21df479f1b
commit 18d9fbee98
2 changed files with 11 additions and 11 deletions

View File

@ -260,7 +260,7 @@ private
`strip #{args} #{path}`
else
# strip unlinks the file and recreates it, thus breaking hard links!
# is this expected behaviour? patch does it too… still,mktm this fixes it
# is this expected behaviour? patch does it too… still, this fixes it
tmp=`mktemp -t #{path.basename}`.strip
`strip #{args} -o #{tmp} #{path}`
`cat #{tmp} > #{path}`
@ -271,13 +271,13 @@ private
def clean_file path
perms=0444
case `file -h #{path}`
when /Mach-O dynamically linked shared library/
strip path, '-SxX'
when /Mach-O [^ ]* ?executable/
strip path
perms=0544
when /script text executable/
perms=0544
when /Mach-O dynamically linked shared library/
strip path, '-SxX'
when /Mach-O [^ ]* ?executable/
strip path
perms=0555
when /script text executable/
perms=0555
end
path.chmod perms
end

View File

@ -42,9 +42,9 @@ def onoe error
end
def pretty_duration s
return "#{(s*1000).to_i} milliseconds" if s < 3
return "#{s.to_i} seconds" if s < 10*60
return "#{(s/60).to_i} minutes"
return "2 seconds" if s < 3 # avoids the plural problem ;)
return "#{s.to_i} seconds" if s < 120
return "%.1f minutes" % (s/60)
end
def interactive_shell