Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'devel'

  • Loading branch information...
commit e8639fdc7047ad352d9e6b9caa81e079f810ed86 2 parents 4d86230 + 4f1dafa
@dvarrazzo authored
View
1  .gitignore
@@ -1,2 +1,3 @@
results/*.out
sql/italian_codes--*.sql
+dist
View
12 META.json
@@ -2,28 +2,28 @@
"name": "italian_codes",
"abstract": "Validation domains for Italian fiscal codes",
"description": "The package contains validation domains for Italian codes, such as Codice Fiscale and Partita IVA",
- "version": "1.0beta1",
+ "version": "1.0.0",
"maintainer": "Daniele Varrazzo <daniele.varrazzo@gmail.com>",
- "license": "BSD",
+ "license": "bsd",
"provides": {
"italian_codes": {
"abstract": "Validation domains for Italian fiscal codes",
"file": "sql/italian_codes.sql",
"docfile": "doc/italian_codes.rst",
- "version": "1.0beta1"
+ "version": "1.0.0"
}
},
- "release_status": "testing",
+ "release_status": "stable",
"resources": {
"homepage": "https://github.com/dvarrazzo/italian_codes",
"bugtracker": {
- "web": "https://github.com/dvarrazzo/italian_codes/issues",
+ "web": "https://github.com/dvarrazzo/italian_codes/issues"
},
"repository": {
"url": "git://github.com/dvarrazzo/italian_codes.git",
"web": "https://github.com/dvarrazzo/italian_codes",
"type": "git"
- },
+ }
},
"generated_by": "Daniele Varrazzo <daniele.varrazzo@gmail.com>",
"meta-spec": {
View
26 Makefile
@@ -6,8 +6,9 @@
EXTENSION = italian_codes
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
+EXT_LONGVER = $(shell grep '"version":' META.json | head -1 | sed -e 's/\s*"version":\s*"\(.*\)",/\1/')
-DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
+SQL = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
DOCS = $(wildcard doc/*.rst)
TESTS = $(wildcard test/sql/*.sql)
TESTS_OUT = $(wildcard test/expected/*.out)
@@ -16,6 +17,15 @@ REGRESS_OPTS = --inputdir=test --load-language=plpgsql
PG_CONFIG = pg_config
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
+PKGFILES = COPYING README.rst Makefile \
+ META.json $(EXTENSION).control \
+ $(SQL) $(DOCS) $(TESTS) $(TESTS_OUT)
+
+PKGNAME = $(EXTENSION)-$(EXT_LONGVER)
+SRCPKG = $(SRCPKG_TGZ) $(SRCPKG_ZIP)
+SRCPKG_TGZ = dist/$(PKGNAME).tar.gz
+SRCPKG_ZIP = dist/$(PKGNAME).zip
+
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql
@@ -24,7 +34,21 @@ sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
+else
+DATA = sql/$(EXTENSION).sql sql/uninstall_$(EXTENSION).sql
endif
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
+
+sdist: $(SRCPKG)
+
+$(SRCPKG): $(PKGFILES)
+ ln -sf . $(PKGNAME)
+ mkdir -p dist
+ rm -f $(SRCPKG_TGZ)
+ tar czvf $(SRCPKG_TGZ) $(addprefix $(PKGNAME)/,$^)
+ rm -f $(SRCPKG_ZIP)
+ zip -r $(SRCPKG_ZIP) $(addprefix $(PKGNAME)/,$^)
+ rm $(PKGNAME)
+
View
1  italian_codes.control
@@ -7,3 +7,4 @@
comment = 'Validation domains for Italian fiscal codes'
default_version = '1.0'
relocatable = true
+superuser = false
View
13 sql/italian_codes.sql
@@ -135,14 +135,9 @@ create function _cf_error_16(s text) returns text as
$$
begin
-- Check the basic pattern. If it doesn't match, slow check for errors.
- -- Note the final '|' char: if missing, in case of no match, the function
- -- returns no row, not null (because regexp_matches is a SRF). The result
- -- is that the if block is skipped altogether. Yes, it sucks. Big times.
- if regexp_matches(s,
- '[A-Z]{6}'
- '[0-9L-NP-V]{2}[A-Z][0-9L-NP-V]{2}'
- '[A-Z][0-9L-NP-V]{3}[A-Z]|')
- = array[''] then
+ if s !~ '^[A-Z]{6}'
+ '[0-9L-NP-V]{2}[A-Z][0-9L-NP-V]{2}'
+ '[A-Z][0-9L-NP-V]{3}[A-Z]$' then
for i in 1 .. 16 loop
declare
t text := substring('CCCCCCNNCNNCNNNC', i, 1);
@@ -214,7 +209,7 @@ create function _cf_error_11(s text) returns text as
$$
begin
-- Check the basic pattern. If it doesn't match, slow check for errors.
- if regexp_matches(s, '[0-9]{11}|') = array[''] then
+ if s !~ '^[0-9]{11}$' then
for i in 1 .. 11 loop
declare
c text := substring(s, i, 1);
Please sign in to comment.
Something went wrong with that request. Please try again.