Rework Makefile to handle also 9.1
authorCédric Villemain <cedric@2ndquadrant.fr>
Mon, 25 Jul 2011 22:46:29 +0000 (00:46 +0200)
committerCédric Villemain <cedric@2ndquadrant.fr>
Mon, 25 Jul 2011 22:46:29 +0000 (00:46 +0200)
ChangeLog
Makefile
doc/README.pgfincore.rst [moved from README.pgfincore with 100% similarity]
pgfincore.control [new file with mode: 0644]
sql/pgfincore--unpackaged--1.0.sql [new file with mode: 0644]
sql/pgfincore.sql [moved from pgfincore.sql.in with 97% similarity]
sql/uninstall_pgfincore.sql [moved from uninstall_pgfincore.sql.in with 95% similarity]

index 6e64d095435b33ab6a6f7ecad37c2dae872ed862..41884b20cd4fa77301961b0009cee83f776f3e46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
 05/XX/2011 Cédric Villemain <cedric@villemain.org>
-  * 0.9.0 - Output varbit containing vector information with pgfincore*()
+  * 1.0.0 - Output varbit containing vector information with pgfincore*()
                  - Add Debian packaging (Dimitri Fontaine)
                  - Update to work with PostgreSQL >= 9.1 (Jeff Janes)
           - Add total number of pages of memory with pgsysconf()
@@ -9,6 +9,10 @@
                  - pgfadvise_loader() to restore file status (pages in/out cache)
                  - pgfincore*() to handle mincore usage
                  - pgsysconf*() to handle sysconf information
+                 - Use get_call_result_type() to build the tuple descriptor (suggested
+                   by RhodiumToad on IRC)
+                 - Remove limitation of usage on temp tables
+                 - Improve 9.1 installation (Extension)
 
 04/30/2010 Cédric Villemain <cedric@villemain.org>
 
