This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new e6a2203  ARROW-14857: [CI][Homebrew] Add apache-arrow-glib fomula
e6a2203 is described below

commit e6a220369bde812ff64fa5311dda1469b209cdbe
Author: Sutou Kouhei <k...@clear-code.com>
AuthorDate: Thu Nov 25 16:34:08 2021 +0900

    ARROW-14857: [CI][Homebrew] Add apache-arrow-glib fomula
    
    
https://github.com/ursacomputing/crossbow/runs/4308415772?check_suite_focus=true#step:4:3924
    
        apache-arrow:
        Error: 1 problem in 1 formula detected
          * Version of `apache-arrow-glib` (6.0.1) should match version of 
`apache-arrow` (7.0.0)
    
    Closes #11770 from kou/ci-homebrew
    
    Authored-by: Sutou Kouhei <k...@clear-code.com>
    Signed-off-by: Sutou Kouhei <k...@clear-code.com>
---
 dev/release/01-prepare-test.rb                   | 14 ++++
 dev/release/rat_exclude_files.txt                |  1 +
 dev/release/utils-prepare.sh                     |  9 ++-
 dev/tasks/homebrew-formulae/apache-arrow-glib.rb | 91 ++++++++++++++++++++++++
 dev/tasks/homebrew-formulae/apache-arrow.rb      | 45 +++++++++++-
 dev/tasks/homebrew-formulae/github.macos.yml     | 34 ++++++---
 6 files changed, 181 insertions(+), 13 deletions(-)

