Beispiel #1
0
def _getSVNPackage(packagename, dist_url=distribution_url, force_svn=False):
    """
    extract package informations directly from SVN top properties. This
    function is used as a fallback if this very file doesn't contain any
    informations about that packagename.
    Because some machine do not have SVN installed, it relies on the
    cache that a cron job is dumping
    @param packagename: name of the package for the conf retrieving.
    @type packagename: string
    """
    log = logging.getLogger()
    pj = None
    if packagename.upper() not in [ x.upper() for x in external_projects] :
        try :
            from urllib import urlopen
            property_content = urlopen("/".join([dist_url, "conf", "packages"])).read()
            pj = _extractPkgFromProperty(packagename, property_content)
        except :
            pass
        if not pj and force_svn :
            reps = getRepositories(protocol="anonymous")
            for name in reps:
                url = str(reps[name])
                log.debug("Looking for package '%s' in '%s' (%s)", packagename, name, url)
                rep = reps[name]
                if hasattr(rep, "getProperty") :
                    property_content = rep.getProperty("packages")
                    if property_content :
                        pj = _extractPkgFromProperty(packagename, property_content)
                        break
    return pj
Beispiel #2
0
def _getSVNProject(projectname, dist_url=distribution_url, force_svn=False):
    """
    extract project informations directly from SVN top properties. This
    function is used as a fallback if this very file doesn't contain any
    informations about that projectname.
    @param projectname: name of the project to get the configuration
    @type projectname: string
    """
    pj = None
    log = logging.getLogger()
    if projectname.upper() not in [x.upper() for x in external_projects]:
        try:
            from urllib import urlopen
            property_content = urlopen("/".join([dist_url, "conf",
                                                 "projects"])).read()
            pj = _extractPrjFromProperty(projectname, property_content)
        except:
            pass
        if not pj and force_svn:
            reps = getRepositories(protocol="anonymous")
            for name in reps:
                url = str(reps[name])
                log.debug("Looking for package '%s' in '%s' (%s)", projectname,
                          name, url)
                rep = reps[name]
                if hasattr(rep, "getProperty"):
                    property_content = rep.getProperty("projects")
                    if property_content:
                        pj = _extractPrjFromProperty(projectname,
                                                     property_content)
                        break
    return pj
#!/usr/bin/env python
"""
A script to add a project to the Software Configuration DB

"""
import logging
import sys

from LbConfiguration.Repository import getRepositories
from LbUtils.Script import Script
from LbRelease import rcs
from LbRelease.SoftConfDB.SoftConfDB import SoftConfDB

# SVN Repositories definition
url = str(getRepositories(protocol='anonymous')["lbsvn"])
lbsvn = rcs.connect(url)

gaudiurl = str(getRepositories(protocol='anonymous')["gaudi"])
gaudisvn = rcs.connect(gaudiurl)

class LbSdbAddPlatform(Script):
    """ Script to add platforms to a project in the Software
    Configuration DB. Use:
    LbSdbAddPlatform project version platform
    """

    def defineOpts(self):
        """ Script specific options """
        parser = self.parser
        parser.add_option("-d",
                          dest = "debug",