import re


def from_name(rpm_string):
    """
    Return an (E, N, V, R, A) tuple given a file name, by splitting
    [e:]name-version-release.arch into the four possible subcomponents.
    Default epoch, version, release and arch to None if not specified.
    Accepts RPM names with and without extensions
    """
    parse_nevra = re.compile("^" "(.*)" "-" "([^-]*)" "-" "([^-]*)" "\\." "([^.]*)" "$").match
    m = parse_nevra(rpm_string)
    if not m:
        return None
    n, v, r, a = m.groups()
    if ":" not in v:
        return None, n, v, r, a
    e, v = v.split(":", 1)
    if e.isdigit():
        e = int(e)
    return (e, n, v, r, a)