homebrew-core/Formula/btrfs-progs.rb

57 lines
2.0 KiB
Ruby

class BtrfsProgs < Formula
desc "Userspace utilities to manage btrfs filesystems"
homepage "https://btrfs.wiki.kernel.org/index.php/Main_Page"
url "https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v6.1.3.tar.xz"
sha256 "d37fc9ec4fa5778b20aa7548fe706eb3a300338c1473318271ae54024dac7167"
license all_of: [
"GPL-2.0-only",
"LGPL-2.1-or-later", # libbtrfsutil
]
livecheck do
url "https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/"
regex(/href=.*?btrfs-progs[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "9dae11900cbd2374ce820588da084dec3a98bc1a7b7fea55ff90f1470d46f6d7"
end
depends_on "pkg-config" => :build
depends_on "python@3.11" => [:build, :test]
depends_on "sphinx-doc" => :build
depends_on "e2fsprogs"
depends_on :linux
depends_on "lzo"
depends_on "systemd" # for libudev
depends_on "util-linux"
depends_on "zlib"
depends_on "zstd"
def install
system "./configure", "--disable-python", *std_configure_args
# Override `udevdir` since Homebrew's `pkg-config udev --variable=udevdir` output
# is #{Formula["systemd"].lib}/udev. This path is used to install udev rules.
system "make", "install", "V=1", "udevdir=#{lib}/udev"
bash_completion.install "btrfs-completion" => "btrfs"
# We don't use the make target `install_python` due to Homebrew's prefix scheme patch
cd "libbtrfsutil/python" do
python3 = "python3.11"
system python3, *Language::Python.setup_install_args(prefix, python3)
end
end
test do
device = testpath/"test.img"
system "truncate", "-s", "128M", device
output = shell_output("#{bin}/mkfs.btrfs #{device}")
assert_match(/Filesystem size:\s*128\.00MiB/, output)
output = shell_output("#{bin}/btrfs filesystem show #{device}")
assert_match "Total devices 1 FS bytes used 144.00KiB", output
system "python3.11", "-c", "import btrfsutil"
end
end