Merge pull request #10430 from hyuraku/delete_HOMEBREW_REPOSITORY_and_some_variables
delete some variables after Homebrew 2.7.0 is released.
This commit is contained in:
		
						commit
						565becc904
					
				@ -175,13 +175,11 @@ class FormulaInstaller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    bottle = formula.bottle_specification
 | 
					    bottle = formula.bottle_specification
 | 
				
			||||||
    unless bottle.compatible_locations?
 | 
					    unless bottle.compatible_locations?
 | 
				
			||||||
      # TODO: delete HOMEBREW_REPOSITORY reference after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
      if output_warning
 | 
					      if output_warning
 | 
				
			||||||
        opoo <<~EOS
 | 
					        opoo <<~EOS
 | 
				
			||||||
          Building #{formula.full_name} from source as the bottle needs:
 | 
					          Building #{formula.full_name} from source as the bottle needs:
 | 
				
			||||||
          - HOMEBREW_CELLAR: #{bottle.cellar} (yours is #{HOMEBREW_CELLAR})
 | 
					          - HOMEBREW_CELLAR: #{bottle.cellar} (yours is #{HOMEBREW_CELLAR})
 | 
				
			||||||
          - HOMEBREW_PREFIX: #{bottle.prefix} (yours is #{HOMEBREW_PREFIX})
 | 
					          - HOMEBREW_PREFIX: #{bottle.prefix} (yours is #{HOMEBREW_PREFIX})
 | 
				
			||||||
          - HOMEBREW_REPOSITORY: #{bottle.repository} (yours is #{HOMEBREW_REPOSITORY})
 | 
					 | 
				
			||||||
        EOS
 | 
					        EOS
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      return false
 | 
					      return false
 | 
				
			||||||
 | 
				
			|||||||
@ -7,13 +7,8 @@ class Keg
 | 
				
			|||||||
  REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@"
 | 
					  REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@"
 | 
				
			||||||
  LIBRARY_PLACEHOLDER = "@@HOMEBREW_LIBRARY@@"
 | 
					  LIBRARY_PLACEHOLDER = "@@HOMEBREW_LIBRARY@@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # TODO: delete this after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
  REPOSITORY_LIBRARY_PLACEHOLDER = "#{REPOSITORY_PLACEHOLDER}/Library"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Relocation = Struct.new(:old_prefix, :old_cellar, :old_repository, :old_library,
 | 
					  Relocation = Struct.new(:old_prefix, :old_cellar, :old_repository, :old_library,
 | 
				
			||||||
                          :new_prefix, :new_cellar, :new_repository, :new_library,
 | 
					                          :new_prefix, :new_cellar, :new_repository, :new_library) do
 | 
				
			||||||
                          # TODO: delete these after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
                          :old_repository_library, :new_repository_library) do
 | 
					 | 
				
			||||||
    # Use keyword args instead of positional args for initialization.
 | 
					    # Use keyword args instead of positional args for initialization.
 | 
				
			||||||
    def initialize(**kwargs)
 | 
					    def initialize(**kwargs)
 | 
				
			||||||
      super(*members.map { |k| kwargs[k] })
 | 
					      super(*members.map { |k| kwargs[k] })
 | 
				
			||||||
@ -47,14 +42,10 @@ class Keg
 | 
				
			|||||||
      old_cellar:     HOMEBREW_CELLAR.to_s,
 | 
					      old_cellar:     HOMEBREW_CELLAR.to_s,
 | 
				
			||||||
      new_prefix:     PREFIX_PLACEHOLDER,
 | 
					      new_prefix:     PREFIX_PLACEHOLDER,
 | 
				
			||||||
      new_cellar:     CELLAR_PLACEHOLDER,
 | 
					      new_cellar:     CELLAR_PLACEHOLDER,
 | 
				
			||||||
      # TODO: delete these after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
      old_library:    HOMEBREW_LIBRARY.to_s,
 | 
					 | 
				
			||||||
      new_library:    REPOSITORY_LIBRARY_PLACEHOLDER,
 | 
					 | 
				
			||||||
      old_repository: HOMEBREW_REPOSITORY.to_s,
 | 
					      old_repository: HOMEBREW_REPOSITORY.to_s,
 | 
				
			||||||
      new_repository: REPOSITORY_PLACEHOLDER,
 | 
					      new_repository: REPOSITORY_PLACEHOLDER,
 | 
				
			||||||
      # TODO: add these after Homebrew 2.7.0 is released.
 | 
					      old_library:    HOMEBREW_LIBRARY.to_s,
 | 
				
			||||||
      # old_library:    HOMEBREW_LIBRARY.to_s,
 | 
					      new_library:    LIBRARY_PLACEHOLDER,
 | 
				
			||||||
      # new_library:    LIBRARY_PLACEHOLDER,
 | 
					 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    relocate_dynamic_linkage(relocation)
 | 
					    relocate_dynamic_linkage(relocation)
 | 
				
			||||||
    replace_text_in_files(relocation)
 | 
					    replace_text_in_files(relocation)
 | 
				
			||||||
