Skip to content

Commit

Permalink
Merge pull request #4358 from apjanke/fix-subversion-download-of-vers…
Browse files Browse the repository at this point in the history
…ioned-formulae

Fix SVN downloads of versioned formula by munging directory names
  • Loading branch information
MikeMcQuaid authored Jun 25, 2018
2 parents 78757bf + b72c4e3 commit 7506abe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ def initialize(name, resource)
@url = @url.sub("svn+http://", "")
end

def cache_filename
Resource.safe_download_name("#{name}--#{cache_tag}")
end

def fetch
clear_cache unless @url.chomp("/") == repo_url || quiet_system("svn", "switch", @url, cached_location)
super
Expand Down
12 changes: 11 additions & 1 deletion Library/Homebrew/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,18 @@ def escaped_name
name.tr("/", "-")
end

def self.safe_download_name(str)
# "@" is a special character for Subversion. Keep it out of the cache dir name.
str.gsub("@", "-AT-")
end

def download_name
name.nil? ? owner.name : "#{owner.name}--#{escaped_name}"
raw_name = if name
"#{owner.name}--#{escaped_name}"
else
owner.name
end
Resource.safe_download_name(raw_name)
end

def cached_download
Expand Down

0 comments on commit 7506abe

Please sign in to comment.