
# -*- Python -*-
#
# The configuration file of yumport.
# It's a Python file (*not* a module).

def guessFedoraDistTag ( release ):
    m = re.match(r".*\.fc(?P<fcversion>\d+)\..*",release)
    if m: return "fc%s" % (m.group("fcversion"))

    m = re.match(r".*\.(?P<disttag>[^.]+)$",release)
    if m: return m.group("disttag")

    return release

def guessPatchedDistTag ( release ):
    return "slsoc6"

def binaryToSource ( binary ):
    def rePerlSepar ( mo ):
        if   mo.group(0) == '(': return "-"
        elif mo.group(0) == ')': return ""
        elif mo.group(0) == "::": return "-"
        return ""

    matched = True
    source  = binary
    if binary.startswith("perl("):
        print source
        source = re.sub(r"\(|\)|::",rePerlSepar,source)
    else:
        matched = False
    return (source,matched)

configuration.setDelayUpdateRepo   (True)
configuration.addSourceRepo        ("soc-texlive-source-local" ,guessFedoraDistTag)
configuration.setTargetRpmsRepo    ("soc-texlive-local"       ,"RPMS")
configuration.setTargetSrpmsRepo   ("soc-texlive-source-local")
configuration.setBinaryToSourceHook(binaryToSource)