@ -62,17 +53,14 @@ class Keg
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  def replace_placeholders_with_locations(files, skip_linkage: false)
 | 
					  def replace_placeholders_with_locations(files, skip_linkage: false)
 | 
				
			||||||
    relocation = Relocation.new(
 | 
					    relocation = Relocation.new(
 | 
				
			||||||
      old_prefix:             PREFIX_PLACEHOLDER,
 | 
					      old_prefix:     PREFIX_PLACEHOLDER,
 | 
				
			||||||
      old_cellar:             CELLAR_PLACEHOLDER,
 | 
					      old_cellar:     CELLAR_PLACEHOLDER,
 | 
				
			||||||
      old_repository:         REPOSITORY_PLACEHOLDER,
 | 
					      old_repository: REPOSITORY_PLACEHOLDER,
 | 
				
			||||||
      old_library:            LIBRARY_PLACEHOLDER,
 | 
					      old_library:    LIBRARY_PLACEHOLDER,
 | 
				
			||||||
      new_prefix:             HOMEBREW_PREFIX.to_s,
 | 
					      new_prefix:     HOMEBREW_PREFIX.to_s,
 | 
				
			||||||
      new_cellar:             HOMEBREW_CELLAR.to_s,
 | 
					      new_cellar:     HOMEBREW_CELLAR.to_s,
 | 
				
			||||||
      new_repository:         HOMEBREW_REPOSITORY.to_s,
 | 
					      new_repository: HOMEBREW_REPOSITORY.to_s,
 | 
				
			||||||
      new_library:            HOMEBREW_LIBRARY.to_s,
 | 
					      new_library:    HOMEBREW_LIBRARY.to_s,
 | 
				
			||||||
      # TODO: delete these after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
      old_repository_library: REPOSITORY_LIBRARY_PLACEHOLDER,
 | 
					 | 
				
			||||||
      new_repository_library: HOMEBREW_LIBRARY.to_s,
 | 
					 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    relocate_dynamic_linkage(relocation) unless skip_linkage
 | 
					    relocate_dynamic_linkage(relocation) unless skip_linkage
 | 
				
			||||||
    replace_text_in_files(relocation, files: files)
 | 
					    replace_text_in_files(relocation, files: files)
 | 
				
			||||||
@ -86,11 +74,9 @@ class Keg
 | 
				
			|||||||
      s = first.open("rb", &:read)
 | 
					      s = first.open("rb", &:read)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      replacements = {
 | 
					      replacements = {
 | 
				
			||||||
        relocation.old_prefix             => relocation.new_prefix,
 | 
					        relocation.old_prefix  => relocation.new_prefix,
 | 
				
			||||||
        relocation.old_cellar             => relocation.new_cellar,
 | 
					        relocation.old_cellar  => relocation.new_cellar,
 | 
				
			||||||
        relocation.old_library            => relocation.new_library,
 | 
					        relocation.old_library => relocation.new_library,
 | 
				
			||||||
        # TODO: delete this after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
        relocation.old_repository_library => relocation.new_repository_library,
 | 
					 | 
				
			||||||
      }.compact
 | 
					      }.compact
 | 
				
			||||||
      # when HOMEBREW_PREFIX == HOMEBREW_REPOSITORY we should use HOMEBREW_PREFIX for all relocations to avoid
 | 
					      # when HOMEBREW_PREFIX == HOMEBREW_REPOSITORY we should use HOMEBREW_PREFIX for all relocations to avoid
 | 
				
			||||||
      # being unable to differentiate between them.
 | 
					      # being unable to differentiate between them.
 | 
				
			||||||
 | 
				
			|||||||
@ -385,17 +385,7 @@ class BottleSpecification
 | 
				
			|||||||
    compatible_cellar = cellar == HOMEBREW_CELLAR.to_s
 | 
					    compatible_cellar = cellar == HOMEBREW_CELLAR.to_s
 | 
				
			||||||
    compatible_prefix = prefix == HOMEBREW_PREFIX.to_s
 | 
					    compatible_prefix = prefix == HOMEBREW_PREFIX.to_s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Only check the repository matches if the prefix is the default.
 | 
					    compatible_cellar && compatible_prefix
 | 
				
			||||||
    # This is because the bottle DSL does not allow setting a custom repository
 | 
					 | 
				
			||||||
    # but does allow setting a custom prefix.
 | 
					 | 
				
			||||||
    # TODO: delete this after Homebrew 2.7.0 is released.
 | 
					 | 
				
			||||||
    compatible_repository = if Homebrew.default_prefix?(prefix)
 | 
					 | 
				
			||||||
      repository == HOMEBREW_REPOSITORY.to_s
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      true
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    compatible_cellar && compatible_prefix && compatible_repository
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Does the {Bottle} this {BottleSpecification} belongs to need to be relocated?
 | 
					  # Does the {Bottle} this {BottleSpecification} belongs to need to be relocated?
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user