index 4020bb44d406f3425d8a9aeef9949df01b4d9616..c4fcfb5e00ab2a47feb6241928079f537f707f22 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,35 @@
-PKGNAME = pgfincore
+EXTENSION    = pgfincore
+
+EXTVERSION   = $(shell grep default_version $(EXTENSION).control | \
+               sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
+
+MODULES      = $(EXTENSION)
+DATA         = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
+DOCS         = doc/README.$(EXTENSION).rst
+# TESTS        = $(wildcard test/sql/*.sql)
+# REGRESS      = $(patsubst test/sql/%.sql,%,$(TESTS))
+# REGRESS_OPTS = --inputdir=test --load-language=plpgsql
+
+ifndef PG_CONFIG
+PG_CONFIG    = pg_config
+endif
+
+PG91         = $(shell $(PG_CONFIG) --version | grep -qE "8\.|9\.0" && echo no || echo yes)
+
+ifeq ($(PG91),yes)
+all: sql/$(EXTENSION)--$(EXTVERSION).sql
+
+sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
+       cp $< $@
+
+DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
+EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
+endif
+
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+
+PKGNAME = $(EXTENSION)
 PKGVERS = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
 
 DEBDIR = /tmp/$(PKGNAME)
@@ -7,25 +38,15 @@ ORIG   = $(DEBDIR)/export/$(PKGNAME)_$(PKGVERS).orig.tar.gz
 ARCHIVE= $(DEBDIR)/export/$(PKGNAME)-$(PKGVERS).tar.gz
 DEBEXTS= {gz,changes,build,dsc}
 
-MODULES = pgfincore
-DATA_built = pgfincore.sql uninstall_pgfincore.sql
-DOCS = README.pgfincore
-
-PG_CONFIG ?= pg_config
-PGXS = $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
-
-deb:
-       # working copy from where to make the .orig archive
-       rm -rf $(DEBDIR)        
+deb:   # working copy from where to make the .orig archive
+       rm -rf $(DEBDIR)
        mkdir -p $(DEBDIR)/$(PKGNAME)-$(PKGVERS)
-       mkdir -p $(EXPORT)
-       rsync -Ca . $(EXPORT)
-
-       # get rid of temp and build files
-       for n in ".#*" "*~" "build-stamp" "configure-stamp" "prefix.sql" "prefix.so"; do \
-         find $(EXPORT) -name "$$n" -print0|xargs -0 rm -f; \
-       done
+       mkdir -p $(EXPORT)/sql $(EXPORT)/doc
+       cp Makefile  $(EXPORT)/
+       cp sql/*  $(EXPORT)/sql
+       cp $(DOCS)  $(EXPORT)/doc
+       cp $(MODULES).c  $(EXPORT)/
+       rsync -Ca debian $(EXPORT)/
 
        # prepare the .orig without the debian/ packaging stuff
        rsync -Ca $(EXPORT) $(DEBDIR)
similarity index 100%
rename from README.pgfincore
rename to doc/README.pgfincore.rst
diff --git a/pgfincore.control b/pgfincore.control
new file mode 100644 (file)
index 0000000..065f723
--- /dev/null
@@ -0,0 +1,5 @@
+# pgfincore extension
+comment = 'examine and manage the os buffer cache'
+default_version = '1.0'
+module_pathname = '$libdir/pgfincore'
+relocatable = true
diff --git a/sql/pgfincore--unpackaged--1.0.sql b/sql/pgfincore--unpackaged--1.0.sql
new file mode 100644 (file)
index 0000000..afd1f62
--- /dev/null
@@ -0,0 +1,18 @@
+
+ALTER EXTENSION pgfincore ADD  FUNCTION pgsysconf_pretty();
+ALTER EXTENSION pgfincore ADD  FUNCTION pgsysconf();
+
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_willneed(regclass);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_dontneed(regclass);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_normal(regclass);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_sequential(regclass);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_random(regclass);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise(regclass, text, int);
+
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_loader(regclass, text, int, bool, bool, varbit);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfadvise_loader(regclass, int, bool, bool, varbit);
+
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfincore(regclass);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfincore(regclass, bool);
+ALTER EXTENSION pgfincore ADD  FUNCTION pgfincore(regclass, text, bool);
+
similarity index 97%
rename from pgfincore.sql.in
rename to sql/pgfincore.sql
index 8aa075bc11725f539af1ad1ed1752bd01d6805ab..5d373ff35bf212b9d9ea54a0b0e67ce7a011372e 100644 (file)
@@ -1,6 +1,4 @@
 
-SET search_path = public;
-
 --
 -- SYSCONF
 --
@@ -9,7 +7,7 @@ pgsysconf(OUT os_page_size   bigint,
           OUT os_pages_free  bigint,
           OUT os_total_pages bigint)
 RETURNS record
-AS 'MODULE_PATHNAME'
+AS '$libdir/pgfincore'
 LANGUAGE C;
 
 CREATE OR REPLACE FUNCTION
@@ -34,7 +32,7 @@ pgfadvise(IN regclass, IN text, IN int,
                  OUT rel_os_pages bigint,
                  OUT os_pages_free bigint)
 RETURNS setof record
-AS 'MODULE_PATHNAME'
+AS '$libdir/pgfincore'
 LANGUAGE C;
 
 CREATE OR REPLACE FUNCTION
@@ -98,7 +96,7 @@ pgfadvise_loader(IN regclass, IN text, IN int, IN bool, IN bool, IN varbit,
                                 OUT pages_loaded bigint,
                                 OUT pages_unloaded bigint)
 RETURNS setof record
-AS 'MODULE_PATHNAME'
+AS '$libdir/pgfincore'
 LANGUAGE C;
 
 CREATE OR REPLACE FUNCTION
@@ -125,7 +123,7 @@ pgfincore(IN regclass, IN text, IN bool,
                  OUT os_pages_free bigint,
                  OUT databit      varbit)
 RETURNS setof record
-AS 'MODULE_PATHNAME'
+AS '$libdir/pgfincore'
 LANGUAGE C;
 
 CREATE OR REPLACE FUNCTION
similarity index 95%
rename from uninstall_pgfincore.sql.in
rename to sql/uninstall_pgfincore.sql
index 75b6a6bea93c1dce46c8bb7bbe3263805fbd51f1..99c627bb98d85f8e84493aeef63b6ae5f2c144f6 100644 (file)
@@ -1,7 +1,4 @@
 
-
-SET search_path = public;
-
 DROP FUNCTION pgsysconf_pretty();
 DROP FUNCTION pgsysconf();