Skip to content

Commit b84a81d

Browse files
committed
[ci]: Updating fix to make_test_base
1 parent 11bcb5e commit b84a81d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.ci/make_test_base

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,22 @@ put into postgresql conf.
77
88
On success, starts database
99
"""
10-
import os,sys,subprocess,glob,re,os.path,time
10+
import os,sys,subprocess,glob,re,os.path,time,re
1111

1212
if len(sys.argv)!=2:
1313
print >>sys.stderr,"Usage %s data-directory" % sys.argv[0]
1414
sys.exit(1)
15+
16+
def prepare_extlist(value):
17+
v = re.sub("[']", '', value)
18+
l = re.split("\s*,\s*",v)
19+
if "pg_pathman" in l:
20+
# remove duplicates and reorder extension list to move pg_pathman to tail
21+
nl = sorted(list(set(l)), cmp = lambda a,b: 1 if a=="pg_pathman" else -1)
22+
new_value = "'{}'".format(",".join(nl))
23+
return new_value
24+
else:
25+
return value
1526

1627
datadir=sys.argv[1]
1728

@@ -27,7 +38,7 @@ if exitcode:
2738
sys.exit(exitcode)
2839
# Collect extra config option
2940
addopts={}
30-
for module in sorted(glob.glob("contrib/*"), cmp = lambda a,b: 1 if a=="pg_pathman" else -1):
41+
for module in glob.glob("contrib/*"):
3142
if not os.path.isdir(module):
3243
continue
3344
if not os.access(module+"/Makefile",os.R_OK):
@@ -59,7 +70,7 @@ for module in sorted(glob.glob("contrib/*"), cmp = lambda a,b: 1 if a=="pg_pathm
5970
if addopts:
6071
with open(datadir+"/postgresql.conf","a") as f:
6172
for opt,value in addopts.items():
62-
print >> f,"%s=%s"%(opt,value)
73+
print >> f,"%s=%s"%(opt,prepare_extlist(value))
6374
with open("initdb.log","a") as f:
6475
exitcode=subprocess.call(["pg_ctl","start","-D",datadir,"-l",datadir+"/postmaster.log"],env=env,stdout=f,stderr=subprocess.STDOUT)
6576
if exitcode:
@@ -73,5 +84,3 @@ while time.time() < failtime:
7384
sys.exit(0)
7485
print >>sys.stderr,"Database havent't started in 60 seconds"
7586
sys.exit(1)
76-
77-

0 commit comments

Comments
 (0)