#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

import getopt
import os
import sys

import hecatoncheir.DbProfilerVerify as DbProfilerVerify
import hecatoncheir.logger as log
from hecatoncheir.msgutil import gettext as _


def usage():
    print '''
Usage: %s [repo file]

Options:
    --help                     Print this help.

''' % os.path.basename(sys.argv[0])

if __name__ == "__main__":
    try:
        opts, args = getopt.getopt(sys.argv[1:], "",
                                   ["help", "debug"])
    except getopt.GetoptError as err:
        log.error(unicode(err))
        usage()
        sys.exit(1)

    debug = False

    for o, a in opts:
        if o in ("--help"):
            usage()
            sys.exit(0)
        elif o in ("--debug"):
            debug = True
        else:
            log.error("unexpected option. internal error.")
            sys.exit(1)

    if len(sys.argv) < 2:
        usage()
        sys.exit(1)

    repofile = args[0]

    v = DbProfilerVerify.DbProfilerVerify(repofile, debug=debug)
    if v.verify():
        sys.exit(2)

    sys.exit(0)

078ae197fb1bb7f3f72f42622a72c86de5f08b66
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

import getopt
import os
import sys

import hecatoncheir.DbProfilerVerify as DbProfilerVerify
import hecatoncheir.logger as log
from hecatoncheir.msgutil import gettext as _


def usage():
    print '''
Usage: %s [repo file]

Options:
    --help                     Print this help.

''' % os.path.basename(sys.argv[0])

if __name__ == "__main__":
    try:
        opts, args = getopt.getopt(sys.argv[1:], "",
                                   ["help", "debug"])
    except getopt.GetoptError as err:
        log.error(unicode(err))
        usage()
        sys.exit(1)

    debug = False

    for o, a in opts:
        if o in ("--help"):
            usage()
            sys.exit(0)
        elif o in ("--debug"):
            debug = True
        else:
            log.error("unexpected option. internal error.")
            sys.exit(1)

    if len(sys.argv) < 2:
        usage()
        sys.exit(1)

    repofile = args[0]

    v = DbProfilerVerify.DbProfilerVerify(repofile, debug=debug)
    if v.verify():
        sys.exit(2)

    sys.exit(0)
