From f1678f4c7bb2703b426cf90424541a1c5032e5b5 Mon Sep 17 00:00:00 2001
From: Alec Scott <hi@alecbcs.com>
Date: Mon, 17 Feb 2025 17:05:35 -0800
Subject: [PATCH] bfs: add v4.0.5 (#49049)

* bfs: add v4.0.5, liburing: v2.4, v2.9

* Re-enable bfs on developer tools pipelines
---
 .../spack.yaml                                |  4 +-
 .../stacks/developer-tools-darwin/spack.yaml  |  2 +-
 .../spack.yaml                                |  2 +-
 .../repos/builtin/packages/bfs/package.py     | 15 ++++++-
 .../builtin/packages/liburing/package.py      | 43 ++++++++++++++-----
 5 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-aarch64-linux-gnu/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-aarch64-linux-gnu/spack.yaml
index 1c2e7439e0a..4e2356c520e 100644
--- a/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-aarch64-linux-gnu/spack.yaml
+++ b/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-aarch64-linux-gnu/spack.yaml
@@ -38,7 +38,7 @@ spack:
     - ripgrep
     - gh
     - fd
-    # - bfs # liburing: /usr/include/linux/ipv6.h:19:8: error: redefinition of 'struct in6_pktinfo'
+    - bfs
     - fzf
     - tree
     - jq
@@ -82,4 +82,4 @@ spack:
         image: ghcr.io/spack/aarch64-linux-gnu:v2024-12-18
 
   cdash:
-    build-group: Developer Tools aarch64-linux-gnu
\ No newline at end of file
+    build-group: Developer Tools aarch64-linux-gnu
diff --git a/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-darwin/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-darwin/spack.yaml
index 4f3a61549e1..32c7c724268 100644
--- a/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-darwin/spack.yaml
+++ b/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-darwin/spack.yaml
@@ -37,7 +37,7 @@ spack:
     - ripgrep
     - gh
     - fd
-    # - bfs # liburing: /usr/include/linux/ipv6.h:19:8: error: redefinition of 'struct in6_pktinfo'
+    - bfs
     - fzf
     - tree
     - jq
diff --git a/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-x86_64_v3-linux-gnu/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-x86_64_v3-linux-gnu/spack.yaml
index 8c17c5f8266..48337e9cd46 100644
--- a/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-x86_64_v3-linux-gnu/spack.yaml
+++ b/share/spack/gitlab/cloud_pipelines/stacks/developer-tools-x86_64_v3-linux-gnu/spack.yaml
@@ -44,7 +44,7 @@ spack:
     - ripgrep
     - gh
     - fd
-    # - bfs # liburing: /usr/include/linux/ipv6.h:19:8: error: redefinition of 'struct in6_pktinfo'
+    - bfs
     - fzf
     - tree
     - jq
diff --git a/var/spack/repos/builtin/packages/bfs/package.py b/var/spack/repos/builtin/packages/bfs/package.py
index 45308b57069..4555d444071 100644
--- a/var/spack/repos/builtin/packages/bfs/package.py
+++ b/var/spack/repos/builtin/packages/bfs/package.py
@@ -6,15 +6,21 @@
 
 
 class Bfs(MakefilePackage):
-    """A breadth-first version of the UNIX find command."""
+    """BFS is a breadth-first variant of the UNIX find command that offers
+    consistent, intuitive behavior and improved performance."""
 
     homepage = "https://github.com/tavianator/bfs"
     url = "https://github.com/tavianator/bfs/archive/refs/tags/3.0.1.tar.gz"
+    git = "https://github.com/tavianator/bfs.git"
 
     maintainers("alecbcs")
 
     license("0BSD")
 
+    sanity_check_is_file = ["bin/bfs"]
+
+    version("main", branch="main")
+    version("4.0.5", sha256="f7d9ebff00d9a010a5d6cc9b7bf1933095d7e5c0b11a8ec48c96c7ed8f993e5f")
     version("4.0.4", sha256="209da9e9f43d8fe30fd689c189ea529e9d6b5358ce84a63a44721003aea3e1ca")
     version("4.0.1", sha256="8117b76b0a967887278a11470cbfa9e7aeae98f11a7eeb136f456ac462e5ba23")
     version("3.1.1", sha256="d73f345c1021e0630e0db930a3fa68dd1f968833037d8471ee1096e5040bf91b")
@@ -23,12 +29,16 @@ class Bfs(MakefilePackage):
     version("3.0.2", sha256="d3456a9aeecc031064db0dbe012e55a11eb97be88d0ab33a90e570fe66457f92")
     version("3.0.1", sha256="a38bb704201ed29f4e0b989fb2ab3791ca51c3eff90acfc31fff424579bbf962")
 
+    # Build dependencies
     depends_on("c", type="build")
 
+    # System dependencies
     depends_on("acl", when="platform=linux")
     depends_on("attr", when="platform=linux")
     depends_on("libcap", when="platform=linux")
-    depends_on("liburing", when="platform=linux @3.1:")
+    depends_on("liburing@2.4:", when="platform=linux @3.1:")
+
+    # Required dependencies
     depends_on("oniguruma")
 
     @run_before("build", when="@4:")
@@ -39,6 +49,7 @@ def configure(self):
         configure_exe(*args)
 
     def install(self, spec, prefix):
+        """Install the package."""
         if spec.satisfies("@:3"):
             make("install", f"PREFIX={prefix}")
         else:
diff --git a/var/spack/repos/builtin/packages/liburing/package.py b/var/spack/repos/builtin/packages/liburing/package.py
index a37551cfc47..690715e3f8f 100644
--- a/var/spack/repos/builtin/packages/liburing/package.py
+++ b/var/spack/repos/builtin/packages/liburing/package.py
@@ -2,27 +2,50 @@
 #
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 
-
 from spack.package import *
 
 
 class Liburing(AutotoolsPackage):
-    """This is the io_uring library, liburing. liburing provides helpers
-    to setup and teardown io_uring instances, and also a simplified interface
-    for applications that don't need (or want) to deal with the full kernel
-    side implementation."""
+    """Linux-native io_uring I/O access library.
+
+    liburing provides helpers to setup and teardown io_uring instances,
+    and a simplified interface for applications that don't need (or want)
+    to deal with the full kernel side implementation. It enables high-performance
+    asynchronous I/O operations on Linux systems supporting the io_uring
+    interface.
+    """
 
     homepage = "https://github.com/axboe/liburing"
     url = "https://github.com/axboe/liburing/archive/refs/tags/liburing-2.3.tar.gz"
     git = "https://github.com/axboe/liburing.git"
 
+    maintainers("alecbcs")
+
     license("LGPL-2.1-or-later OR MIT")
 
+    # Sanity checks
+    sanity_check_is_file = ["include/liburing.h", "lib/liburing.so"]
+    sanity_check_is_dir = ["include", "lib"]
+
+    # Versions
     version("master", branch="master")
+    version("2.9", sha256="897b1153b55543e8b92a5a3eb9b906537a5fedcf8afaf241f8b8787940c79f8d")
+    version("2.4", sha256="2398ec82d967a6f903f3ae1fd4541c754472d3a85a584dc78c5da2fabc90706b")
     version("2.3", sha256="60b367dbdc6f2b0418a6e0cd203ee0049d9d629a36706fcf91dfb9428bae23c8")
 
-    depends_on("c", type="build")  # generated
-    depends_on("cxx", type="build")  # generated
-
-    conflicts("platform=darwin", msg="Only supported on linux")
-    conflicts("platform=windows", msg="Only supported on linux")
+    # Build dependencies
+    depends_on("c", type="build")
+    depends_on("cxx", type="build")
+
+    # Platform conflicts
+    conflicts("platform=darwin", msg="liburing is only supported on Linux.")
+    conflicts("platform=windows", msg="liburing is only supported on Linux.")
+
+    # Define build targets
+    @property
+    def build_targets(self):
+        if self.spec.satisfies("@2.7:"):
+            # avoid examples and test
+            return ["library"]
+        else:
+            return ["all"]
-- 
GitLab