[postgis-tickets] r14904 - Convert some SED to PERL for more reliability in BSD-style unixes and have non-gnu sed

Paul Ramsey pramsey at cleverelephant.ca
Sun May 15 08:15:28 PDT 2016


Author: pramsey
Date: 2016-05-15 08:15:28 -0700 (Sun, 15 May 2016)
New Revision: 14904

Modified:
   trunk/extensions/postgis_sfcgal/Makefile.in
   trunk/extensions/postgis_tiger_geocoder/Makefile.in
   trunk/extensions/postgis_topology/Makefile.in
Log:
Convert some SED to PERL for more reliability in BSD-style unixes and have non-gnu sed


Modified: trunk/extensions/postgis_sfcgal/Makefile.in
===================================================================
--- trunk/extensions/postgis_sfcgal/Makefile.in	2016-05-15 15:09:20 UTC (rev 14903)
+++ trunk/extensions/postgis_sfcgal/Makefile.in	2016-05-15 15:15:28 UTC (rev 14904)
@@ -4,19 +4,23 @@
 EXTVERSION    = @POSTGIS_LIB_VERSION@
 MINORVERSION  = @POSTGIS_MAJOR_VERSION at .@POSTGIS_MINOR_VERSION@
 GREP = @GREP@
+PERL = @PERL@
 
-MICRO_NUMBER  = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
+MICRO_NUMBER  = $(shell echo $(EXTVERSION) | \
+						$(PERL) -pe 's/\d.\d.(\d+)[a-zA-Z]*\d*/$1/'
+
 PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
-                        sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
+                        $(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
                         $(GREP) "[a-zA-Z]" | \
-                        sed "s/[0-9][a-zA-Z]\([0-9]*\)[a-zA-Z]*/\1/")
+                        $(PERL) -pe 's/\d+[a-zA-Z]+(\d+)/\1/'
+
 MICRO_PREV    = $(shell if test "$(MICRO_NUMBER)x" != "x"; then expr $(MICRO_NUMBER) - 1; fi)
 PREREL_PREV   = $(shell if test "$(PREREL_NUMBER)x" != "x"; then expr $(PREREL_NUMBER) - 1; fi)
 
 PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
-                        sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
+                        $(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
                         $(GREP) "[a-zA-Z]" | \
-                        sed "s/\([0-9][a-zA-Z]*\)[0-9]*/\1/")
+                        $(PERL) -pe 's/(\d+[a-zA-Z]+)\d*/\1/'
 
 DATA         = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
 
@@ -45,18 +49,18 @@
 sql/$(EXTENSION)--$(EXTVERSION)next--$(EXTVERSION).sql: sql/$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql
 	mkdir -p sql
 	cp $< $@
-	
+
 sql_bits/sfcgal.sql: ../../postgis/sfcgal.sql
 	mkdir -p sql_bits
-	sed -e 's/BEGIN;//g' -e 's/COMMIT;//g'  $< > $@
-	
+	$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
+
 ../../doc/sfcgal_comments.sql:
 	$(MAKE) -C ../../doc comments
-	
+
 sql_bits/sfcgal_comments.sql: ../../doc/sfcgal_comments.sql
 	mkdir -p sql_bits
 	cp $< $@
-	
+
 #grep all lines that start with CREATE OR REPLACE FUNCTION, TRIGGER...
 #then replace CREATE OR REPLACE .. with ALTER EXTENSION..;
 #then remove default values and extra junk
@@ -66,7 +70,7 @@
 
 sql_bits/sfcgal_upgrade.sql : ../../postgis/sfcgal_upgrade.sql
 	mkdir -p sql_bits
-	sed -e 's/BEGIN;//g' -e 's/COMMIT;//g'  $< > $@
+	$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
 
 sql_bits/sfcgal_upgrade_minor.sql: ../postgis_extension_helper.sql sql_bits/sfcgal_upgrade.sql ../../doc/sfcgal_comments.sql ../postgis_extension_helper_uninstall.sql
 	mkdir -p sql_bits

Modified: trunk/extensions/postgis_tiger_geocoder/Makefile.in
===================================================================
--- trunk/extensions/postgis_tiger_geocoder/Makefile.in	2016-05-15 15:09:20 UTC (rev 14903)
+++ trunk/extensions/postgis_tiger_geocoder/Makefile.in	2016-05-15 15:15:28 UTC (rev 14904)
@@ -4,19 +4,23 @@
 EXTVERSION    = @POSTGIS_LIB_VERSION@
 MINORVERSION  = 2011. at POSTGIS_MAJOR_VERSION@. at POSTGIS_MINOR_VERSION@
 GREP = @GREP@
+PERL = @PERL@
 
-MICRO_NUMBER  = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
+MICRO_NUMBER  = $(shell echo $(EXTVERSION) | \
+						$(PERL) -pe 's/\d.\d.(\d+)[a-zA-Z]*\d*/$1/'
+
 PREREL_NUMBER = $(shell echo $(EXTVERSION) | \
-                        sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
+                        $(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
                         $(GREP) "[a-zA-Z]" | \
-                        sed "s/[0-9][a-zA-Z]\([0-9]*\)[a-zA-Z]*/\1/")
+                        $(PERL) -pe 's/\d+[a-zA-Z]+(\d+)/\1/'
+
 MICRO_PREV    = $(shell if test "$(MICRO_NUMBER)x" != "x"; then expr $(MICRO_NUMBER) - 1; fi)
 PREREL_PREV   = $(shell if test "$(PREREL_NUMBER)x" != "x"; then expr $(PREREL_NUMBER) - 1; fi)
 
 PREREL_PREFIX = $(shell echo $(EXTVERSION) | \
-                        sed "s/[0-9]\.[0-9]\.\(.*\)/\1/" | \
+                        $(PERL) -pe 's/\d\.\d\.(.*)/\1/' | \
                         $(GREP) "[a-zA-Z]" | \
-                        sed "s/\([0-9][a-zA-Z]*\)[0-9]*/\1/")
+                        $(PERL) -pe 's/(\d+[a-zA-Z]+)\d*/\1/'
 
 DATA         = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
 REGRESS = test-normalize_address
@@ -148,6 +152,7 @@
 	
 sql_bits/tiger_geocoder.sql: sql_bits/tiger_geocoder.sql.in
 	sed -e 's/BEGIN;//g' -e 's/COMMIT;//g' -e '/^CREATE SCHEMA/d;'  $< > $@
+	$(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' $< > $@
 	
 sql_bits/add_search_path.sql: sql_bits/add_search_path.sql.in
 	cp $< $@

Modified: trunk/extensions/postgis_topology/Makefile.in
===================================================================
--- trunk/extensions/postgis_topology/Makefile.in	2016-05-15 15:09:20 UTC (rev 14903)
+++ trunk/extensions/postgis_topology/Makefile.in	2016-05-15 15:15:28 UTC (rev 14904)
@@ -1,9 +1,10 @@
 include ../upgradeable_versions.mk
 
-EXTENSION    = postgis_topology
+EXTENSION     = postgis_topology
 EXTVERSION    = @POSTGIS_LIB_VERSION@
 MINORVERSION  = @POSTGIS_MAJOR_VERSION at .@POSTGIS_MINOR_VERSION@
-GREP=@GREP@
+GREP = @GREP@
+PERL = @PERL@
 
 MICRO_NUMBER  = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
 PREREL_NUMBER = $(shell echo $(EXTVERSION) | \



More information about the postgis-tickets mailing list