Revert "Fix permissions before moving extracted files."
This commit is contained in:
		
							parent
							
								
									ddd328ed7d
								
							
						
					
					
						commit
						d292dbdc2b
					
				@ -491,7 +491,6 @@ module Cask
 | 
			
		||||
      Dir.mktmpdir do |tmpdir|
 | 
			
		||||
        tmpdir = Pathname(tmpdir)
 | 
			
		||||
        primary_container.extract_nestedly(to: tmpdir, basename: downloaded_path.basename, verbose: false)
 | 
			
		||||
 | 
			
		||||
        artifacts.each do |artifact|
 | 
			
		||||
          path = case artifact
 | 
			
		||||
          when Artifact::Moved
 | 
			
		||||
@ -502,6 +501,7 @@ module Cask
 | 
			
		||||
          next unless path.exist?
 | 
			
		||||
 | 
			
		||||
          result = system_command("codesign", args: ["--verify", path], print_stderr: false)
 | 
			
		||||
 | 
			
		||||
          next if result.success?
 | 
			
		||||
 | 
			
		||||
          message = "Signature verification failed:\n#{result.merged_output}\nmacOS on ARM requires applications " \
 | 
			
		||||
 | 
			
		||||
@ -95,10 +95,10 @@ class AbstractDownloadStrategy
 | 
			
		||||
  # @api public
 | 
			
		||||
  def stage(&block)
 | 
			
		||||
    UnpackStrategy.detect(cached_location,
 | 
			
		||||
                          prioritize_extension: true,
 | 
			
		||||
                          prioritise_extension: true,
 | 
			
		||||
                          ref_type: @ref_type, ref: @ref)
 | 
			
		||||
                  .extract_nestedly(basename:             basename,
 | 
			
		||||
                                    prioritize_extension: true,
 | 
			
		||||
                                    prioritise_extension: true,
 | 
			
		||||
                                    verbose:              verbose? && !quiet?)
 | 
			
		||||
    chdir(&block) if block
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -104,10 +104,10 @@ module UnpackStrategy
 | 
			
		||||
    strategies.find { |s| s.can_extract?(path) }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.detect(path, prioritize_extension: false, type: nil, ref_type: nil, ref: nil, merge_xattrs: nil)
 | 
			
		||||
  def self.detect(path, prioritise_extension: false, type: nil, ref_type: nil, ref: nil, merge_xattrs: nil)
 | 
			
		||||
    strategy = from_type(type) if type
 | 
			
		||||
 | 
			
		||||
    if prioritize_extension && path.extname.present?
 | 
			
		||||
    if prioritise_extension && path.extname.present?
 | 
			
		||||
      strategy ||= from_extension(path.extname)
 | 
			
		||||
      strategy ||= strategies.select { |s| s < Directory || s == Fossil }
 | 
			
		||||
                             .find { |s| s.can_extract?(path) }
 | 
			
		||||
@ -135,27 +135,14 @@ module UnpackStrategy
 | 
			
		||||
  def extract_to_dir(unpack_dir, basename:, verbose:); end
 | 
			
		||||
  private :extract_to_dir
 | 
			
		||||
 | 
			
		||||
  sig {
 | 
			
		||||
    params(
 | 
			
		||||
      to: T.nilable(Pathname), basename: T.nilable(T.any(String, Pathname)), verbose: T::Boolean,
 | 
			
		||||
    ).returns(T.untyped)
 | 
			
		||||
  }
 | 
			
		||||
  def extract(to: nil, basename: nil, verbose: false)
 | 
			
		||||
  def extract(to: nil, basename: nil, verbose: nil)
 | 
			
		||||
    basename ||= path.basename
 | 
			
		||||
    unpack_dir = Pathname(to || Dir.pwd).expand_path
 | 
			
		||||
    unpack_dir.mkpath
 | 
			
		||||
    extract_to_dir(unpack_dir, basename: Pathname(basename), verbose: verbose)
 | 
			
		||||
    extract_to_dir(unpack_dir, basename: Pathname(basename), verbose: verbose || false)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig {
 | 
			
		||||
    params(
 | 
			
		||||
      to:                   T.nilable(Pathname),
 | 
			
		||||
      basename:             T.nilable(T.any(String, Pathname)),
 | 
			
		||||
      verbose:              T::Boolean,
 | 
			
		||||
      prioritize_extension: T::Boolean,
 | 
			
		||||
    ).returns(T.untyped)
 | 
			
		||||
  }
 | 
			
		||||
  def extract_nestedly(to: nil, basename: nil, verbose: false, prioritize_extension: false)
 | 
			
		||||
  def extract_nestedly(to: nil, basename: nil, verbose: false, prioritise_extension: false)
 | 
			
		||||
    Dir.mktmpdir do |tmp_unpack_dir|
 | 
			
		||||
      tmp_unpack_dir = Pathname(tmp_unpack_dir)
 | 
			
		||||
 | 
			
		||||
@ -166,14 +153,15 @@ module UnpackStrategy
 | 
			
		||||
      if children.count == 1 && !children.first.directory?
 | 
			
		||||
        FileUtils.chmod "+rw", children.first, verbose: verbose
 | 
			
		||||
 | 
			
		||||
        s = UnpackStrategy.detect(children.first, prioritize_extension: prioritize_extension)
 | 
			
		||||
        s = UnpackStrategy.detect(children.first, prioritise_extension: prioritise_extension)
 | 
			
		||||
 | 
			
		||||
        s.extract_nestedly(to: to, verbose: verbose, prioritize_extension: prioritize_extension)
 | 
			
		||||
        s.extract_nestedly(to: to, verbose: verbose, prioritise_extension: prioritise_extension)
 | 
			
		||||
        next
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      FileUtils.chmod_R "+w", tmp_unpack_dir, force: true, verbose: verbose
 | 
			
		||||
      Directory.new(tmp_unpack_dir).extract(to: to, verbose: verbose)
 | 
			
		||||
 | 
			
		||||
      FileUtils.chmod_R "+w", tmp_unpack_dir, force: true, verbose: verbose
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -8,22 +8,14 @@ module UnpackStrategy
 | 
			
		||||
 | 
			
		||||
    include UnpackStrategy
 | 
			
		||||
 | 
			
		||||
    sig {
 | 
			
		||||
      params(
 | 
			
		||||
        to:                   T.nilable(Pathname),
 | 
			
		||||
        basename:             T.nilable(T.any(String, Pathname)),
 | 
			
		||||
        verbose:              T::Boolean,
 | 
			
		||||
        prioritize_extension: T::Boolean,
 | 
			
		||||
      ).returns(T.untyped)
 | 
			
		||||
    }
 | 
			
		||||
    def extract_nestedly(to: nil, basename: nil, verbose: false, prioritize_extension: false)
 | 
			
		||||
      extract(to: to, basename: basename, verbose: verbose)
 | 
			
		||||
    def extract_nestedly(prioritise_extension: false, **options)
 | 
			
		||||
      extract(**options)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    private
 | 
			
		||||
 | 
			
		||||
    sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) }
 | 
			
		||||
    def extract_to_dir(unpack_dir, basename:, verbose: false)
 | 
			
		||||
    def extract_to_dir(unpack_dir, basename:, verbose:)
 | 
			
		||||
      FileUtils.cp path, unpack_dir/basename, preserve: true, verbose: verbose
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user