Beispiel #1
0
class Node(BaseObject):

    _xobj = xobj.XObjMetadata()
    name = str
    trovelist = TroveIdentList
    fullnodelist = object
    version = VersionSummary
    flavor = str
    changeLog = ChangeLog
    shortdesc = str

    def __init__(self, version=None, mkUrl=None, **kwargs):
        BaseObject.__init__(self, **kwargs)
        self.version = VersionSummary(version)
        if mkUrl:
            host = version.trailingLabel().getHost()
            self.trovelist = \
                TroveIdentList(id = mkUrl('troves', "%s=%s" %
                                                (self.name, version),
                          host = host))
            self.fullnodelist = \
                TroveIdentList(id = mkUrl('node',
                          [ ('label',  str(version.trailingLabel())),
                            ('name',   self.name),
                            ('latest', '0') ]))
Beispiel #2
0
class TroveList(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='trovelist')
    trove = [SingleTrove]

    def append(self, trv):
        self.trove.append(trv)
Beispiel #3
0
class NamedNodeList(NodeList):
    _xobj = xobj.XObjMetadata(tag='nodelist',
                              attributes={
                                  'total': int,
                                  'start': int,
                                  'id': str
                              })
    node = [Node]
Beispiel #4
0
class BuildLog(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'id': str})

    def __init__(self, fileId, host, thisHost=None, mkUrl=None):
        BaseObject.__init__(self,
                            id=mkUrl('logfile',
                                     fileId,
                                     host=host,
                                     thisHost=thisHost))
Beispiel #5
0
class FileObj(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'id': str})

    owner = str
    group = str
    mtime = long
    perms = int

    def __init__(self, mkUrl=None, fileId=None, **kwargs):
        BaseObject.__init__(self, **kwargs)
        if mkUrl:
            self.id = mkUrl('file', fileId, 'info')
Beispiel #6
0
class TroveIdent(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'id': str})
    name = str
    version = Version
    flavor = str

    def __init__(self, version=None, mkUrl=None, **kwargs):
        BaseObject.__init__(self, **kwargs)
        self.version = Version(version)
        if mkUrl:
            host = version.trailingLabel().getHost()
            self.id = mkUrl('trove',
                            "%s=%s[%s]" % (self.name, version, self.flavor),
                            host=host)
Beispiel #7
0
class TroveIdentList(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={
        'total': int,
        'start': int,
        'id': str
    })
    trove = [TroveIdent]

    def append(self, name=None, version=None, flavor=None, mkUrl=None):
        self.trove.append(
            TroveIdent(name=name, version=version, flavor=flavor, mkUrl=mkUrl))

    def __init__(self, **kwargs):
        BaseObject.__init__(self, **kwargs)
Beispiel #8
0
class RegularFile(FileObj):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='file')
    size = XObjLong
    sha1 = str
    content = Content

    def __init__(self,
                 mkUrl=None,
                 fileId=None,
                 path=None,
                 withContentLink=True,
                 **kwargs):
        FileObj.__init__(self, mkUrl=mkUrl, fileId=fileId, **kwargs)
        if withContentLink and mkUrl:
            self.content = Content(href=mkUrl('file', fileId, 'content', path))
Beispiel #9
0
class NodeList(BaseObject):
    _xobj = xobj.XObjMetadata(attributes={
        'total': int,
        'start': int,
        'id': str,
        'href': str
    })
    node = [Node]

    def append(self,
               name=None,
               version=None,
               mkUrl=None,
               changeLog=None,
               shortdesc=None):
        self.node.append(
            Node(name=name,
                 version=version,
                 mkUrl=mkUrl,
                 changeLog=changeLog,
                 shortdesc=None))
Beispiel #10
0
class Repository(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='repository')
    label = [Label]
    trovelist = TroveIdentList

    def appendLabel(self, labelStr, mkUrl=None):
        l = Label(name=labelStr)
        if mkUrl:
            l.latest = TroveIdentList(id=mkUrl('trove', [('label', labelStr)]))
            l.summary = NodeList(
                href=mkUrl('node', [('label', labelStr), (
                    'type', 'package'), ('type', 'group'), ('type',
                                                            'fileset')]))
            l.groups = NodeList(
                href=mkUrl('node', [('label', labelStr), ('type', 'group')]))
            l.packages = NodeList(href=mkUrl('node', [(
                'label', labelStr), ('type', 'package'), ('type', 'fileset')]))
            l.sources = NodeList(
                href=mkUrl('node', [('label', labelStr), ('type', 'source')]))

        self.label.append(l)
Beispiel #11
0
class Inode(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'id': str})
Beispiel #12
0
class SingleTrove(TroveIdent):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='trove')
    fileref = [FileReference]
    included = IncludedTroves
    source = SourceTrove
    buildtime = long
    clonedfrom = ClonedFrom
    size = long
    builddeps = BuildDeps
    policyprovider = PolicyProvider
    loadedtroves = LoadedTroves
    copiedfrom = CopiedFrom
    derivedfrom = DerivedFrom
    license = [str]
    shortdesc = str
    longdesc = str
    crypto = [str]
    displayflavor = str
    buildlog = str
    xmlbuildlog = BuildLog
    buildlog = BuildLog

    def __init__(self, source=None, mkUrl=None, thisHost=None, **kwargs):
        TroveIdent.__init__(self, mkUrl=mkUrl, **kwargs)
        self._mkUrl = mkUrl
        self._thisHost = thisHost
        if source:
            self.source = SourceTrove()
            self.source.append(name=source[0],
                               version=source[1],
                               flavor=source[2],
                               mkUrl=mkUrl)

    def addFile(self, f):
        self.fileref.append(f)

    def addReferencedTrove(self, name, version, flavor, mkUrl=None):
        if self.included == IncludedTroves:
            self.included = IncludedTroves()

        self.included.append(name=name,
                             version=version,
                             flavor=flavor,
                             mkUrl=mkUrl)

    def addClonedFrom(self, name, version, flavor, mkUrl=None):
        if self.clonedfrom == ClonedFrom:
            self.clonedfrom = ClonedFrom()

        self.clonedfrom.append(name=name,
                               version=version,
                               flavor=flavor,
                               mkUrl=mkUrl)

    def setBuildLog(self, host, fileId):
        self.buildlog = BuildLog(fileId,
                                 host,
                                 mkUrl=self._mkUrl,
                                 thisHost=self._thisHost)

    def setXMLBuildLog(self, host, fileId):
        self.xmlbuildlog = BuildLog(fileId,
                                    host,
                                    mkUrl=self._mkUrl,
                                    thisHost=self._thisHost)
Beispiel #13
0
class CharacterDeviceFile(_DeviceFile):
    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='chardevice')
Beispiel #14
0
class BlockDeviceFile(_DeviceFile):
    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='blockdevice')
Beispiel #15
0
class SymlinkFile(FileObj):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='symlink')
    target = str
Beispiel #16
0
class NamedPipe(FileObj):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='namedpipe')
Beispiel #17
0
class Socket(FileObj):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='socket')
Beispiel #18
0
class Directory(FileObj):

    _xobj = xobj.XObjMetadata(attributes={'id': str}, tag='directory')
Beispiel #19
0
class Content(BaseObject):

    _xobj = xobj.XObjMetadata(attributes={'href': str})
Beispiel #20
0
class FileId(xobj.XObj):

    _xobj = xobj.XObjMetadata(attributes={'href': str})