Fix SVN downloads of versioned formula by munging directory names

This commit is contained in:
Andrew Janke 2018-06-19 20:13:43 -04:00
parent 25542d7398
commit b72c4e3248
2 changed files with 15 additions and 1 deletions

View File

@ -665,6 +665,10 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
@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

View File

@ -66,8 +66,18 @@ class Resource
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