Exemplo n.º 1
0
def cmd_next(cfg, args):
    """
    Sets and defines the next stable version string for the most recent and
    reachable tag.

    The string should be supplied in the format "maj.min.patch[.revision]",
    where angular brackets denotes an optional value.

    All values are expected to be decimal numbers without leading zeros.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()

    last_tag = repo_info['last-tag']

    vn = args.next_version_numbers
    user = parse_user_next_stable(vn)
    if not user:
        term.err("Please specify valid version numbers.\nThe expected "
                 "format is <MAJ>.<MIN>.<PATCH>[.<REVISION>], e.g. v0.0.1, "
                 "0.0.1 or 0.0.2.1")
        sys.exit(1)

    custom = "%d.%d.%d" % (int(user['maj']), int(user['min']), int(user['patch']))

    if user['revision'] is not None:
        custom += ".%d" % (int(user['revision']))

    next_store.set(last_tag, custom).save()
    term.out("Set NEXT version string to " + term.next(custom) +
             " for the current tag " + term.tag(last_tag))
Exemplo n.º 2
0
def cmd_next(cfg, args):
    """
    Sets and defines the next stable version string for the most recent and
    reachable tag.

    The string should be supplied in the format "maj.min.patch[.revision]",
    where angular brackets denotes an optional value.

    All values are expected to be decimal numbers without leading zeros.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()

    last_tag = repo_info['last-tag']

    vn = args.next_version_numbers
    user = parse_user_next_stable(vn)
    if not user:
        term.err("Please specify valid version numbers.\nThe expected "
                 "format is <MAJ>.<MIN>.<PATCH>[.<REVISION>], e.g. v0.0.1, "
                 "0.0.1 or 0.0.2.1")
        sys.exit(1)

    custom = "%d.%d.%d" % (int(user['maj']), int(
        user['min']), int(user['patch']))

    if user['revision'] is not None:
        custom += ".%d" % (int(user['revision']))

    next_store.set(last_tag, custom).save()
    term.out("Set NEXT version string to " + term.next(custom) +
             " for the current tag " + term.tag(last_tag))
Exemplo n.º 3
0
def cmd_info(cfg, args):
    """
    Generates version string and repository information and prints it to the
    stdout.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']

    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None

    if has_next_custom:
        nvn = term.next(next_custom)
    else:
        nvn = "none, defaulting to " + \
              term.next("-" + cfg['default_meta_pr_in_next_no_next']) + \
              " suffix"

    term.out("Most recent tag: " + term.tag(last_tag))

    if repo_info['pr'] is None and repo_info['count'] > 0:
        term.out("Using NEXT defined as: " + nvn)
        term.out("(Pre-release metadata: none)")
    elif repo_info['pr'] is not None:
        term.out("(NEXT defined as: " + nvn + ")")
        term.out("Using pre-release metadata: " +
                 term.tag(str(repo_info['pr'])))

    term.out("Current build ID: " + term.tag(repo_info['full-build-id']))

    promoted = build_version_string(cfg, repo_info, True, next_custom)
    term.out(
        "Current version: " + "v" +
        term.ver(build_version_string(
            cfg, repo_info, False, next_custom)) +
        (" => v" + term.prom(promoted) if len(promoted) > 0 else '')
    )
Exemplo n.º 4
0
def cmd_info(cfg, args):
    """
    Generates version string and repository information and prints it to the
    stdout.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']

    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None

    if has_next_custom:
        nvn = term.next(next_custom)
    else:
        nvn = "none, defaulting to " + \
              term.next("-" + cfg['default_meta_pr_in_next_no_next']) + \
              " suffix"

    term.out("Most recent tag: " + term.tag(last_tag))

    if repo_info['pr'] is None and repo_info['count'] > 0:
        term.out("Using NEXT defined as: " + nvn)
        term.out("(Pre-release metadata: none)")
    elif repo_info['pr'] is not None:
        term.out("(NEXT defined as: " + nvn + ")")
        term.out("Using pre-release metadata: " +
                 term.tag(str(repo_info['pr'])))

    term.out("Current build ID: " + term.tag(repo_info['full-build-id']))

    promoted = build_version_string(cfg, repo_info, True, next_custom)
    term.out(
        "Current version: " + "v" +
        term.ver(build_version_string(
            cfg, repo_info, False, next_custom)) +
        (" => v" + term.prom(promoted) if len(promoted) > 0 else '')
    )
Exemplo n.º 5
0
 def print_item(k, v):
     term.out("    %s => %s" % (term.tag(k), term.next(v)) +
              (' (*)' if k == last_tag else ''))
Exemplo n.º 6
0
 def print_item(k, v):
     term.out("    %s => %s" % (term.tag(k), term.next(v)) +
              (' (*)' if k == last_tag else ''))