<commit_before>class Rpm < Formula
  desc "Standard unix software packaging tool"
  homepage "https://rpm.org/"
  url "http://ftp.rpm.org/releases/rpm-4.17.x/rpm-4.17.0.tar.bz2"
  mirror "https://ftp.osuosl.org/pub/rpm/releases/rpm-4.17.x/rpm-4.17.0.tar.bz2"
  sha256 "2e0d220b24749b17810ed181ac1ed005a56bbb6bc8ac429c21f314068dc65e6a"
  license "GPL-2.0-only"
  version_scheme 1

  livecheck do
    url "https://rpm.org/download.html"
    regex(/href=.*?rpm[._-]v?(\d+(?:\.\d+)+)\.t/i)
  end

  bottle do
    sha256 arm64_monterey: "dec1600907c7c9f4f60e133cc9f75ba72f57da692a5f3ca47c5d6429c52cfc5e"
    sha256 arm64_big_sur:  "c4b10772346b10fce44ecb909a27701d8bd209b834755fd38abc325bcad4c75e"
    sha256 monterey:       "0b379a488c105af62efe9e14e8508754d47bdc73334b0def3999278eee0321c9"
    sha256 big_sur:        "6f857111ed59bf5efb8f97ad26c7ed52fb8e70a92d2978dc7d2f6173d14675cd"
    sha256 catalina:       "29846a4e13dd2683318362442fe7a84c2b7cd71813291be24cc356bc657f8a8d"
    sha256 mojave:         "aeab2644677216b3d631a4a1abb3d75aada85152f7f85a550ab43943b934f994"
    sha256 x86_64_linux:   "1147c07948c53779fdf751623b349d6da6d6b4753103ce2c898da2cc68a0a041"
  end

  # We need autotools for the Lua patch below. Remove when the patch is no longer needed.
  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on "berkeley-db"
  depends_on "gettext"
  depends_on "libarchive"
  depends_on "libmagic"
  depends_on "libomp"
  depends_on "lua"
  depends_on "openssl@1.1"
  depends_on "pkg-config"
  depends_on "popt"
  depends_on "sqlite"
  depends_on "xz"
  depends_on "zstd"

  # Fix `fstat64` detection for Apple Silicon.
  # https://github.com/rpm-software-management/rpm/pull/1775
  # https://github.com/rpm-software-management/rpm/pull/1897
  if Hardware::CPU.arm?
    patch do
      url "https://github.com/rpm-software-management/rpm/commit/ad87ced3990c7e14b6b593fa411505e99412e248.patch?full_index=1"
      sha256 "a129345c6ba026b337fe647763874bedfcaf853e1994cf65b1b761bc2c7531ad"
    end
  end

  # Remove defunct Lua rex extension, which causes linking errors with Homebrew's Lua.
  # https://github.com/rpm-software-management/rpm/pull/1797/files
  patch do
    url "https://github.com/rpm-software-management/rpm/commit/83d781c442158ce61286ac68cc350d10c2d3837e.patch?full_index=1"
    sha256 "5dc9fb093ad46657575e5782d257d9b47d3c8119914283794464a84a7aef50b0"
  end

  def install
    ENV.append "CPPFLAGS", "-I#{Formula["lua"].opt_include}/lua"
    ENV.append "LDFLAGS", "-lomp"<commit_msg>rpm: drop `berkeley-db`<commit_after>class Rpm < Formula
  desc "Standard unix software packaging tool"
  homepage "https://rpm.org/"
  url "http://ftp.rpm.org/releases/rpm-4.17.x/rpm-4.17.0.tar.bz2"
  mirror "https://ftp.osuosl.org/pub/rpm/releases/rpm-4.17.x/rpm-4.17.0.tar.bz2"
  sha256 "2e0d220b24749b17810ed181ac1ed005a56bbb6bc8ac429c21f314068dc65e6a"
  license "GPL-2.0-only"
  revision 1
  version_scheme 1

  livecheck do
    url "https://rpm.org/download.html"
    regex(/href=.*?rpm[._-]v?(\d+(?:\.\d+)+)\.t/i)
  end

  bottle do
    sha256 arm64_monterey: "dec1600907c7c9f4f60e133cc9f75ba72f57da692a5f3ca47c5d6429c52cfc5e"
    sha256 arm64_big_sur:  "c4b10772346b10fce44ecb909a27701d8bd209b834755fd38abc325bcad4c75e"
    sha256 monterey:       "0b379a488c105af62efe9e14e8508754d47bdc73334b0def3999278eee0321c9"
    sha256 big_sur:        "6f857111ed59bf5efb8f97ad26c7ed52fb8e70a92d2978dc7d2f6173d14675cd"
    sha256 catalina:       "29846a4e13dd2683318362442fe7a84c2b7cd71813291be24cc356bc657f8a8d"
    sha256 mojave:         "aeab2644677216b3d631a4a1abb3d75aada85152f7f85a550ab43943b934f994"
    sha256 x86_64_linux:   "1147c07948c53779fdf751623b349d6da6d6b4753103ce2c898da2cc68a0a041"
  end

  # We need autotools for the Lua patch below. Remove when the patch is no longer needed.
  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on "gettext"
  depends_on "libarchive"
  depends_on "libmagic"
  depends_on "libomp"
  depends_on "lua"
  depends_on "openssl@1.1"
  depends_on "pkg-config"
  depends_on "popt"
  depends_on "sqlite"
  depends_on "xz"
  depends_on "zstd"

  uses_from_macos "bzip2"
  uses_from_macos "zlib"

  # Fix `fstat64` detection for Apple Silicon.
  # https://github.com/rpm-software-management/rpm/pull/1775
  # https://github.com/rpm-software-management/rpm/pull/1897
  if Hardware::CPU.arm?
    patch do
      url "https://github.com/rpm-software-management/rpm/commit/ad87ced3990c7e14b6b593fa411505e99412e248.patch?full_index=1"
      sha256 "a129345c6ba026b337fe647763874bedfcaf853e1994cf65b1b761bc2c7531ad"
    end
  end

  # Remove defunct Lua rex extension, which causes linking errors with Homebrew's Lua.
  # https://github.com/rpm-software-management/rpm/pull/1797/files
  patch do
    url "https://github.com/rpm-software-management/rpm/commit/83d781c442158ce61286ac68cc350d10c2d3837e.patch?full_index=1"
    sha256 "5dc9fb093ad46657575e5782d257d9b47d3c8119914283794464a84a7aef50b0"
  end

  def install
    ENV.append "CPPFLAGS", "-I#{Formula["lua"].opt_include}/lua"
    ENV.append "LDFLAGS", "-lomp"
{'fraction_non_alphanumeric': 0.10309477756286267, 'fraction_numerical': 0.20967117988394585, 'mean_word_length': 4.620652173913044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2917332', 'n_tokens_mistral': 2866, 'n_tokens_neox': 2268, 'n_words': 297}