コード例 #1
0
ファイル: job.py プロジェクト: paultag/lucy
    def get_package(self):
        from lucy.models.source import Source
        from lucy.models.binary import Binary

        if self["package_type"] == "binary":
            return Binary.load(self["package"])

        if self["package_type"] == "source":
            return Source.load(self["package"])
コード例 #2
0
    def get_package(self):
        from lucy.models.source import Source
        from lucy.models.binary import Binary

        if self['package_type'] == 'binary':
            return Binary.load(self['package'])

        if self['package_type'] == 'source':
            return Source.load(self['package'])
コード例 #3
0
    def __init__(self,
                 report,
                 builder,
                 package,
                 package_type,
                 job,
                 failed,
                 source=None,
                 type=None,
                 **kwargs):

        if package_type not in ["source", "binary"]:
            raise ValueError("Bad package type")

        loaded_package = None
        if package_type == 'source':
            try:
                loaded_package = Source.load(package)
                if source is None:
                    source = loaded_package['_id']
            except KeyError:
                pass

        if package_type == 'binary':
            try:
                loaded_package = Binary.load(package)
                if source is None:
                    source = loaded_package['source']
            except KeyError:
                pass

        if loaded_package is None:
            raise KeyError("No such package")

        builder = Machine.load(builder)['_id']

        job = Job.load(job)

        if type is None:
            type = job['type']

        if source is None:
            raise ValueError("No source :(")

        super(Report, self).__init__(package_type=package_type,
                                     source=source,
                                     builder=builder,
                                     package=loaded_package['_id'],
                                     report=report,
                                     job=job['_id'],
                                     type=type,
                                     failed=failed,
                                     **kwargs)
コード例 #4
0
ファイル: job.py プロジェクト: paultag/lucy
    def __init__(
        self,
        type,
        package,
        package_type,
        arch,
        suite,
        builder=None,
        finished_at=None,
        assigned_at=None,
        source=None,
        **kwargs
    ):

        from lucy.models.source import Source
        from lucy.models.binary import Binary

        if package_type not in ["source", "binary"]:
            raise ValueError("package_type needs to be binary or source")

        if package_type == "source":
            package = Source.load(package)
            if source is None:
                source = package["_id"]

        if package_type == "binary":
            package = Binary.load(package)
            if source is None:
                source = package["source"]

        if package is None:
            raise ValueError("Bad package")

        package = package["_id"]

        if builder:
            builder = Machine.load(builder)["_id"]

        if source is None:
            raise ValueError("Bad source :(")

        super(Job, self).__init__(
            type=type,
            arch=arch,
            suite=suite,
            source=source,
            package=package,
            builder=builder,
            finished_at=finished_at,
            assigned_at=assigned_at,
            package_type=package_type,
            **kwargs
        )
コード例 #5
0
ファイル: report.py プロジェクト: paultag/lucy
    def __init__(self, report, builder, package,
                 package_type, job, failed,
                 source=None, type=None, **kwargs):

        if package_type not in ["source", "binary"]:
            raise ValueError("Bad package type")

        loaded_package = None
        if package_type == 'source':
            try:
                loaded_package = Source.load(package)
                if source is None:
                    source = loaded_package['_id']
            except KeyError:
                pass

        if package_type == 'binary':
            try:
                loaded_package = Binary.load(package)
                if source is None:
                    source = loaded_package['source']
            except KeyError:
                pass

        if loaded_package is None:
            raise KeyError("No such package")

        builder = Machine.load(builder)['_id']

        job = Job.load(job)

        if type is None:
            type = job['type']

        if source is None:
            raise ValueError("No source :(")

        super(Report, self).__init__(package_type=package_type,
                                     source=source,
                                     builder=builder,
                                     package=loaded_package['_id'],
                                     report=report,
                                     job=job['_id'],
                                     type=type,
                                     failed=failed,
                                     **kwargs)
コード例 #6
0
    def __init__(self, type, package, package_type, arch, suite,
                 builder=None, finished_at=None, assigned_at=None,
                 source=None, **kwargs):

        from lucy.models.source import Source
        from lucy.models.binary import Binary

        if package_type not in ["source", "binary"]:
            raise ValueError("package_type needs to be binary or source")

        if package_type == "source":
            package = Source.load(package)
            if source is None:
                source = package['_id']

        if package_type == "binary":
            package = Binary.load(package)
            if source is None:
                source = package['source']

        if package is None:
            raise ValueError("Bad package")

        package = package['_id']

        if builder:
            builder = Machine.load(builder)['_id']

        if source is None:
            raise ValueError("Bad source :(")

        super(Job, self).__init__(
            type=type,
            arch=arch,
            suite=suite,
            source=source,
            package=package,
            builder=builder,
            finished_at=finished_at,
            assigned_at=assigned_at,
            package_type=package_type,
            **kwargs)
コード例 #7
0
ファイル: source.py プロジェクト: paultag/lucy
 def get_binaries(self):
     from lucy.models.binary import Binary
     for x in Binary.query({"source": self['_id']}):
         yield x
コード例 #8
0
ファイル: source.py プロジェクト: paultag/lucy
 def get_binaries(self):
     from lucy.models.binary import Binary
     for x in Binary.query({"source": self['_id']}):
         yield x