def verify_fossil(self, url):
     return util.sh_bool("""
     set -e
     rm -fr /tmp/tmpclone
     timeout 30 fossil clone {url} /tmp/tmpclone |
         grep -q -m 1 -e 'Round-trips'
     """.format(url=url))
 def verify_cvs(self, url, credentials):
     parsed = urlparse(url)
     cvsroot = ':pserver:' + parsed.netloc + ':' + parsed.path
     return util.sh_bool("""
     set -e
     rm -fr /tmp/tmpclone
     mkdir -p /tmp/tmpclone
     cd /tmp/tmpclone
     timeout 30 cvs -d {cvsroot} -z3 get . || true
     test -d CVSROOT
     """.format(cvsroot=cvsroot))
 def verify_bzr(self, url):
     #
     # try branches and version-info because:
     # * version-info fails on
     #   https://golem.ph.utexas.edu/~distler/code/instiki/svn/
     #   with bzr: ERROR: https://golem.ph... is not a local path.
     # * branches fails on https://launchpad.net/inkscape with
     #   ERROR: Transport operation not possible: ..
     #   has not implemented list_dir
     #
     return util.sh_bool("""
     set -e
     timeout 30 bzr branches {url} ||
     timeout 30 bzr version-info {url}
     """.format(url=url))
 def verify_svn(self, url, credentials):
     if credentials:
         user = '******' + credentials[0]
     else:
         user = ''
     if credentials and len(credentials) > 1:
         password = '******' + credentials[1]
     else:
         password = ''
     return util.sh_bool("""
     set -e
     failures=unknown-ca,cn-mismatch,expired,not-yet-valid,other
     timeout 30 svn info \
        --trust-server-cert-failures=$failures --non-interactive \
        {url} {user} {password}
     """.format(url=url, user=user, password=password))
 def verify_ftp(self, url):
     return util.sh_bool("""
     set -e
     timeout 30 lftp -e 'dir; quit' {url}
     """.format(url=url))
 def verify_hg(self, url):
     return util.sh_bool("""
     set -e
     timeout 30 hg identify {url}
     """.format(url=url))
 def verify_git(self, url):
     return util.sh_bool("timeout 30 git ls-remote " + url + " HEAD")
예제 #8
0
 def test_sh_bool__returns_false_on_non_zero_exit_code(self):
     assert (False is util.sh_bool('false'))
예제 #9
0
 def test_sh_bool__returns_true_on_exit_code_zero(self):
     assert (True is util.sh_bool('true'))