<commit_before>class Mongodb < Formula
  desc "High-performance, schema-free, document-oriented database"
  homepage "https://www.mongodb.com/"
  url "https://fastdl.mongodb.org/src/mongodb-src-r4.0.5.tar.gz"
  sha256 "d967098fc91d105cdb0f400c8b837e5c2795c3638d7720392bc47afb1efe1c10"

  bottle do
    cellar :any_skip_relocation
    sha256 "818967509c594d1214a822115db6e2ff00a06772d5aee7296603e51526f6bbd1" => :mojave
    sha256 "3f2a93e91ce14ce7dd7699cb486466c37de47b6a3066c00b9e913629ad419ae7" => :high_sierra
    sha256 "67c32659f6ac1fb5cc7e79de8a95a34a946e115a0bf7354b1e0d15edd0fd125c" => :sierra
  end

  depends_on "go" => :build
  depends_on "pkg-config" => :build
  depends_on "scons" => :build
  depends_on :xcode => ["8.3.2", :build]
  depends_on :macos => :mountain_lion
  depends_on "openssl"
  depends_on "python@2"

  resource "Cheetah" do
    url "https://files.pythonhosted.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz"
    sha256 "be308229f0c1e5e5af4f27d7ee06d90bb19e6af3059794e5fd536a6f29a9b550"
  end

  resource "PyYAML" do
    url "https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz"
    sha256 "3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf"
  end

  resource "typing" do
    url "https://files.pythonhosted.org/packages/bf/9b/2bf84e841575b633d8d91ad923e198a415e3901f228715524689495b4317/typing-3.6.6.tar.gz"
    sha256 "4027c5f6127a6267a435201981ba156de91ad0d1d98e9ddc2aa173453453492d"
  end

  needs :cxx11

  def install
    ENV.cxx11 if MacOS.version < :mavericks

    ENV.libcxx

    ["Cheetah", "PyYAML", "typing"].each do |r|
      resource(r).stage do
        system "python", *Language::Python.setup_install_args(buildpath/"vendor")
      end
    end
    (buildpath/".brew_home/Library/Python/2.7/lib/python/site-packages/vendor.pth").write <<~EOS
      import site; site.addsitedir("#{buildpath}/vendor/lib/python2.7/site-packages")
    EOS

    # New Go tools have their own build script but the server scons "install" target is still
    # responsible for installing them.

    cd "src/mongo/gotools/src/github.com/mongodb/mongo-tools" do
      ENV["CPATH"] = Formula["openssl"].opt_include
      ENV["LIBRARY_PATH"] = Formula["openssl"].opt_lib
      ENV["GOROOT"] = Formula["go"].opt_libexec
      system "./build.sh", "ssl"
    end

    (buildpath/"src/mongo-tools").install Dir["src/mongo/gotools/src/github.com/mongodb/mongo-tools/bin/*"]

    args = %W[
      --prefix=#{prefix}
      -j#{ENV.make_jobs}
      CC=#{ENV.cc}
      CXX=#{ENV.cxx}
      CCFLAGS=-mmacosx-version-min=#{MacOS.version}
      LINKFLAGS=-mmacosx-version-min=#{MacOS.version}
      --build-mongoreplay=true<commit_msg>mongodb: downgrade to open source version.<commit_after>class Mongodb < Formula
  desc "High-performance, schema-free, document-oriented database"
  homepage "https://www.mongodb.com/"
  # do not upgrade to versions >4.0.3 as they are under the SSPL which is not
  # an open-source license.
  url "https://fastdl.mongodb.org/src/mongodb-src-r4.0.3.tar.gz"
  sha256 "fbbe840e62376fe850775e98eb10fdf40594a023ecf308abec6dcec44d2bce0c"
  revision 1

  bottle do
    cellar :any_skip_relocation
    sha256 "818967509c594d1214a822115db6e2ff00a06772d5aee7296603e51526f6bbd1" => :mojave
    sha256 "3f2a93e91ce14ce7dd7699cb486466c37de47b6a3066c00b9e913629ad419ae7" => :high_sierra
    sha256 "67c32659f6ac1fb5cc7e79de8a95a34a946e115a0bf7354b1e0d15edd0fd125c" => :sierra
  end

  depends_on "go" => :build
  depends_on "pkg-config" => :build
  depends_on "scons" => :build
  depends_on :xcode => ["8.3.2", :build]
  depends_on :macos => :mountain_lion
  depends_on "openssl"
  depends_on "python@2"

  resource "Cheetah" do
    url "https://files.pythonhosted.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz"
    sha256 "be308229f0c1e5e5af4f27d7ee06d90bb19e6af3059794e5fd536a6f29a9b550"
  end

  resource "PyYAML" do
    url "https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz"
    sha256 "3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf"
  end

  resource "typing" do
    url "https://files.pythonhosted.org/packages/bf/9b/2bf84e841575b633d8d91ad923e198a415e3901f228715524689495b4317/typing-3.6.6.tar.gz"
    sha256 "4027c5f6127a6267a435201981ba156de91ad0d1d98e9ddc2aa173453453492d"
  end

  needs :cxx11

  def install
    ENV.cxx11 if MacOS.version < :mavericks

    ENV.libcxx

    ["Cheetah", "PyYAML", "typing"].each do |r|
      resource(r).stage do
        system "python", *Language::Python.setup_install_args(buildpath/"vendor")
      end
    end
    (buildpath/".brew_home/Library/Python/2.7/lib/python/site-packages/vendor.pth").write <<~EOS
      import site; site.addsitedir("#{buildpath}/vendor/lib/python2.7/site-packages")
    EOS

    # New Go tools have their own build script but the server scons "install" target is still
    # responsible for installing them.
    cd "src/mongo/gotools" do
      inreplace "build.sh" do |s|
        s.gsub! "$(git describe)", version.to_s
        s.gsub! "$(git rev-parse HEAD)", "homebrew"
      end
      ENV["CPATH"] = Formula["openssl"].opt_include
      ENV["LIBRARY_PATH"] = Formula["openssl"].opt_lib
      ENV["GOROOT"] = Formula["go"].opt_libexec
      system "./build.sh", "ssl"
    end

    (buildpath/"src/mongo-tools").install Dir["src/mongo/gotools/bin/*"]

    args = %W[
      --prefix=#{prefix}
      -j#{ENV.make_jobs}
      CC=#{ENV.cc}
      CXX=#{ENV.cxx}
      CCFLAGS=-mmacosx-version-min=#{MacOS.version}
      LINKFLAGS=-mmacosx-version-min=#{MacOS.version}
      --build-mongoreplay=true
{'fraction_non_alphanumeric': 0.12165197857266287, 'fraction_numerical': 0.1598410229825471, 'mean_word_length': 4.1085613415710505, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7512696', 'n_tokens_mistral': 2925, 'n_tokens_neox': 2435, 'n_words': 324}