
# -*- 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("libXvMCW"):             source = binary
    elif binary.startswith("qt-webkit"):            source = "qtwebkit"
    elif binary.startswith("libicu44"):             source = "icu44"
    elif binary == "timidity++-patches":            source = "fluid-soundfont"
    elif binary == "soundfont-utils":               source = "gt"
    elif binary == "gnu.regexp":                    source = "gnu-regexp"
    elif binary == "msv-msv":                       source = "msv"
    elif binary == "msv-xsdlib":                    source = "msv"
   #elif binary == "servlet_2_5_api":               source = "tomcat6"
   #elif binary == "tomcat6-servlet-2.5-api":       source = "tomcat6"
    elif binary == "jakarta-commons-configuration": source = "apache-commons-configuration"
    elif binary == "jaxp":                          source = "xml-commons-apis"
    elif binary == "xfce4-doc":                     source = "xfce-utils"
    elif binary.startswith("libgoom2"):             source = "goom2k4"
    elif binary.startswith("bitstream-vera"):       source = "bitstream-vera-fonts"
    elif binary.startswith("netbeans-platform"):    source = "netbeans-platform"
    elif binary.startswith("perl("):
        print source
        source = re.sub(r"\(|\)|::",rePerlSepar,source)
    else:
        matched = False
    return (source,matched)

configuration.addSourceRepo        ("soc-changed-source-local" ,guessFedoraDistTag)
configuration.addSourceRepo        ("soc-source-local"         ,guessFedoraDistTag)
configuration.addSourceRepo        ("soc-texlive-source-local" ,guessFedoraDistTag)
configuration.addSourceRepo        ("atrpms-source"            ,None)
#configuration.addSourceRepo       ("fedora-13-source",guessFedoraDistTag)
#configuration.addSourceRepo       ("fedora-14-source",guessFedoraDistTag)
#configuration.addSourceRepo       ("fedora-15-source",guessFedoraDistTag)
#configuration.addSourceRepo       ("fedora-16-source",guessFedoraDistTag)
#configuration.setTargetRpmsRepo    ("soc-local"       ,"RPMS")
#configuration.setTargetSrpmsRepo   ("soc-source-local")
configuration.setTargetRpmsRepo   ("soc-changed-local","RPMS")
configuration.setTargetSrpmsRepo  ("soc-changed-source-local")
configuration.setBinaryToSourceHook(binaryToSource)

configuration.addExtraInfos("mplayer",builds  =[["--without", "musepack"]])
configuration.addExtraInfos("lash"   ,requires=["libuuid-devel"])
configuration.addExtraInfos("lirc"   ,builds  =[[] ,["--define", "kmdl_userland 1"]])
configuration.addExtraInfos("sdcc"   ,builds  =[["--define", "__strip /bin/true"]])
configuration.allowUpgrades(["libvpx", "libvpx-devel"])