diff --git a/dev/release/01-prepare-test.rb b/dev/release/01-prepare-test.rb
index 14b4e53..cb8e688 100644
--- a/dev/release/01-prepare-test.rb
+++ b/dev/release/01-prepare-test.rb
@@ -170,6 +170,13 @@ class PrepareTest < Test::Unit::TestCase
         ],
       },
       {
+        path: "dev/tasks/homebrew-formulae/apache-arrow-glib.rb",
+        hunks: [
+          ["-  url 
\"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@snapshot_version}/apache-arrow-#{@snapshot_version}.tar.gz\"";,
+           "+  url 
\"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@release_version}/apache-arrow-#{@release_version}.tar.gz\"";],
+        ],
+      },
+      {
         path: "dev/tasks/homebrew-formulae/apache-arrow.rb",
         hunks: [
           ["-  url 
\"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@snapshot_version}/apache-arrow-#{@snapshot_version}.tar.gz\"";,
@@ -296,6 +303,13 @@ class PrepareTest < Test::Unit::TestCase
         ],
       },
       {
+        path: "dev/tasks/homebrew-formulae/apache-arrow-glib.rb",
+        hunks: [
+          ["-  url 
\"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@snapshot_version}/apache-arrow-#{@snapshot_version}.tar.gz\"";,
+           "+  url 
\"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@next_snapshot_version}/apache-arrow-#{@next_snapshot_version}.tar.gz\"";],
+        ],
+      },
+      {
         path: "dev/tasks/homebrew-formulae/apache-arrow.rb",
         hunks: [
           ["-  url 
\"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@snapshot_version}/apache-arrow-#{@snapshot_version}.tar.gz\"";,
diff --git a/dev/release/rat_exclude_files.txt 
b/dev/release/rat_exclude_files.txt
index 1d9eb887..7157669 100644
--- a/dev/release/rat_exclude_files.txt
+++ b/dev/release/rat_exclude_files.txt
@@ -49,6 +49,7 @@ dev/archery/requirements*.txt
 dev/archery/archery/tests/fixtures/*
 dev/archery/archery/crossbow/tests/fixtures/*
 dev/release/rat_exclude_files.txt
+dev/tasks/homebrew-formulae/apache-arrow-glib.rb
 dev/tasks/homebrew-formulae/apache-arrow.rb
 
dev/tasks/linux-packages/apache-arrow-apt-source/debian/apache-arrow-apt-source.install
 dev/tasks/linux-packages/apache-arrow-apt-source/debian/compat
diff --git a/dev/release/utils-prepare.sh b/dev/release/utils-prepare.sh
index c2f5cfb..ffb8b0d 100644
--- a/dev/release/utils-prepare.sh
+++ b/dev/release/utils-prepare.sh
@@ -87,9 +87,14 @@ update_versions() {
   git add autobrew/apache-arrow.rb
   sed -i.bak -E -e \
     "s/arrow-[0-9.\-]+[0-9SNAPHOT]+/arrow-${version}/g" \
+    apache-arrow-glib.rb \
+    apache-arrow.rb
+  rm -f \
+    apache-arrow-glib.rb.bak \
+    apache-arrow.rb.bak
+  git add \
+    apache-arrow-glib.rb \
     apache-arrow.rb
-  rm -f apache-arrow.rb.bak
-  git add apache-arrow.rb
   popd
 
   pushd "${ARROW_DIR}/js"
diff --git a/dev/tasks/homebrew-formulae/apache-arrow-glib.rb 
b/dev/tasks/homebrew-formulae/apache-arrow-glib.rb
new file mode 100644
index 0000000..fdbc464
--- /dev/null
+++ b/dev/tasks/homebrew-formulae/apache-arrow-glib.rb
@@ -0,0 +1,91 @@
+# BSD 2-Clause License
+#
+# Copyright (c) 2009-present, Homebrew contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+#   list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# 
https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-arrow-glib.rb
+
+class ApacheArrowGlib < Formula
+  desc "GLib bindings for Apache Arrow"
+  homepage "https://arrow.apache.org/";
+  url 
"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-7.0.0-SNAPSHOT/apache-arrow-7.0.0-SNAPSHOT.tar.gz";
+  sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28"
+  license "Apache-2.0"
+  head "https://github.com/apache/arrow.git";
+
+  livecheck do
+    formula "apache-arrow"
+  end
+
+  depends_on "gobject-introspection" => :build
+  depends_on "meson" => :build
+  depends_on "ninja" => :build
+  depends_on "pkg-config" => :build
+  depends_on "apache-arrow"
+  depends_on "glib"
+
+  on_linux do
+    depends_on "gcc"
+  end
+
+  fails_with gcc: "5"
+
+  def install
+    mkdir "build" do
+      system "meson", *std_meson_args, "../c_glib"
+      system "ninja", "-v"
+      system "ninja", "install", "-v"
+    end
+  end
+
+  test do
+    (testpath/"test.c").write <<~SOURCE
+      #include <arrow-glib/arrow-glib.h>
+      int main(void) {
+        GArrowNullArray *array = garrow_null_array_new(10);
+        g_object_unref(array);
+        return 0;
+      }
+    SOURCE
+    apache_arrow = Formula["apache-arrow"]
+    glib = Formula["glib"]
+    flags = %W[
+      -I#{include}
+      -I#{apache_arrow.opt_include}
+      -I#{glib.opt_include}/glib-2.0
+      -I#{glib.opt_lib}/glib-2.0/include
+      -L#{lib}
+      -L#{apache_arrow.opt_lib}
+      -L#{glib.opt_lib}
+      -DNDEBUG
+      -larrow-glib
+      -larrow
+      -lglib-2.0
+      -lgobject-2.0
+      -lgio-2.0
+    ]
+    system ENV.cc, "test.c", "-o", "test", *flags
+    system "./test"
+  end
+end
diff --git a/dev/tasks/homebrew-formulae/apache-arrow.rb 
b/dev/tasks/homebrew-formulae/apache-arrow.rb
index 8de40e3..d522c5d 100644
--- a/dev/tasks/homebrew-formulae/apache-arrow.rb
+++ b/dev/tasks/homebrew-formulae/apache-arrow.rb
@@ -1,3 +1,31 @@
+# BSD 2-Clause License
+#
+# Copyright (c) 2009-present, Homebrew contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+#   list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-arrow.rb
+
 class ApacheArrow < Formula
   desc "Columnar in-memory analytics layer designed to accelerate big data"
   homepage "https://arrow.apache.org/";
@@ -19,12 +47,22 @@ class ApacheArrow < Formula
   depends_on "protobuf"
   depends_on "python@3.9"
   depends_on "rapidjson"
+  depends_on "re2"
   depends_on "snappy"
   depends_on "thrift"
+  depends_on "utf8proc"
   depends_on "zstd"
 
+  on_linux do
+    depends_on "gcc"
+  end
+
+  fails_with gcc: "5"
+
   def install
-    ENV.cxx11
+    # https://github.com/Homebrew/homebrew-core/issues/76537
+    ENV.runtime_cpu_detection if Hardware::CPU.intel?
+
     # link against system libc++ instead of llvm provided libc++
     ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib
     args = %W[
@@ -43,14 +81,15 @@ class ApacheArrow < Formula
       -DARROW_WITH_BZ2=ON
       -DARROW_WITH_LZ4=ON
       -DARROW_WITH_SNAPPY=ON
+      -DARROW_WITH_UTF8PROC=ON
       -DARROW_WITH_ZLIB=ON
       -DARROW_WITH_ZSTD=ON
+      -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE
       -DPython3_EXECUTABLE=#{Formula["python@3.9"].bin/"python3"}
     ]
     # Re-enable -DARROW_S3=ON and add back aws-sdk-cpp to depends_on in 
ARROW-6437
 
-    mkdir "build"
-    cd "build" do
+    mkdir "build" do
       system "cmake", "../cpp", *std_cmake_args, *args
       system "make"
       system "make", "install"
diff --git a/dev/tasks/homebrew-formulae/github.macos.yml 
b/dev/tasks/homebrew-formulae/github.macos.yml
index 232cc38..2f52cec 100644
--- a/dev/tasks/homebrew-formulae/github.macos.yml
+++ b/dev/tasks/homebrew-formulae/github.macos.yml
@@ -25,8 +25,8 @@ on:
       - "*-github-*"
 
 jobs:
-  autobrew:
-    name: "Autobrew"
+  homebrew:
+    name: "Homebrew"
     runs-on: macOS-latest
     steps:
       - name: Checkout Arrow
@@ -35,22 +35,40 @@ jobs:
           git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }}
           git -C arrow checkout FETCH_HEAD
           git -C arrow submodule update --init --recursive
-      - name: Configure homebrew formula for testing
+      - name: Configure Homebrew formula for testing
         env:
           ARROW_FORMULA: ./arrow/dev/tasks/homebrew-formulae/{{ formula }}
         run: |
-          # Pin the current commit in the formula to test so that we're not 
always pulling from master
-          sed -i.bak -E -e 's@https://github.com/apache/arrow.git"$@{{ 
arrow.remote }}.git", revision: "{{ arrow.head }}"@' $ARROW_FORMULA && rm -f 
$ARROW_FORMULA.bak
-          # Sometimes crossbow gives a remote URL with .git and sometimes not. 
Make sure there's only one
-          sed -i.bak -E -e 's...@.git.git@.git@' $ARROW_FORMULA && rm -f 
$ARROW_FORMULA.bak
           brew update
           brew --version
           brew unlink python@2 || true
           brew config
           brew doctor || true
-          cp $ARROW_FORMULA $(brew --repository 
homebrew/core)/Formula/apache-arrow.rb
+
+          ARROW_GLIB_FORMULA=$(echo ${ARROW_FORMULA} | sed -e 
's/\.rb/-glib.rb/')
+          echo "ARROW_GLIB_FORMULA=${ARROW_GLIB_FORMULA}" >> ${GITHUB_ENV}
+          for formula in ${ARROW_FORMULA} ${ARROW_GLIB_FORMULA}; do
+            if [ ! -f ${formula} ]; then
+              continue
+            fi
+            # Pin the current commit in the formula to test so that
+            # we're not always pulling from master
+            sed -i '' -E \
+              -e 's@https://github.com/apache/arrow.git"$@{{ arrow.remote 
}}.git", revision: "{{ arrow.head }}"@' \
+              ${formula}
+            # Sometimes crossbow gives a remote URL with .git and sometimes 
not.
+            # Make sure there's only one
+            sed -i '' -E -e 's...@.git.git@.git@' ${formula}
+            cp ${formula} $(brew --repository homebrew/core)/Formula/
+          done
       - name: Test formula
         run: |
           brew install -v --HEAD apache-arrow
           brew test apache-arrow
           brew audit --strict apache-arrow
+
+          if [ -f ${ARROW_GLIB_FORMULA} ]; then
+            brew install -v --HEAD apache-arrow-glib
+            brew test apache-arrow-glib
+            brew audit --strict apache-arrow-glib
+          fi

Reply via email to