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

kou pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/arrow-flight-sql-postgresql.git


The following commit(s) were added to refs/heads/main by this push:
     new 290ac89  Add support for building Debian/Ubuntu packages (#78)
290ac89 is described below

commit 290ac895e5dbb7372bc54b75713795af8ff316dc
Author: Sutou Kouhei <k...@clear-code.com>
AuthorDate: Fri Aug 25 16:00:14 2023 +0900

    Add support for building Debian/Ubuntu packages (#78)
    
    Closes GH-29
---
 .github/workflows/package.yaml                     | 215 +++++++++++++++++++++
 .github/workflows/test.yaml                        |   1 +
 .gitignore                                         |   7 +
 .gitignore => Rakefile                             |  23 ++-
 .gitignore => helper.rb                            |  39 +++-
 packages/apt/test.sh                               |  81 ++++++++
 .../arrow-flight-sql-postgresql-package-task.rb    | 182 +++++++++++++++++
 .gitignore => packages/postgresql-15-pgdg/Rakefile |  21 +-
 .../apt/debian-bookworm-amd64/Dockerfile           |  63 ++++++
 .../apt/ubuntu-jammy-amd64/Dockerfile              |  59 ++++++
 packages/postgresql-15-pgdg/debian/changelog       |   0
 .../postgresql-15-pgdg/debian/control              |  30 ++-
 packages/postgresql-15-pgdg/debian/copyright       |  26 +++
 .../postgresql-15-pgdg/debian/rules                |  26 ++-
 14 files changed, 743 insertions(+), 30 deletions(-)

diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml
new file mode 100644
index 0000000..66f5ceb
--- /dev/null
+++ b/.github/workflows/package.yaml
@@ -0,0 +1,215 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Package
+
+on:
+  pull_request:
+  push:
+
+concurrency:
+  group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
+  cancel-in-progress: true
+
+permissions:
+  contents: write
+  packages: write
+
+jobs:
+  release:
+    if: >-
+      github.ref_type == 'tag' && !contains(github.ref_name, 'rc')
+    name: Release
+    timeout-minutes: 5
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Make RC GA
+        run: |
+          rc_tag=$(gh release list ${GITHUB_REF_NAME} | \
+                     cut -d'   ' -f3 | \
+                     grep -rc | \
+                     head -n1)
+          title="$(gh release view ${rc_tag} --json name --jq .name | \
+                     sed -E -e 's/ RC[0-9]+$//')"
+          gh release view ${rc_tag} --json body --jq .body > release-note.md
+          mkdir rc_artifacts
+          gh release download ${rc_tag} --dir rc_artifacts
+          gh release create ${GITHUB_REF_NAME} \
+            --notes-file release-note.md \
+            --title "${title}" \
+            rc_artifacts/*
+        env:
+          GH_TOKEN: ${{ github.token }}
+
+  source:
+    name: Source
+    if: >-
+      github.ref_type == 'branch' ||
+        (github.ref_type == 'tag' && contains(github.ref_name, 'rc'))
+    timeout-minutes: 5
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: ruby/setup-ruby@v1
+        with:
+          ruby-version: ruby
+      - name: Build archive
+        run: |
+          rake dist
+      - uses: actions/upload-artifact@v3
+        with:
+          name: source
+          path: apache-arrow-flight-sql-postgresql-*.tar.gz
+      - name: Upload to release
+        if: |
+          github.ref_type == 'tag'
+        run: |
+          ruby \
+            -e 'print("## Apache Arrow Flight SQL adapter for PostgreSQL "); \
+                puts(ARGF.read.split(/^## /)[1]. \
+                       gsub(/ {.+?}/, ""). \
+                       gsub(/\[(.+?)\]\[.+?\]/) {$1})' \
+            docs/source/news.md > release-note.md
+          rc=${GITHUB_REF_NAME:#*-rc}
+          title="$(head -n1 release-note.md | sed -e 's/^## //') RC${rc}"
+          tail -n +2 release-note.md > release-note-without-version.md
+          gh release create ${GITHUB_REF_NAME} \
+            --prerelease \
+            --notes-file release-note-without-version.md \
+            --title "${title}" \
+            apache-arrow-flight-sql-postgresql-*.tar.gz
+        env:
+          GH_TOKEN: ${{ github.token }}
+
+  linux:
+    name: Linux
+    if: >-
+      github.ref_type == 'branch' ||
+        (github.ref_type == 'tag' && contains(github.ref_name, 'rc'))
+    needs:
+      - source
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    strategy:
+      fail-fast: false
+      matrix:
+        target:
+          - "postgresql-15-pgdg-debian-bookworm-amd64"
+          - "postgresql-15-pgdg-ubuntu-jammy-amd64"
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          repository: apache/arrow
+          path: arrow
+      - uses: actions/download-artifact@v3
+        with:
+          name: source
+      - name: Prepare
+        run: |
+          BASE_NAME=apache-arrow-flight-sql-postgresql
+          echo "BASE_NAME=${BASE_NAME}" >> $GITHUB_ENV
+          echo "ARROW_SOURCE=$(pwd)/arrow" >> $GITHUB_ENV
+          full_target=${{ matrix.target }}
+          # postgresql-15-pgdg-debian-bookworm-amd64 ->
+          # postgresql-15-pgdg
+          PACKAGE=${full_target%-pgdg-*}-pgdg
+          echo "PACKAGE=${PACKAGE}" >> $GITHUB_ENV
+          # postgresql-15-pgdg-debian-bookworm-amd64 ->
+          # debian-bookworm-amd64
+          PACKAGE_TARGET=${full_target#*-pgdg-}
+          echo "APT_TARGETS=${PACKAGE_TARGET}" >> $GITHUB_ENV
+          echo "YUM_TARGETS=${PACKAGE_TARGET}" >> $GITHUB_ENV
+          case ${PACKAGE_TARGET} in
+            almalinux-*)
+              echo "TASK_NAMESPACE=yum" >> $GITHUB_ENV
+              ;;
+            debian-*|ubuntu-*)
+              echo "TASK_NAMESPACE=apt" >> $GITHUB_ENV
+              ;;
+          esac
+          DISTRIBUTION=${PACKAGE_TARGET%%-*}
+          echo "DISTRIBUTION=${DISTRIBUTION}" >> $GITHUB_ENV
+          DISTRIBUTION_VERSION=${PACKAGE_TARGET#*-}
+          DISTRIBUTION_VERSION=${DISTRIBUTION_VERSION%-*}
+          echo "DISTRIBUTION_VERSION=${DISTRIBUTION_VERSION}" >> $GITHUB_ENV
+          ARCHITECTURE=${PACKAGE_TARGET##*-}
+          echo "ARCHITECTURE=${ARCHITECTURE}" >> $GITHUB_ENV
+
+          source_archive=$(echo ${BASE_NAME}-*.tar.gz)
+          VERSION=${source_archive#${BASE_NAME}-}
+          VERSION=${VERSION%.tar.gz}
+          echo "VERSION=${VERSION}" >> $GITHUB_ENV
+      - name: Extract source archive
+        run: |
+          tar xf ${BASE_NAME}-${VERSION}.tar.gz
+          ln -s ${BASE_NAME}-${VERSION} ${BASE_NAME}
+          mv ${BASE_NAME}-${VERSION}.tar.gz ${BASE_NAME}/
+      - name: Set up Ruby
+        uses: ruby/setup-ruby@v1
+        with:
+          ruby-version: ruby
+      - name: Login to GitHub Container registry
+        uses: docker/login-action@v2
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ github.token }}
+      - name: Build
+        run: |
+          pushd ${BASE_NAME}/packages/${PACKAGE}
+          if [ "${GITHUB_REF_TYPE}" != "tag" ]; then
+            rake version:update
+          fi
+          rake docker:pull || :
+          rake --trace ${TASK_NAMESPACE}:build
+          popd
+      - name: Prepare artifacts
+        run: |
+          cp -a \
+            
${BASE_NAME}/packages/${PACKAGE}/${TASK_NAMESPACE}/repositories/${DISTRIBUTION} 
\
+            ./
+          tar czf ${{ matrix.target }}.tar.gz ${DISTRIBUTION}
+      - name: Upload artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: ${{ matrix.target }}
+          path: |
+            ${{ matrix.target }}.tar.gz
+      - name: Upload to release
+        if: |
+          github.ref_type == 'tag'
+        run: |
+          gh release upload ${GITHUB_REF_NAME} \
+            ${{ matrix.target }}.tar.gz
+        env:
+          GH_TOKEN: ${{ github.token }}
+      - name: Push Docker image
+        run: |
+          pushd ${BASE_NAME}/packages/${PACKAGE}
+          rake docker:push || :
+          popd
+      - name: Test
+        run: |
+          pushd ${BASE_NAME}
+          docker run \
+            --rm \
+            --volume ${PWD}:/host \
+            ${ARCHITECTURE}/${DISTRIBUTION}:${DISTRIBUTION_VERSION} \
+            /host/packages/${TASK_NAMESPACE}/test.sh \
+            packages/${PACKAGE}/${TASK_NAMESPACE}/repositories
+          popd
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index aa5233b..5520d1a 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -79,6 +79,7 @@ jobs:
         with:
           ruby-version: ruby
           bundler-cache: true
+          cache-version: 1
       - name: Test
         run: |
           PATH=$(pg_config --bindir):$PATH bundle exec test/run.rb
diff --git a/.gitignore b/.gitignore
index ad54b98..a888e02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,9 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
+/*.tar.gz
 /.cache/
+/Gemfile.lock
 /compile_commands.json
 /dev/release/apache-rat-0.13.jar
 /dev/release/dist
 /dev/release/filtered_rat.txt
 /dev/release/rat.xml
+/packages/*/*.tar.gz
+/packages/*/apt/build.sh
+/packages/*/apt/env.sh
+/packages/*/apt/repositories/
+/packages/*/apt/tmp/
diff --git a/.gitignore b/Rakefile
similarity index 67%
copy from .gitignore
copy to Rakefile
index ad54b98..699c6b2 100644
--- a/.gitignore
+++ b/Rakefile
@@ -1,3 +1,5 @@
+# -*- ruby -*-
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,9 +17,18 @@
 # specific language governing permissions and limitations
 # under the License.
 
-/.cache/
-/compile_commands.json
-/dev/release/apache-rat-0.13.jar
-/dev/release/dist
-/dev/release/filtered_rat.txt
-/dev/release/rat.xml
+require_relative "helper"
+
+version = Helper.detect_version
+archive_base_name = "apache-arrow-flight-sql-postgresql-#{version}"
+archive_name = "#{archive_base_name}.tar.gz"
+
+file archive_name do
+  sh("git",
+     "archive",
+     "HEAD",
+     "--output", archive_name,
+     "--prefix", "#{archive_base_name}/")
+end
+desc "Create #{archive_name}"
+task :dist => archive_name
diff --git a/.gitignore b/helper.rb
similarity index 54%
copy from .gitignore
copy to helper.rb
index ad54b98..aa1e3f2 100644
--- a/.gitignore
+++ b/helper.rb
@@ -15,9 +15,36 @@
 # specific language governing permissions and limitations
 # under the License.
 
-/.cache/
-/compile_commands.json
-/dev/release/apache-rat-0.13.jar
-/dev/release/dist
-/dev/release/filtered_rat.txt
-/dev/release/rat.xml
+require "pathname"
+
+module Helper
+  module_function
+  def top_source_dir
+    Pathname(__dir__)
+  end
+
+  def detect_version
+    version_env = ENV["VERSION"]
+    return version_env if version_env
+
+    meson_build = top_source_dir / "meson.build"
+    meson_build.read[/^\s*version: '(.+)'/, 1]
+  end
+
+  def detect_release_time
+    release_time_env = ENV["RELEASE_TIME"]
+    if release_time_env
+      Time.parse(release_time_env).utc
+    else
+      Time.now.utc
+    end
+  end
+
+  def archive_base_name(version)
+    "apache-arrow-flight-sql-postgresql-#{version}"
+  end
+
+  def archive_name(version)
+    "#{archive_base_name(version)}.tar.gz"
+  end
+end
diff --git a/packages/apt/test.sh b/packages/apt/test.sh
new file mode 100755
index 0000000..99dd827
--- /dev/null
+++ b/packages/apt/test.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -eux
+
+relative_repositories_dir=$1
+
+echo "::group::Prepare APT repositories"
+
+echo "debconf debconf/frontend select Noninteractive" | \
+  debconf-set-selections
+
+apt update
+apt install -V -y \
+    lsb-release \
+    wget
+
+os=$(lsb_release --id --short | tr "A-Z" "a-z")
+code_name=$(lsb_release --codename --short)
+architecture=$(dpkg --print-architecture)
+
+repositories_dir=/host/${relative_repositories_dir}
+wget 
https://apache.jfrog.io/artifactory/arrow/${os}/apache-arrow-apt-source-latest-${code_name}.deb
+apt install -V -y ./apache-arrow-apt-source-latest-${code_name}.deb
+
+echo "deb http://apt.postgresql.org/pub/repos/apt/ ${code_name}-pgdg main" | \
+  tee /etc/apt/sources.list.d/pgdg.list
+wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
+  apt-key add -
+
+echo "::endgroup::"
+
+
+echo "::group::Install built packages"
+
+apt update
+
+apt install -V -y \
+  ${repositories_dir}/${os}/pool/${code_name}/*/*/*/*_${architecture}.deb
+
+echo "::endgroup::"
+
+
+echo "::group::Install packages for test"
+
+apt install -V -y \
+    g++ \
+    libarrow-flight-sql-glib-dev \
+    make \
+    ruby-dev \
+    sudo
+MAKELAGS="-j$(nproc)" \
+        gem install \
+        red-arrow-flight-sql \
+        test-unit
+
+echo "::endgroup::"
+
+
+echo "::group::Run test"
+
+sudo -u postgres -H \
+     env PATH=$(pg_config --bindir):$PATH /host/test/run.rb
+
+echo "::endgroup::"
diff --git a/packages/arrow-flight-sql-postgresql-package-task.rb 
b/packages/arrow-flight-sql-postgresql-package-task.rb
new file mode 100644
index 0000000..072fb49
--- /dev/null
+++ b/packages/arrow-flight-sql-postgresql-package-task.rb
@@ -0,0 +1,182 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+arrow_source = ENV["ARROW_SOURCE"]
+if arrow_source.nil?
+  raise "You must set ARROW_SOURCE environment variable"
+end
+ARROW_SOURCE = File.expand_path(arrow_source)
+require "#{ARROW_SOURCE}/dev/tasks/linux-packages/package-task"
+
+require_relative "../helper"
+
+class ArrowFlightSQLPostgreSQLPackageTask < PackageTask
+  def initialize(package)
+    release_time = Helper.detect_release_time
+    super(package, Helper.detect_version, release_time)
+  end
+
+  def define
+    super
+    define_rc_tasks
+    define_release_tasks
+  end
+
+  private
+  def define_archive_task
+    file @archive_name do
+      build_archive
+    end
+
+    if deb_archive_name != @archive_name
+      file deb_archive_name => @archive_name do
+        cp(@archive_name, deb_archive_name)
+      end
+    end
+
+    if rpm_archive_name != @archive_name
+      file rpm_archive_name => @archive_name do
+        cp(@archive_name, rpm_archive_name)
+      end
+    end
+  end
+
+  def build_archive
+    top_source_dir = Helper.top_source_dir
+    archive_name = top_source_dir + Helper.archive_name(@version)
+    unless archive_name.exist?
+      cd(top_source_dir) do
+        ruby("-S", "rake", "dist")
+      end
+    end
+    sh("tar", "xf", archive_name.to_s)
+    mv(Helper.archive_base_name(@version), @archive_base_name)
+    sh("tar", "czf", @full_archive_name, @archive_base_name)
+    rm_rf(@archive_base_name)
+  end
+
+  def apt_targets_default
+    [
+      "debian-bookworm-amd64",
+      # "debian-bookworm-arm64",
+      "ubuntu-jammy-amd64",
+      # "ubuntu-jammy-arm64",
+    ]
+  end
+
+  def yum_targets_default
+    [
+    ]
+  end
+
+  def github_repository
+    ENV["GITHUB_REPOSITORY"] || "apache/arrow-flight-sql-postgresql"
+  end
+
+  def docker_image(os, architecture)
+    "ghcr.io/#{github_repository}/package-#{super}"
+  end
+
+  def built_package_url(target_namespace, target)
+    url = "https://github.com/#{github_repository}";
+    url << "/releases/download/#{@version}/#{target}.tar.gz"
+    url
+  end
+
+  def package_dir_name
+    "#{@package}-#{@version}"
+  end
+
+  def download_packages(target_namespace)
+    download_dir = "#{ARROW_SOURCE}/packages/#{package_dir_name}"
+    mkdir_p(download_dir)
+    __send__("#{target_namespace}_targets").each do |target|
+      url = built_package_url(target_namespace, target)
+      archive = download(url, download_dir)
+      cd(download_dir) do
+        sh("tar", "xf", archive)
+      end
+    end
+  end
+
+  def upload_rc(target_namespace)
+    targets = __send__("#{target_namespace}_targets")
+    cd(apache_arrow_dir) do
+      env = {
+        "CROSSBOW_JOB_ID" => package_dir_name,
+        "DEB_PACKAGE_NAME" => @package,
+        "STAGING" => ENV["STAGING"] || "no",
+        "UPLOAD_DEFAULT" => "0",
+      }
+      targets.each do |target|
+        distribution = target.split("-")[0].upcase
+        env["UPLOAD_#{distribution}"] = "1"
+      end
+      sh(env,
+         "dev/release/05-binary-upload.sh",
+         @version,
+         "0")
+    end
+  end
+
+  def define_rc_tasks
+    [:apt].each do |target_namespace|
+      tasks = []
+      namespace target_namespace do
+        desc "Upload RC #{target_namespace} packages"
+        task :rc do
+          download_packages(target_namespace)
+          upload_rc(target_namespace)
+        end
+        tasks << "#{target_namespace}:release"
+      end
+      task target_namespace => tasks
+    end
+  end
+
+  def release(target_namespace)
+    targets = __send__("#{target_namespace}_targets")
+    cd(apache_arrow_dir) do
+      env = {
+        "STAGING" => ENV["STAGING"] || "no",
+        "DEPLOY_DEFAULT" => "0",
+      }
+      targets.each do |target|
+        distribution = target.split("-")[0].upcase
+        env["DEPLOY_#{distribution}"] = "1"
+      end
+      sh(env,
+         "dev/release/post-02-binary.sh",
+         @version,
+         "0")
+    end
+  end
+
+  def define_release_tasks
+    [:apt].each do |target_namespace|
+      tasks = []
+      namespace target_namespace do
+        desc "Release #{target_namespace} packages"
+        task :release do
+          release(target_namespace)
+        end
+        tasks << "#{target_namespace}:release"
+      end
+      task target_namespace => tasks
+    end
+  end
+end
diff --git a/.gitignore b/packages/postgresql-15-pgdg/Rakefile
similarity index 71%
copy from .gitignore
copy to packages/postgresql-15-pgdg/Rakefile
index ad54b98..e80f40f 100644
--- a/.gitignore
+++ b/packages/postgresql-15-pgdg/Rakefile
@@ -1,3 +1,5 @@
+# -*- ruby -*-
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,9 +17,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-/.cache/
-/compile_commands.json
-/dev/release/apache-rat-0.13.jar
-/dev/release/dist
-/dev/release/filtered_rat.txt
-/dev/release/rat.xml
+require_relative "../arrow-flight-sql-postgresql-package-task"
+
+class PostgreSQL15PGDGPackageTask < ArrowFlightSQLPostgreSQLPackageTask
+  def initialize
+    super("postgresql-15-pgdg-apache-arrow-flight-sql")
+  end
+
+  def enable_yum?
+    false
+  end
+end
+
+PostgreSQL15PGDGPackageTask.new.define
diff --git a/packages/postgresql-15-pgdg/apt/debian-bookworm-amd64/Dockerfile 
b/packages/postgresql-15-pgdg/apt/debian-bookworm-amd64/Dockerfile
new file mode 100644
index 0000000..35f0225
--- /dev/null
+++ b/packages/postgresql-15-pgdg/apt/debian-bookworm-amd64/Dockerfile
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+ARG FROM=debian:bookworm
+FROM ${FROM}
+
+RUN \
+  echo "debconf debconf/frontend select Noninteractive" | \
+    debconf-set-selections
+
+RUN \
+  echo 'APT::Install-Recommends "false";' > \
+    /etc/apt/apt.conf.d/disable-install-recommends
+
+RUN \
+  sed -i'' -e 's/main$/main contrib non-free/g' \
+    /etc/apt/sources.list.d/debian.sources
+
+ARG DEBUG
+RUN \
+  quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \
+  apt update ${quiet} && \
+  apt install -y -V ${quiet} \
+    ca-certificates \
+    lsb-release \
+    wget && \
+  distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z') && \
+  code_name=$(lsb_release --codename --short) && \
+  wget 
https://apache.jfrog.io/artifactory/arrow/${distribution}/apache-arrow-apt-source-latest-${code_name}.deb
 && \
+  apt install -y -V ${quiet} \
+    ./apache-arrow-apt-source-latest-${code_name}.deb && \
+  rm apache-arrow-apt-source-latest-${code_name}.deb && \
+  echo "deb http://apt.postgresql.org/pub/repos/apt/ ${code_name}-pgdg main" > 
\
+    /etc/apt/sources.list.d/pgdg.list && \
+  wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
+    apt-key add - && \
+  apt update && \
+  apt install -y -V ${quiet} \
+    build-essential \
+    ccache \
+    cmake \
+    debhelper \
+    devscripts \
+    libarrow-flight-sql-dev \
+    libkrb5-dev \
+    meson \
+    ninja-build \
+    postgresql-server-dev-15 && \
+  apt clean
diff --git a/packages/postgresql-15-pgdg/apt/ubuntu-jammy-amd64/Dockerfile 
b/packages/postgresql-15-pgdg/apt/ubuntu-jammy-amd64/Dockerfile
new file mode 100644
index 0000000..fe9af26
--- /dev/null
+++ b/packages/postgresql-15-pgdg/apt/ubuntu-jammy-amd64/Dockerfile
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+ARG FROM=ubuntu:22.04
+FROM ${FROM}
+
+RUN \
+  echo "debconf debconf/frontend select Noninteractive" | \
+    debconf-set-selections
+
+RUN \
+  echo 'APT::Install-Recommends "false";' > \
+    /etc/apt/apt.conf.d/disable-install-recommends
+
+ARG DEBUG
+RUN \
+  quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \
+  apt update ${quiet} && \
+  apt install -y -V ${quiet} \
+    ca-certificates \
+    lsb-release \
+    wget && \
+  distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z') && \
+  code_name=$(lsb_release --codename --short) && \
+  wget 
https://apache.jfrog.io/artifactory/arrow/${distribution}/apache-arrow-apt-source-latest-${code_name}.deb
 && \
+  apt install -y -V ${quiet} \
+    ./apache-arrow-apt-source-latest-${code_name}.deb && \
+  rm apache-arrow-apt-source-latest-${code_name}.deb && \
+  echo "deb http://apt.postgresql.org/pub/repos/apt/ ${code_name}-pgdg main" > 
\
+    /etc/apt/sources.list.d/pgdg.list && \
+  wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
+    apt-key add - && \
+  apt update && \
+  apt install -y -V ${quiet} \
+    build-essential \
+    ccache \
+    cmake \
+    debhelper \
+    devscripts \
+    libarrow-flight-sql-dev \
+    libkrb5-dev \
+    meson \
+    ninja-build \
+    postgresql-server-dev-15 && \
+  apt clean
diff --git a/packages/postgresql-15-pgdg/debian/changelog 
b/packages/postgresql-15-pgdg/debian/changelog
new file mode 100644
index 0000000..e69de29
diff --git a/.gitignore b/packages/postgresql-15-pgdg/debian/control
similarity index 54%
copy from .gitignore
copy to packages/postgresql-15-pgdg/debian/control
index ad54b98..e6d1678 100644
--- a/.gitignore
+++ b/packages/postgresql-15-pgdg/debian/control
@@ -15,9 +15,27 @@
 # specific language governing permissions and limitations
 # under the License.
 
-/.cache/
-/compile_commands.json
-/dev/release/apache-rat-0.13.jar
-/dev/release/dist
-/dev/release/filtered_rat.txt
-/dev/release/rat.xml
+Source: postgresql-15-pgdg-apache-arrow-flight-sql
+Section: database
+Priority: optional
+Maintainer: Apache Arrow Developers <d...@arrow.apache.org>
+Build-Depends:
+  cmake,
+  debhelper-compat (= 13),
+  libarrow-flight-sql-dev,
+  libkrb5-dev,
+  meson,
+  postgresql-server-dev-15
+Standards-Version: 4.6.0
+Homepage: https://arrow.apache.org/flight-sql-postgresql/
+
+Package: postgresql-15-pgdg-apache-arrow-flight-sql
+Architecture: any
+Depends:
+  ${misc:Depends},
+  ${shlibs:Depends},
+  postgresql-15
+Description: Apache Arrow Flight SQL adapter for PostgreSQL
+ .
+ It provides a PostgreSQL module that adds Apache Arrow Flight SQL
+ interface to PostgreSQL.
diff --git a/packages/postgresql-15-pgdg/debian/copyright 
b/packages/postgresql-15-pgdg/debian/copyright
new file mode 100644
index 0000000..c2452ee
--- /dev/null
+++ b/packages/postgresql-15-pgdg/debian/copyright
@@ -0,0 +1,26 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Contact: Apache Arrow Developers <d...@arrow.apache.org>
+Source: https://packages.groonga.org/source/pgroonga/
+
+Files: *
+Copyright: 2022-2023 Apache Arrow Developers <d...@arrow.apache.org>
+License: Apache-2.0
+
+License: Apache-2.0
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+ .
+      https://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian systems, the full text of the Apache Software License version 2 can
+ be found in the file `/usr/share/common-licenses/Apache-2.0'.
diff --git a/.gitignore b/packages/postgresql-15-pgdg/debian/rules
old mode 100644
new mode 100755
similarity index 66%
copy from .gitignore
copy to packages/postgresql-15-pgdg/debian/rules
index ad54b98..1f4fdc9
--- a/.gitignore
+++ b/packages/postgresql-15-pgdg/debian/rules
@@ -1,3 +1,6 @@
+#!/usr/bin/make -f
+# -*- makefile-gmake -*-
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -15,9 +18,20 @@
 # specific language governing permissions and limitations
 # under the License.
 
-/.cache/
-/compile_commands.json
-/dev/release/apache-rat-0.13.jar
-/dev/release/dist
-/dev/release/filtered_rat.txt
-/dev/release/rat.xml
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+export DEB_BUILD_MAINT_OPTIONS=reproducible=-timeless
+
+%:
+       dh $@
+
+override_dh_auto_configure:
+       dh_auto_configure                       \
+         --buildsystem=meson+ninja             \
+         --                                    \
+         --buildtype=debugoptimized
+
+override_dh_auto_test:

Reply via email to