コード例 #1
0
ファイル: signing-server.py プロジェクト: wlach/build-tools
    for format_ in formats:
        passphrase = getpass.getpass("%s passphrase: " % format_)
        if not passphrase:
            passphrase = None
        tmpdir = tempfile.mkdtemp()
        try:
            log.info("checking %s passphrase", format_)
            src = config.get('signing', 'testfile_%s' % format_)
            dst = os.path.join(tmpdir, os.path.basename(src))
            shutil.copyfile(src, dst)
            # Our test app doesn't work with 10.9.5 signing machines yet, bug 1073644
            if format_ != "dmg":
                if 0 != run_signscript(config.get('signing', 'signscript'),
                                       src,
                                       dst,
                                       src,
                                       format_,
                                       passphrase,
                                       max_tries=2):
                    log.error("Bad passphrase: %s", open(dst + ".out").read())
                    assert False
            log.info("%s passphrase OK", format_)
            passphrases[format_] = passphrase
        finally:
            shutil.rmtree(tmpdir)

    # Possibly stop the old instance
    # We do this here so that we don't have to wait for the user to enter
    # passwords before stopping/starting the new instance.
    if options.action == 'restart':
        try:
コード例 #2
0
ファイル: signing-server.py プロジェクト: B-Rich/build-tools
                  )

    # Read passphrases
    passphrases = {}
    formats = [f.strip() for f in config.get('signing', 'formats').split(',')]
    for format_ in formats:
        passphrase = getpass.getpass("%s passphrase: " % format_)
        if not passphrase:
            passphrase = None
        tmpdir = tempfile.mkdtemp()
        try:
            log.info("checking %s passphrase", format_)
            src = config.get('signing', 'testfile_%s' % format_)
            dst = os.path.join(tmpdir, os.path.basename(src))
            shutil.copyfile(src, dst)
            if 0 != run_signscript(config.get('signing', 'signscript'), src, dst, src, format_, passphrase, max_tries=2):
                log.error("Bad passphrase: %s", open(dst + ".out").read())
                assert False
            log.info("%s passphrase OK", format_)
            passphrases[format_] = passphrase
        finally:
            shutil.rmtree(tmpdir)

    # Possibly stop the old instance
    # We do this here so that we don't have to wait for the user to enter
    # passwords before stopping/starting the new instance.
    if options.action == 'restart':
        try:
            pid = int(open(options.pidfile).read())
            log.info("Killing old server pid:%i", pid)
            os.kill(pid, signal.SIGINT)