Exemple #1
0
    def setup_obs(self, namespace):
        """Setup the Buildservice instance

        Using namespace as an alias to the apiurl.
        """

        self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)
    def handle_wi(self, wid):
        """Actual job thread."""

        wid.result = False

        if not wid.fields.build_trial or not wid.fields.build_trial.project:
            raise RuntimeError("Missing mandatory field 'build_trial.project'")

        obs = BuildService(oscrc=self.oscrc, apiurl=wid.fields.ev.namespace)

        try:
            wid.result = False
            core.delete_project(obs.apiurl,
                                wid.fields.build_trial.project,
                                force=True,
                                msg="Removed by BOSS")
            self.log.info("Trial area %s removed" %
                          wid.fields.build_trial.project)
            del (wid.fields.build_trial.as_dict()["project"])
            wid.result = True
        except HTTPError as err:
            if err.code == 403:
                self.log.info("Is the BOSS user (see /etc/skynet/oscrc) enabled as a"\
                              " maintainer in %s or its parent?" \
                              % wid.fields.build_trial.project)

            if err.code == 404:
                self.log.info("HTTPError 404 : The project is already gone")
                wid.result = True
                return

            raise err
 def __get_obs(self):
     """Lazy BuildService property."""
     if self.__obs is None:
         if self.__oscrc is None or self.__obs_alias is None:
             raise RuntimeError("BuildService conf values not set. "
                                "Use get_oscrc and setup_obs decorators.")
         self.__obs = BuildService(oscrc=self.__oscrc,
                                   apiurl=self.__obs_alias)
     return self.__obs
Exemple #4
0
 def get_repositories(self, wid, project):
     if not wid.fields.ev or not wid.fields.ev.namespace:
         raise RuntimeError("Missing field: ev.namespace")
     obs = BuildService(oscrc=self.oscrc, apiurl=wid.fields.ev.namespace)
     try:
         repositories = obs.getProjectRepositories(project)
     except HTTPError, exobj:
         if exobj.code == 404:
             raise RuntimeError("Project %s not found in OBS" % project)
         raise
Exemple #5
0
    def handle_wi(self, wid):
        """Actual job thread."""

        if not wid.fields.build_trial or not wid.fields.build_trial.project:
            raise RuntimeError("Missing mandatory field 'build_trial.project'")

        self.obs = BuildService(oscrc=self.oscrc,
                                apiurl=wid.fields.ev.namespace)

        for prj in wid.fields.build_trial.as_dict().get("subprojects", []):
            if prj == wid.fields.build_trial.project:
                continue
            self._delete_project(prj)

        self._delete_project(wid.fields.build_trial.project)
apiurl = os.environ.get('OBSAPI')
oscrc = os.environ.get('OSCRC', home+"/.config/osc/oscrc")
testprj = os.environ.get('OBSTESTPRJ')
testprj2 = os.environ.get('OBSTESTPRJ2')
testpkg = os.environ.get('OBSTESTPKG')
testfile = os.environ.get('OBSTESTFILE')
if not apiurl:
        raise ValueError('You must have "OBSAPI" variable')
if not oscrc:
        raise ValueError('You must have "OSCRC" variable')
if not testprj:
        raise ValueError('You must have "OBSTESTPRJ" variable')
if not testprj2:
        raise ValueError('You must have "OBSTESTPRJ2" variable')
if not testpkg:
        raise ValueError('You must have "OBSTESTPKG" variable')
if not testfile:
        raise ValueError('You must have "OBSTESTFILE" variable')

bs = BuildService(apiurl,oscrc)

print "**********************************"
print "Our test settings:"
print "API: "+apiurl
print "OSCRC: "+oscrc
print "Test project 1: "+testprj
print "Test project 2: "+testprj2
print "Test package: "+testpkg
print "Test file: "+testfile
print "**********************************"
 def _setup_obs(self, namespace):
     """Initialize buildservice instance."""
     self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)
    def setup_obs(self, namespace):
        """Setup the Buildservice instance

        :param namespace: Alias to the OBS apiurl.
        """
        self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)
#!/usr/bin/python

from pprint import pprint

from buildservice import BuildService
bs = BuildService(apiurl='http://api.meego.com', oscrc='/etc/boss/oscrc')

print 'devel project of Trunk:'
pprint(bs.getProjectDevel('Trunk'))

print 'devel package of Trunk/bash:'
pprint(bs.getPackageDevel('Trunk', 'bash'))
 def setup_obs(self, namespace):
     """Set up OBS instance."""
     if not self.obs or self.namespace != namespace:
         self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)
         self.namespace = namespace
Exemple #11
0
#!/usr/bin/python

from buildservice import BuildService
from osc import conf, core
bs = BuildService(apiurl='https://api.meego.com', oscrc="/etc/oscrc")
#print bs.getRepoState('Trunk')
#print bs.getProjectDiff('Trunk:Testing', 'Trunk')

packages = bs.getPackageList('Trunk:Testing')
for src_package in packages:
    print src_package
    diff = core.server_diff(bs.apiurl, 'Trunk', src_package, None,
                            'Trunk:Testing', src_package, None, False)
    p = open(src_package, 'w')
    p.write(diff)
    p.close()