Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SVN downloads of versioned formula by munging directory names #4358

Merged
merged 1 commit into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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