Merge pull request #15409 from TheMDev/master
Download Strategy Dependency Missing Case
This commit is contained in:
		
						commit
						d70ebaea3d
					
				@ -179,6 +179,8 @@ class DependencyCollector
 | 
			
		||||
    if strategy <= HomebrewCurlDownloadStrategy
 | 
			
		||||
      @deps << curl_dep_if_needed(tags)
 | 
			
		||||
      parse_url_spec(spec.url, tags)
 | 
			
		||||
    elsif strategy <= NoUnzipCurlDownloadStrategy
 | 
			
		||||
      # ensure NoUnzip never adds any dependencies
 | 
			
		||||
    elsif strategy <= CurlDownloadStrategy
 | 
			
		||||
      parse_url_spec(spec.url, tags)
 | 
			
		||||
    elsif strategy <= GitDownloadStrategy
 | 
			
		||||
@ -196,8 +198,7 @@ class DependencyCollector
 | 
			
		||||
    elsif strategy < AbstractDownloadStrategy
 | 
			
		||||
      # allow unknown strategies to pass through
 | 
			
		||||
    else
 | 
			
		||||
      raise TypeError,
 | 
			
		||||
            "#{strategy.inspect} is not an AbstractDownloadStrategy subclass"
 | 
			
		||||
      raise TypeError, "#{strategy.inspect} is not an AbstractDownloadStrategy subclass"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -209,7 +210,7 @@ class DependencyCollector
 | 
			
		||||
    when ".bz2"         then bzip2_dep_if_needed(tags)
 | 
			
		||||
    when ".lha", ".lzh" then Dependency.new("lha", tags)
 | 
			
		||||
    when ".lz"          then Dependency.new("lzip", tags)
 | 
			
		||||
    when ".rar"         then Dependency.new("unrar", tags)
 | 
			
		||||
    when ".rar"         then Dependency.new("libarchive", tags)
 | 
			
		||||
    when ".7z"          then Dependency.new("p7zip", tags)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -88,7 +88,7 @@ describe DependencyCollector do
 | 
			
		||||
    it "creates a resource dependency from a '.rar' URL" do
 | 
			
		||||
      resource = Resource.new
 | 
			
		||||
      resource.url("https://brew.sh/foo.rar")
 | 
			
		||||
      expect(collector.add(resource)).to eq(Dependency.new("unrar", [:build, :test]))
 | 
			
		||||
      expect(collector.add(resource)).to eq(Dependency.new("libarchive", [:build, :test]))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "raises a TypeError for unknown classes" do
 | 
			
		||||
 | 
			
		||||
@ -16,16 +16,16 @@ module UnpackStrategy
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def dependencies
 | 
			
		||||
      @dependencies ||= [Formula["unrar"]]
 | 
			
		||||
      @dependencies ||= [Formula["libarchive"]]
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    private
 | 
			
		||||
 | 
			
		||||
    sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) }
 | 
			
		||||
    def extract_to_dir(unpack_dir, basename:, verbose:)
 | 
			
		||||
      system_command! "unrar",
 | 
			
		||||
                      args:    ["x", "-inul", path, unpack_dir],
 | 
			
		||||
                      env:     { "PATH" => PATH.new(Formula["unrar"].opt_bin, ENV.fetch("PATH")) },
 | 
			
		||||
      system_command! "bsdtar",
 | 
			
		||||
                      args:    ["x", "-f", path, "-C", unpack_dir],
 | 
			
		||||
                      env:     { "PATH" => PATH.new(Formula["libarchive"].opt_bin, ENV.fetch("PATH")) },
 | 
			
		||||
                      verbose: verbose
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user