This is an automated email from the git hooks/post-receive script. dod pushed a commit to branch master in repository libmongodb-perl.
commit 2720c2607f2c98f31583c54d810895613c7dcb9c Author: Dominique Dumont <[email protected]> Date: Mon Apr 28 13:59:20 2014 +0200 rules: find an unused port for mongod to listen to (Closes: #719641) --- debian/rules | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/debian/rules b/debian/rules index 301b75a..7cb305a 100755 --- a/debian/rules +++ b/debian/rules @@ -2,20 +2,26 @@ BUILDHOME = $(CURDIR)/debian/build PIDFILE = $(BUILDHOME)/mongod.pid +PORT := $(shell /bin/netstat -want | perl -w -e 'while (<>) { $$used{$$1}=1 if /127\.0\.0\.1:(\d+)/;}; $$port = 12345; while ($$used{$$port}) { $$port++ }; print "$$port\n";') + +# pass PORT to test through MONGOD variable in t/lib/MongoDBTest.pm +MONGOD = localhost:$(PORT) %: dh $@ override_dh_auto_test: mkdir -p $(BUILDHOME) + # mongod is required during build only on i386 amd64 + # "until netstat" command wait for mongod to be listening on PORT if [ -x /usr/bin/mongod ]; then \ - mongod --dbpath $(BUILDHOME) --noprealloc --nojournal --quiet --fork --logpath $(BUILDHOME)/mongod.log --pidfilepath $(PIDFILE); \ - sleep 10; \ + mongod --dbpath $(BUILDHOME) --noprealloc --bind_ip 127.0.0.1 --nojournal --port $(PORT) --quiet --fork --logpath $(BUILDHOME)/mongod.log --pidfilepath $(PIDFILE); \ + i=10; \ + until (/bin/netstat -want | grep -q 127.0.0.1:$(PORT) ) || [ $$i = 0 ]; do sleep 1; i=$$((i-1)); echo waiting for mongod; done \ fi + export MONGOD=localhost:$(PORT);\ dh_auto_test - # The server process might not have actually started, since - # the system one will already be running unless policy-rc.d - # prevented it + # The server process might not have actually started [ ! -s $(PIDFILE) ] || /bin/kill `cat $(PIDFILE)` || true override_dh_clean: -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmongodb-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
