Makefile: Strip PARALLEL tags on deploy

Since releases are commited into the proyect instead of stripping the labels
when generating the release file, we need to do it before deploying (depending
on the PG release)
This commit is contained in:
Raul Marin 2017-11-15 13:01:47 +01:00 committed by Raúl Marín
parent de0bbb0bd3
commit 192f89bf4d

View File

@ -24,13 +24,12 @@ REPLACEMENTS = -e 's/@@VERSION@@/$(EXTVERSION)/g'
$(DATA): $(SOURCES_DATA)
$(SED) $(REPLACEMENTS) $(SOURCES_DATA_DIR)/*.sql > $@
ifeq ($(PG_PARALLEL), 0)
# Remove PARALLEL in aggregates and functions
$(eval TMPFILE := $(shell mktemp /tmp/$(basename $0).XXXXXXXX))
$(SED) -e 's/PARALLEL \= [A-Z]*,/''/g' \
-e 's/PARALLEL [A-Z]*/''/g' $@ > $(TMPFILE)
$(eval TMPFILE := $(shell mktemp /tmp/$@.XXXXXXXXXX))
$(SED) -e 's/PARALLEL \= [A-Z]*,/''/g' -e 's/PARALLEL [A-Z]*/''/g' $@ > $(TMPFILE);
mv $(TMPFILE) $@
endif
TEST_DIR = test
REGRESS = $(sort $(notdir $(basename $(wildcard $(TEST_DIR)/sql/*test.sql))))
REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)'
@ -57,7 +56,18 @@ test: installcheck
release: ../../release/$(EXTENSION).control $(SOURCES_DATA)
$(SED) $(REPLACEMENTS) $(SOURCES_DATA_DIR)/*.sql > ../../release/$(EXTENSION)--$(EXTVERSION).sql
# Install the current relese into the PostgreSQL extensions directory
deploy:
# If needed remove PARALLEL tags from the release files
release_remove_parallel_deploy:
ifeq ($(PG_PARALLEL), 0)
for n in $(wildcard ../../release/*.sql); do \
$(eval TMPFILE := $(shell mktemp /tmp/XXXXXXXXXX)) \
$(SED) -e 's/PARALLEL \= [A-Z]*,/''/g' -e 's/PARALLEL [A-Z]*/''/g' $$n > $(TMPFILE); \
mv $(TMPFILE) $$n; \
done
endif
# Install the current release into the PostgreSQL extensions directory
deploy: release_remove_parallel_deploy
$(INSTALL_DATA) ../../release/$(EXTENSION).control '$(DESTDIR)$(datadir)/extension/'
$(INSTALL_DATA) ../../release/*.sql '$(DESTDIR)$(datadir)/extension/'