From 4a48297d1c0a5721371405091f89fffd484d776e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 6 Aug 2018 15:39:52 +0200 Subject: [PATCH] Fix cleanup for files with `--`. --- Library/Homebrew/cleanup.rb | 2 +- Library/Homebrew/test/cleanup_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 0b4d97d59e..d08c586718 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -83,7 +83,7 @@ module Homebrew version = file.version end next unless version - next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1]) + next unless (name = file.basename.to_s[/\A(.*?)\-\-?(?:#{Regexp.escape(version)})/, 1]) next unless HOMEBREW_CELLAR.directory? diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index 40ab4280b7..2ad1858da3 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -226,8 +226,8 @@ describe Homebrew::Cleanup do end context "cleans old files in HOMEBREW_CACHE" do - let(:bottle) { (HOMEBREW_CACHE/"testball-0.0.1.bottle.tar.gz") } - let(:testball) { (HOMEBREW_CACHE/"testball-0.0.1") } + let(:bottle) { (HOMEBREW_CACHE/"testball--0.0.1.bottle.tar.gz") } + let(:testball) { (HOMEBREW_CACHE/"testball--0.0.1") } before do FileUtils.touch(bottle)