build_legacy_indicies (Gem::Indexer)

    # File lib/rubygems/indexer.rb, line 138
      def build_legacy_indicies(index)
        progress = ui.progress_reporter index.size,
                                        "Generating YAML quick index gemspecs for #{index.size} gems",
                                        "Complete"

        Gem.time 'Generated YAML quick index gemspecs' do
          index.released_gems.each do |original_name, spec|
            spec_file_name = "#{original_name}.gemspec.rz"
            yaml_name = File.join @quick_dir, spec_file_name

            yaml_zipped = Gem.deflate spec.to_yaml
            open yaml_name, 'wb' do |io| io.write yaml_zipped end

            progress.updated original_name
          end

          progress.done
        end

        say "Generating quick index"

        Gem.time 'Generated quick index' do
          open @quick_index, 'wb' do |io|
            io.puts index.sort.map { |_, spec| spec.original_name }
          end
        end

        say "Generating latest index"

        Gem.time 'Generated latest index' do
          open @latest_index, 'wb' do |io|
            io.puts index.latest_specs.sort.map { |spec| spec.original_name }
          end
        end

        # Don't need prerelease legacy index

        say "Generating Marshal master index"

        Gem.time 'Generated Marshal master index' do
          open @marshal_index, 'wb' do |io|
            io.write index.dump
          end
        end

        progress = ui.progress_reporter index.size,
                                        "Generating YAML master index for #{index.size} gems (this may take a while)",
                                        "Complete"

        Gem.time 'Generated YAML master index' do
          open @master_index, 'wb' do |io|
            io.puts "--- !ruby/object:#{index.class}"
            io.puts "gems:"

            gems = index.sort_by { |name, gemspec| gemspec.sort_obj }
            gems.each do |original_name, gemspec|
              yaml = gemspec.to_yaml.gsub(/^/, '    ')
              yaml = yaml.sub(/\A    ---/, '') # there's a needed extra ' ' here
              io.print "  #{original_name}:"
              io.puts yaml

              progress.updated original_name
            end
          end

          progress.done
        end

        @files << @quick_dir
        @files << @master_index
        @files << "#{@master_index}.Z"
        @files << @marshal_index
        @files << "#{@marshal_index}.Z"
      end