diff --git a/.gitignore b/.gitignore index 9853a12..645521d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ tmp/ *.o regression.diffs regression.out -/sql/semver--?.??.?.sql +/sql/github.com+theory+pg-semver--?.??.?.sql /semver-* /latest-changes.md /src/*.bc diff --git a/META.json b/META.json index 103e79f..de2eaf4 100644 --- a/META.json +++ b/META.json @@ -1,5 +1,5 @@ { - "name": "semver", + "name": "github.com+theory+pg-semver", "abstract": "A semantic version data type", "description": "A Postgres data type for the Semantic Version format with support for btree and hash indexing.", "version": "0.32.1", @@ -11,7 +11,7 @@ ], "license": "postgresql", "provides": { - "semver": { + "github.com+theory+pg-semver": { "abstract": "A semantic version data type", "file": "sql/semver.sql", "docfile": "doc/semver.mmd", diff --git a/Makefile b/Makefile index e70adb7..3d75680 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +NAME = semver EXTENSION = $(shell grep -m 1 '"name":' META.json | \ sed -e 's/[[:space:]]*"name":[[:space:]]*"\([^"]*\)",/\1/') EXTVERSION = $(shell grep -m 1 '[[:space:]]\{8\}"version":' META.json | \ @@ -5,7 +6,7 @@ EXTVERSION = $(shell grep -m 1 '[[:space:]]\{8\}"version":' META.json | \ DISTVERSION = $(shell grep -m 1 '[[:space:]]\{3\}"version":' META.json | \ sed -e 's/[[:space:]]*"version":[[:space:]]*"\([^"]*\)",\{0,1\}/\1/') -MODULEDIR = semver +MODULEDIR = $(EXTENSION) DATA = $(wildcard sql/*.sql) DOCS = $(wildcard doc/*.mmd) TESTS = $(wildcard test/sql/*.sql) @@ -25,7 +26,7 @@ include $(PGXS) all: sql/$(EXTENSION)--$(EXTVERSION).sql -sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql +sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(NAME).sql cp $< $@ .PHONY: results diff --git a/README.md b/README.md index 4bd4312..0e78621 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ semver 0.32.0 ============= +Namespace Experiment +-------------------- + +Experimental branch to try naming an extension with a source code repository URL +similar to Go packages. + [![PGXN version](https://badge.fury.io/pg/semver.svg)](https://badge.fury.io/pg/semver) [![Build Status](https://github.com/theory/pg-semver/workflows/CI/badge.svg)](https://github.com/theory/pg-semver/actions) diff --git a/github.com+theory+pg-semver.control b/github.com+theory+pg-semver.control new file mode 100644 index 0000000..3625250 --- /dev/null +++ b/github.com+theory+pg-semver.control @@ -0,0 +1,6 @@ +# github.com+theory+pg-semver extension +comment = 'Semantic version data type' +default_version = '0.32.1' +directory = 'github.com+theory+pg-semver' +module_pathname = '$libdir/github.com+theory+pg-semver' +relocatable = true diff --git a/semver.control b/semver.control deleted file mode 100644 index fbc6d1f..0000000 --- a/semver.control +++ /dev/null @@ -1,7 +0,0 @@ -# semver extension -comment = 'Semantic version data type' -default_version = '0.32.1' - -directory = 'semver' -module_pathname = '$libdir/semver' -relocatable = true diff --git a/sql/semver.sql b/sql/semver.sql index cd23b47..11b3de6 100644 --- a/sql/semver.sql +++ b/sql/semver.sql @@ -26,22 +26,22 @@ CREATE TYPE semver; -- CREATE OR REPLACE FUNCTION semver_in(cstring) RETURNS semver - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION semver_out(semver) RETURNS cstring - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION semver_recv(internal) RETURNS semver - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION semver_send(semver) RETURNS bytea - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; -- @@ -67,7 +67,7 @@ CREATE TYPE semver ( CREATE OR REPLACE FUNCTION to_semver(text) RETURNS semver - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; -- @@ -76,12 +76,12 @@ CREATE OR REPLACE FUNCTION to_semver(text) CREATE OR REPLACE FUNCTION semver(text) RETURNS semver - AS 'semver', 'text_to_semver' + AS 'MODULE_PATHNAME', 'text_to_semver' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION text(semver) RETURNS text - AS 'semver', 'semver_to_text' + AS 'MODULE_PATHNAME', 'semver_to_text' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION semver(numeric) @@ -127,7 +127,7 @@ CREATE CAST (bigint AS semver) WITH FUNCTION semver(bigint); CREATE OR REPLACE FUNCTION semver_eq(semver, semver) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OPERATOR = ( @@ -143,7 +143,7 @@ CREATE OPERATOR = ( CREATE OR REPLACE FUNCTION semver_ne(semver, semver) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OPERATOR <> ( @@ -157,7 +157,7 @@ CREATE OPERATOR <> ( CREATE OR REPLACE FUNCTION semver_le(semver, semver) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OPERATOR <= ( @@ -169,7 +169,7 @@ CREATE OPERATOR <= ( CREATE OR REPLACE FUNCTION semver_lt(semver, semver) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OPERATOR < ( @@ -181,7 +181,7 @@ CREATE OPERATOR < ( CREATE OR REPLACE FUNCTION semver_ge(semver, semver) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OPERATOR >= ( @@ -193,7 +193,7 @@ CREATE OPERATOR >= ( CREATE OR REPLACE FUNCTION semver_gt(semver, semver) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OPERATOR > ( @@ -209,12 +209,12 @@ CREATE OPERATOR > ( CREATE OR REPLACE FUNCTION semver_cmp(semver, semver) RETURNS int4 - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION hash_semver(semver) RETURNS int4 - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; -- @@ -245,7 +245,7 @@ DEFAULT FOR TYPE semver USING hash AS CREATE OR REPLACE FUNCTION semver_smaller(semver, semver) RETURNS semver - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE AGGREGATE min(semver) ( @@ -256,7 +256,7 @@ CREATE AGGREGATE min(semver) ( CREATE OR REPLACE FUNCTION semver_larger(semver, semver) RETURNS semver - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE AGGREGATE max(semver) ( @@ -271,7 +271,7 @@ CREATE AGGREGATE max(semver) ( CREATE OR REPLACE FUNCTION is_semver(text) RETURNS bool - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; -- @@ -280,22 +280,22 @@ CREATE OR REPLACE FUNCTION is_semver(text) CREATE OR REPLACE FUNCTION get_semver_major(semver) RETURNS int4 - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION get_semver_minor(semver) RETURNS int4 - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION get_semver_patch(semver) RETURNS int4 - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE OR REPLACE FUNCTION get_semver_prerelease(semver) RETURNS text - AS 'semver' + AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; CREATE TYPE semverrange AS RANGE (SUBTYPE = semver); diff --git a/src/semver.c b/src/github.com+theory+pg-semver.c similarity index 100% rename from src/semver.c rename to src/github.com+theory+pg-semver.c diff --git a/test/sql/base.sql b/test/sql/base.sql index af599d8..e471e74 100644 --- a/test/sql/base.sql +++ b/test/sql/base.sql @@ -2,7 +2,7 @@ BEGIN; \i test/pgtap-core.sql -\i sql/semver.sql +CREATE EXTENSION "github.com+theory+pg-semver"; SELECT plan(334); --SELECT * FROM no_plan(); diff --git a/test/sql/corpus.sql b/test/sql/corpus.sql index 1f5f637..cdc8881 100644 --- a/test/sql/corpus.sql +++ b/test/sql/corpus.sql @@ -4,7 +4,7 @@ BEGIN; -- Test the SemVer corpus from https://regex101.com/r/Ly7O1x/3/. \i test/pgtap-core.sql -\i sql/semver.sql +CREATE EXTENSION "github.com+theory+pg-semver"; SELECT plan(71); --SELECT * FROM no_plan();