def main():
    args = parse_args()

    proposed_project_name, watch = detect_hosting_service(args.url)

    if not args.pkg_name:
        args.pkg_name = proposed_project_name

    create_git_repo(args.pkg_name)
    os.mkdir('debian')
    write_watch_file(watch)
    run_cmd('/usr/bin/dch', '--create', "--package", args.pkg_name, '--empty',
            '-v', '0.0.0-1')
    run_cmd('/usr/bin/git', 'import-orig', '--uscan', '-v', '--no-interactive')
    os.unlink('debian/changelog')
    run_cmd('/usr/bin/debdry')
    run_cmd('/usr/bin/git', 'add', 'debian')
Beispiel #2
0
def main():
    args = parse_args()
    setup_logging(args.debug)

    proposed_project_name, watch = detect_hosting_service(
        args.url, pkg_name=args.pkg_name)

    if not args.pkg_name:
        args.pkg_name = proposed_project_name

    log.info("Creating Git repository")
    create_git_repo(args.pkg_name)

    log.debug("Creating debian directory")
    os.mkdir('debian')

    log.info("Generating watch file")
    write_watch_file(watch)
    if args.debug:
        log.debug('-' * 10)
        with open('debian/watch') as f:
            for line in f:
                log.debug(line.rstrip())

        log.debug('-' * 10)

    log.debug("Generating temporary changelog file")
    run_cmd('/usr/bin/dch', '--create', "--package", args.pkg_name, '--empty',
            '-v', '0.0.0-1')

    if args.debug:
        log.debug("Running uscan test")
        run_cmd('/usr/bin/uscan', '--report')

    log.info("Importing tarball using uscan")
    run_cmd('/usr/bin/git', 'import-orig', '--uscan', '-v', '--no-interactive')

    log.debug("Deleting temporary changelog")
    os.unlink('debian/changelog')

    log.info("Running debdry")
    run_cmd('/usr/bin/debdry', '-v')

    log.debug("Adding debian directory to Git")
    run_cmd('/usr/bin/git', 'add', 'debian')
def test_detect_hosting(url_and_expected_watch):
    url, expected_watch = url_and_expected_watch
    pkg_name, watch = detect_hosting_service(url)
    assert watch == expected_watch
def test_detect_hosting(url_and_expected_watch):
    url, expected_watch = url_and_expected_watch
    pkg_name, watch = detect_hosting_service(url)
    assert watch == expected_watch