Skip to content

Commit e06b5a5

Browse files
committed
util-linux: update 2.40.2 bottle.
1 parent c987969 commit e06b5a5

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

Formula/u/util-linux.rb

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
class UtilLinux < Formula
2+
desc "Collection of Linux utilities"
3+
homepage "https://github.com/util-linux/util-linux"
4+
url "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.40/util-linux-2.40.2.tar.xz"
5+
sha256 "d78b37a66f5922d70edf3bdfb01a6b33d34ed3c3cafd6628203b2a2b67c8e8b3"
6+
license all_of: [
7+
"BSD-3-Clause",
8+
"BSD-4-Clause-UC",
9+
"GPL-2.0-only",
10+
"GPL-2.0-or-later",
11+
"GPL-3.0-or-later",
12+
"LGPL-2.1-or-later",
13+
:public_domain,
14+
]
15+
16+
# The directory listing where the `stable` archive is found uses major/minor
17+
# version directories, where it's necessary to check inside a directory to
18+
# find the full version. The newest directory can contain unstable versions,
19+
# so it could require more than two requests to identify the newest stable
20+
# version. With this in mind, we simply check the Git tags as a best effort.
21+
livecheck do
22+
url :homepage
23+
regex(/^v?(\d+(?:\.\d+)+)$/i)
24+
end
25+
26+
bottle do
27+
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/util-linux-2.40.2"
28+
sha256 cellar: :any_skip_relocation, aarch64_linux: "b8bc2ea08d8e4436bd332fa03c98d7642f04a1b6e4eca1e29f00f5f3eaf91583"
29+
end
30+
31+
keg_only :shadowed_by_macos, "macOS provides the uuid.h header"
32+
33+
depends_on "pkg-config" => :build
34+
35+
uses_from_macos "libxcrypt"
36+
uses_from_macos "ncurses"
37+
uses_from_macos "sqlite"
38+
uses_from_macos "zlib"
39+
40+
on_macos do
41+
depends_on "gettext" # for libintl
42+
end
43+
44+
on_linux do
45+
depends_on "readline"
46+
47+
conflicts_with "bash-completion", because: "both install `mount`, `rfkill`, and `rtcwake` completions"
48+
conflicts_with "flock", because: "both install `flock` binaries"
49+
conflicts_with "ossp-uuid", because: "both install `uuid.3` file"
50+
conflicts_with "rename", because: "both install `rename` binaries"
51+
end
52+
53+
# uuid_time function compatibility fix on macos
54+
# upstream patch PR, https://github.com/util-linux/util-linux/pull/3013
55+
patch do
56+
url "https://github.com/util-linux/util-linux/commit/9445f477cfcfb3615ffde8f93b1b98c809ee4eca.patch?full_index=1"
57+
sha256 "7a7fe4d32806e59f90ca0eb33a9b4eb306e59c9c148493cd6a57f0dea3eafc64"
58+
end
59+
60+
def install
61+
args = %w[--disable-silent-rules --disable-asciidoc]
62+
63+
if OS.mac?
64+
# Support very old ncurses used on macOS 13 and earlier
65+
# https://github.com/util-linux/util-linux/issues/2389
66+
ENV.append_to_cflags "-D_XOPEN_SOURCE_EXTENDED" if MacOS.version <= :ventura
67+
68+
args << "--disable-ipcs" # does not build on macOS
69+
args << "--disable-ipcrm" # does not build on macOS
70+
args << "--disable-wall" # already comes with macOS
71+
args << "--disable-liblastlog2" # does not build on macOS
72+
args << "--disable-libmount" # does not build on macOS
73+
args << "--enable-libuuid" # conflicts with ossp-uuid
74+
else
75+
args << "--disable-use-tty-group" # Fix chgrp: changing group of 'wall': Operation not permitted
76+
args << "--disable-kill" # Conflicts with coreutils.
77+
args << "--without-systemd" # Do not install systemd files
78+
args << "--with-bashcompletiondir=#{bash_completion}"
79+
args << "--disable-chfn-chsh"
80+
args << "--disable-login"
81+
args << "--disable-su"
82+
args << "--disable-runuser"
83+
args << "--disable-makeinstall-chown"
84+
args << "--disable-makeinstall-setuid"
85+
args << "--without-python"
86+
end
87+
88+
system "./configure", *args, *std_configure_args.reject { |s| s["--disable-debug"] }
89+
system "make", "install"
90+
91+
# install completions only for installed programs
92+
Pathname.glob("bash-completion/*") do |prog|
93+
bash_completion.install prog if (bin/prog.basename).exist? || (sbin/prog.basename).exist?
94+
end
95+
end
96+
97+
def caveats
98+
linux_only_bins = %w[
99+
addpart agetty
100+
blkdiscard blkzone blockdev
101+
chcpu chmem choom chrt ctrlaltdel
102+
delpart dmesg
103+
eject
104+
fallocate fdformat fincore findmnt fsck fsfreeze fstrim
105+
hwclock
106+
ionice ipcrm ipcs
107+
kill
108+
last ldattach losetup lsblk lscpu lsipc lslocks lslogins lsmem lsns
109+
mount mountpoint
110+
nsenter
111+
partx pivot_root prlimit
112+
raw readprofile resizepart rfkill rtcwake
113+
script scriptlive setarch setterm sulogin swapoff swapon switch_root
114+
taskset
115+
umount unshare utmpdump uuidd
116+
wall wdctl
117+
zramctl
118+
]
119+
on_macos do
120+
<<~EOS
121+
The following tools are not supported for macOS, and are therefore not included:
122+
#{Formatter.columns(linux_only_bins)}
123+
EOS
124+
end
125+
end
126+
127+
test do
128+
stat = File.stat "/usr"
129+
owner = Etc.getpwuid(stat.uid).name
130+
group = Etc.getgrgid(stat.gid).name
131+
132+
flags = ["x", "w", "r"] * 3
133+
perms = flags.each_with_index.reduce("") do |sum, (flag, index)|
134+
sum.insert 0, ((stat.mode & (2 ** index)).zero? ? "-" : flag)
135+
end
136+
137+
out = shell_output("#{bin}/namei -lx /usr").split("\n").last.split
138+
assert_equal ["d#{perms}", owner, group, "usr"], out
139+
end
140+
end

0 commit comments

Comments
 (0)