summaryrefslogtreecommitdiff
path: root/test/test_packages_common.py
blob: ae9af8095ec47c7360087e79645b6d3080ef8e08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

from cerbero.config import Platform, Distro, DistroVersion
from cerbero.packages import package
from cerbero.packages.packagesstore import PackagesStore
from test.test_build_common import create_cookbook


class Package1(package.Package):
    name = 'gstreamer-test1'
    shortdesc = 'GStreamer Test'
    version = '1.0'
    licences = ['LGPL']
    uuid = '1'
    vendor = 'GStreamer Project'
    deps = ['gstreamer-test2']

    files = ['recipe1:misc:libs:bins']
    platform_files = {Platform.WINDOWS: ['recipe5:libs']}


class Package2(package.Package):
    name = 'gstreamer-test2'
    shortdesc = 'GStreamer Test 2'
    version = '1.0'
    licences = ['LGPL']
    uuid = '1'
    vendor = 'GStreamer Project'

    files = ['recipe2:misc']


class Package3(package.Package):
    name = 'gstreamer-test3'
    shortdesc = 'GStreamer Test 3'
    version = '1.0'
    licences = ['LGPL']
    uuid = '1'
    vendor = 'GStreamer Project'

    files = ['recipe3:misc']


class Package4(package.Package):
    name = 'gstreamer-test-bindings'
    shortdesc = 'GStreamer Bindings'
    version = '1.0'
    licences = ['LGPL']
    uuid = '1'
    vendor = 'GStreamer Project'
    sys_deps = {Distro.DEBIAN: ['python'], DistroVersion.FEDORA_16: ['python27']}

    files = ['recipe4:misc']


class MetaPackage(package.MetaPackage):
    name = 'gstreamer-runtime'
    shortdesc = 'GStreamer runtime'
    longdesc = 'GStreamer runtime'
    title = 'GStreamer runtime'
    url = 'http://www.gstreamer.net'
    version = '1.0'
    uuid = '3ffe67b2-4565-411f-8287-e8faa892f853'
    vendor = 'GStreamer Project'
    org = 'net.gstreamer'
    packages = [
        ('gstreamer-test1', True, True),
        ('gstreamer-test3', False, True),
        ('gstreamer-test-bindings', False, False),
    ]
    platform_packages = {Platform.LINUX: [('gstreamer-test2', False, False)]}
    icon = 'gstreamer.ico'


class App(package.App):
    name = 'gstreamer-app'
    shortdesc = 'GStreamer sample app'
    longdesc = 'GStreamer sample app'
    title = 'GStreamer sample app'
    url = 'http://www.gstreamer.net'
    version = '1.0'
    uuid = '3ffe67b2-4565-411f-8287-e8faa892f853'
    vendor = 'GStreamer Project'
    org = 'net.gstreamer'
    app_recipe = 'recipe3'
    deps = ['gstreamer-test1']
    icon = 'share/images/gstreamer.png'
    embed_deps = True


class DummyConfig(object):
    pass


def create_store(config):
    cookbook = create_cookbook(config)
    store = PackagesStore(config, False)

    for klass in [Package1, Package2, Package3, Package4, App]:
        package = klass(config, store, cookbook)
        package.__file__ = 'test/test_packages_common.py'
        store.add_package(package)
    for klass in [MetaPackage]:
        package = klass(config, store)
        package.__file__ = 'test/test_packages_common.py'
        store.add_package(package)
    return store