コード例 #1
0
ファイル: buildcfg.py プロジェクト: fedora-conary/rmake-2
        # any macros separately (RMK-996)
        if 'macros' in self:
            macros = sorted(x for x in self.macros.iteritems())
            if macros:
                return '\n'.join('%s = %r' % x for x in macros) + '\n'
        return ''

    def _writeKey(self, out, cfgItem, value, options):
        if cfgItem.name in self._cfg_hidden:
            if not options.get('displayHidden', False):
                return
        conarycfg.ConaryConfiguration._writeKey(self, out, cfgItem,
                                                self[cfgItem.name], options)


apiutils.register(apiutils.api_freezable(BuildConfiguration),
                  'BuildConfiguration')

class SanitizedBuildConfiguration(object):

    @staticmethod
    def __freeze__(cfg):
        cfg = apiutils.freeze('BuildConfiguration', cfg)
        cfg['user'] = []
        cfg['entitlement'] = []
        return cfg

    @staticmethod
    def __thaw__(cfg):
        return apiutils.thaw('BuildConfiguration', cfg)
apiutils.register(SanitizedBuildConfiguration)
コード例 #2
0
        # any macros separately (RMK-996)
        if 'macros' in self:
            macros = sorted(x for x in self.macros.iteritems())
            if macros:
                return '\n'.join('%s = %r' % x for x in macros) + '\n'
        return ''

    def _writeKey(self, out, cfgItem, value, options):
        if cfgItem.name in self._cfg_hidden:
            if not options.get('displayHidden', False):
                return
        conarycfg.ConaryConfiguration._writeKey(self, out, cfgItem,
                                                self[cfgItem.name], options)


apiutils.register(apiutils.api_freezable(BuildConfiguration),
                  'BuildConfiguration')


class SanitizedBuildConfiguration(object):
    @staticmethod
    def __freeze__(cfg):
        cfg = apiutils.freeze('BuildConfiguration', cfg)
        cfg['user'] = []
        cfg['entitlement'] = []
        return cfg

    @staticmethod
    def __thaw__(cfg):
        return apiutils.thaw('BuildConfiguration', cfg)
コード例 #3
0
ファイル: buildjob.py プロジェクト: fedora-conary/rmake-2
        self._setState(JOB_STATE_BUILT, 'Commit failed: %s' % message)

    def jobCommitted(self, troveMap):
        self._setState(JOB_STATE_COMMITTED, '')
        publisher = self.getPublisher()
        publisher.jobCommitted(self, troveMap)

    def exceptionOccurred(self, err, tb):
        self.jobFailed(failure.InternalError(str(err), tb))

    def _setState(self, state, status='', *args):
        self.state = state
        self.status = status
        self._publisher.jobStateUpdated(self, state, status, *args)

apiutils.register(apiutils.api_freezable(BuildJob))

def NewBuildJob(db, troveTups, jobConfig=None, state=JOB_STATE_INIT, uuid=''):
    """
        Create a new build job that is attached to the database - i.e.
        that will send notifications to the database when it is updated.

        Note this is the preferred way to create a BuildJob, since it gives
        the job a jobId.
    """
    job = BuildJob(None, troveTups, state=state, uuid=uuid)
    if jobConfig:
        job.setMainConfig(jobConfig)
    db.addJob(job)
    return job
コード例 #4
0
        return new


class StatusSubscriber(_AbstractStatusSubscriber,
                       FreezableStatusSubscriberMixin):
    def parse(self, field, data):
        if field not in self.fields:
            getattr(self, 'parse_' + field)(data)
        else:
            self[field] = data

    def parse_apiVersion(self, data):
        self.apiVersion = data

    def parse_event(self, data):
        event = data.split(None)
        for event in data.split():
            fields = event.split('+', 1)
            if len(fields) == 1:
                self.watchEvent(event)
            else:
                self.watchEvent(fields[0], fields[1].split(','))

    def __deepcopy__(self, memo):
        s = self.__class__(self.subscriberId, self.uri)
        [s.parse(*x.split(None, 1)) for x in self.freezeData()[1:]]
        return s


apiutils.register(apiutils.api_freezable(StatusSubscriber), name='Subscriber')
コード例 #5
0
ファイル: subscriber.py プロジェクト: pombredanne/rmake3
            new.parse(field, val)
        return new


class StatusSubscriber(_AbstractStatusSubscriber, FreezableStatusSubscriberMixin):
    def parse(self, field, data):
        if field not in self.fields:
            getattr(self, "parse_" + field)(data)
        else:
            self[field] = data

    def parse_apiVersion(self, data):
        self.apiVersion = data

    def parse_event(self, data):
        event = data.split(None)
        for event in data.split():
            fields = event.split("+", 1)
            if len(fields) == 1:
                self.watchEvent(event)
            else:
                self.watchEvent(fields[0], fields[1].split(","))

    def __deepcopy__(self, memo):
        s = self.__class__(self.subscriberId, self.uri)
        [s.parse(*x.split(None, 1)) for x in self.freezeData()[1:]]
        return s


apiutils.register(apiutils.api_freezable(StatusSubscriber), name="Subscriber")
コード例 #6
0
    def jobCommitted(self, troveMap):
        self._setState(JOB_STATE_COMMITTED, '')
        publisher = self.getPublisher()
        publisher.jobCommitted(self, troveMap)

    def exceptionOccurred(self, err, tb):
        self.jobFailed(failure.InternalError(str(err), tb))

    def _setState(self, state, status='', *args):
        self.state = state
        self.status = status
        self._publisher.jobStateUpdated(self, state, status, *args)


apiutils.register(apiutils.api_freezable(BuildJob))


def NewBuildJob(db, troveTups, jobConfig=None, state=JOB_STATE_INIT, uuid=''):
    """
        Create a new build job that is attached to the database - i.e.
        that will send notifications to the database when it is updated.

        Note this is the preferred way to create a BuildJob, since it gives
        the job a jobId.
    """
    job = BuildJob(None, troveTups, state=state, uuid=uuid)
    if jobConfig:
        job.setMainConfig(jobConfig)
    db.addJob(job)
    return job