Skip to content

Commit

Permalink
acl: update 2.3.2 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Sep 3, 2024
1 parent 401fda6 commit 8117845
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions Formula/a/acl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
class Acl < Formula
desc "Commands for manipulating POSIX access control lists"
homepage "https://savannah.nongnu.org/projects/acl/"
url "https://download.savannah.nongnu.org/releases/acl/acl-2.3.2.tar.gz"
sha256 "5f2bdbad629707aa7d85c623f994aa8a1d2dec55a73de5205bac0bf6058a2f7c"
license all_of: ["GPL-2.0-or-later", "LGPL-2.1-or-later"]

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

bottle do
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/acl-2.3.2"
sha256 cellar: :any_skip_relocation, aarch64_linux: "069dc4dda946706fca0473c071c40e4a952f1d38c91a2950321f44b4f889aede"
end

depends_on "attr" => :build
depends_on :linux

def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make", "install"
end

test do
assert_equal "getfacl #{version}", shell_output("#{bin}/getfacl --version").chomp

touch testpath/"test.txt"
chmod 0654, testpath/"test.txt"
assert_equal <<~EOS, shell_output("#{bin}/getfacl --omit-header test.txt").chomp
user::rw-
group::r-x
other::r--
EOS

user = ENV["USER"]
system bin/"setfacl", "--modify=u:#{user}:x", "test.txt"
assert_equal <<~EOS, shell_output("#{bin}/getfacl --omit-header test.txt").chomp
user::rw-
user:#{user}:--x
group::r-x
mask::r-x
other::r--
EOS

system bin/"chacl", "u::rwx,g::rw-,o::r-x", "test.txt"
assert_equal <<~EOS, shell_output("#{bin}/getfacl --omit-header test.txt").chomp
user::rwx
group::rw-
other::r-x
EOS

(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <sys/acl.h>
int main() {
acl_t acl = acl_get_file("test.txt", ACL_TYPE_ACCESS);
if (acl == NULL) return 1;
char* acl_text = acl_to_text(acl, NULL);
acl_free(acl);
printf("%s\\n", acl_text);
acl_free(acl_text);
return 0;
}
EOS
system ENV.cc, "test.c", "-o", "test", "-I#{include}", "-L#{lib}", "-lacl"
assert_equal <<~EOS, shell_output("./test").chomp
user::rwx
group::rw-
other::r-x
EOS
end
end

0 comments on commit 8117845

Please sign in to comment.