OSDN Git Service

Add SPEC file for PostgresSQL 11
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Tue, 22 Jan 2019 10:54:35 +0000 (19:54 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Tue, 22 Jan 2019 10:54:35 +0000 (19:54 +0900)
The previous commit forgot to add the SPEC file for PostgreSQL11 and
some other files. Also Modify Makefile so that RPM files are sainly
generate.

Makefile
SPECS/pg_store_plans11.spec [new file with mode: 0644]
pg_store_plans--1.1--1.2.sql [new file with mode: 0644]
pg_store_plans--1.2--1.3.sql [new file with mode: 0644]

index d7f8d19..1f19702 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,16 @@ MODULE_big = pg_store_plans
 OBJS = pg_store_plans.o pgsp_json.o pgsp_json_text.o pgsp_explain.o
 
 EXTENSION = pg_store_plans
-DATA = pg_store_plans--*.sql
+
+PG_VERSION := $(shell pg_config --version | sed "s/^PostgreSQL //" | sed "s/\.[0-9]*$$//")
+
+DATA = pg_store_plans--1.3.sql
+ifeq ($(PG_VERSION),10)
+       DATA += pg_store_plans--1.2--1.3.sql
+endif
+ifeq ($(PG_VERSION),9.6)
+       DATA += pg_store_plans--1.1--1.2.sql
+endif
 
 REGRESS = convert store
 REGRESS_OPTS = --temp-config=regress.conf
@@ -39,7 +48,9 @@ LDFLAGS+=-Wl,--build-id
 ## These entries need running server
 DBNAME = postgres
 
-rpms: rpm94 rpm95 rpm96 rpm10 rpm11
+# rpm cannot be made for 94, 95
+#rpms: rpm94 rpm95 rpm96 rpm10 rpm11
+rpms: rpm96 rpm10 rpm11
 
 $(STARBALLS): $(TARSOURCES)
        if [ -h $(subst .tar.gz,,$@) ]; then rm $(subst .tar.gz,,$@); fi
@@ -51,11 +62,11 @@ $(STARBALLS): $(TARSOURCES)
        tar -chzf $@ $(addprefix $(subst .tar.gz,,$@)/, $^)
        rm $(subst .tar.gz,,$@)
 
-rpm94: $(STARBALL94)
-       MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans94.spec
-
-rpm95: $(STARBALL95)
-       MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans95.spec
+#rpm94: $(STARBALL94)
+#      MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans94.spec
+#
+#rpm95: $(STARBALL95)
+#      MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans95.spec
 
 rpm96: $(STARBALL96)
        MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans96.spec
diff --git a/SPECS/pg_store_plans11.spec b/SPECS/pg_store_plans11.spec
new file mode 100644 (file)
index 0000000..7ea0415
--- /dev/null
@@ -0,0 +1,99 @@
+# SPEC file for pg_store_plans
+# Copyright(C) 2019 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+
+%define _pgdir   /usr/pgsql-11
+%define _bindir  %{_pgdir}/bin
+%define _libdir  %{_pgdir}/lib
+%define _datadir %{_pgdir}/share
+%define _bcdir %{_libdir}/bitcode
+%define _mybcdir %{_bcdir}/pg_store_plans
+
+%if "%(echo ${MAKE_ROOT})" != ""
+  %define _rpmdir %(echo ${MAKE_ROOT})/RPMS
+  %define _sourcedir %(echo ${MAKE_ROOT})
+%endif
+
+## Set general information for pg_store_plans.
+Summary:    Record executed plans on PostgreSQL 11
+Name:       pg_store_plans11
+Version:    1.3
+Release:    1%{?dist}
+License:    BSD
+Group:      Applications/Databases
+Source0:    %{name}-%{version}.tar.gz
+#URL:        http://example.com/pg_store_plans/
+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
+Vendor:     NIPPON TELEGRAPH AND TELEPHONE CORPORATION
+
+## We use postgresql-devel package
+BuildRequires:  postgresql11-devel
+Requires:  postgresql11-libs
+
+## Description for "pg_store_plans"
+%description
+
+pg_store_plans provides capability to record statistics for every plan
+executed on PostgreSQL.
+
+Note that this package is available for only PostgreSQL 11.
+
+%package llvmjit
+Requires: postgresql11-server, postgresql11-llvmjit
+Requires: pg_hint_plan11 = 1.3.4
+Summary:  Just-in-time compilation support for pg_hint_plan11
+
+%description llvmjit
+Just-in-time compilation support for pg_hint_plan11
+
+## pre work for build pg_store_plans
+%prep
+PATH=/usr/pgsql-11/bin:$PATH
+if [ "${MAKE_ROOT}" != "" ]; then
+  pushd ${MAKE_ROOT}
+  make clean %{name}-%{version}.tar.gz
+  popd
+fi
+if [ ! -d %{_rpmdir} ]; then mkdir -p %{_rpmdir}; fi
+%setup -q
+
+## Set variables for build environment
+%build
+PATH=/usr/pgsql-11/bin:$PATH
+pg_config
+make USE_PGXS=1 %{?_smp_mflags}
+
+## Set variables for install
+%install
+rm -rf %{buildroot}
+PATH=/usr/pgsql-11/bin:$PATH
+make install DESTDIR=%{buildroot}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(0755,root,root)
+%{_libdir}/pg_store_plans.so
+%defattr(0644,root,root)
+%{_datadir}/extension/pg_store_plans--1.3.sql
+%{_datadir}/extension/pg_store_plans.control
+
+%files llvmjit
+%defattr(0644,root,root)
+%{_bcdir}/pg_store_plans.index.bc
+%{_mybcdir}/*.bc
+
+# History of pg_store_plans.
+%changelog
+* Tue Jan 22 2019 Kyotaro Horiguchi
+- Supports PostgreSQL 11
+* Tue Oct 10 2017 Kyotaro Horiguchi
+- Supports PostgreSQL 10
+* Fri Aug 26 2016 Kyotaro Horiguchi
+- Some fix in plan representation functions.
+* Wed Apr 13 2016 Kyotaro Horiguchi
+- Support PostgreSQL 9.5
+* Fri Jun 12 2015 Kyotaro Horiguchi
+- Initial version.
+
+
diff --git a/pg_store_plans--1.1--1.2.sql b/pg_store_plans--1.1--1.2.sql
new file mode 100644 (file)
index 0000000..238feea
--- /dev/null
@@ -0,0 +1 @@
+-- Nothing to do for SQL definitions as of 1.2
diff --git a/pg_store_plans--1.2--1.3.sql b/pg_store_plans--1.2--1.3.sql
new file mode 100644 (file)
index 0000000..238feea
--- /dev/null
@@ -0,0 +1 @@
+-- Nothing to do for SQL definitions as of 1.2