summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2012-04-19 20:59:38 +0200
committerAndoni Morales Alastruey <ylatuya@gmail.com>2012-04-20 12:22:38 +0200
commitacfbb39f7250b7bb00ad17340e09a3e6b94d1c8a (patch)
treec1af8fa0cc5aa73889ff14db98f35c9a6ac1bb41 /test
parent9525d11fabe9cbfc2752acb23ee9bda2460c599c (diff)
Move tests to the 'test' folder
Diffstat (limited to 'test')
-rw-r--r--test/__init__.py17
-rw-r--r--test/pkgconfig/glib-2.0.pc15
-rw-r--r--test/pkgconfig/gmodule-2.0.pc14
-rw-r--r--test/pkgconfig/gmodule-no-export-2.0.pc14
-rw-r--r--test/pkgconfig/gobject-2.0.pc12
-rw-r--r--test/pkgconfig/gstreamer-0.10.pc17
-rw-r--r--test/pkgconfig/gthread-2.0.pc11
-rw-r--r--test/pkgconfig/libxml-2.0.pc13
-rw-r--r--test/test_build_common.py136
-rw-r--r--test/test_cerbero_build_filesprovider.py116
-rw-r--r--test/test_cerbero_build_recipe.py115
-rw-r--r--test/test_cerbero_ide_pkgconfig.py75
-rw-r--r--test/test_cerbero_ide_xcode_xcconfig.py59
-rw-r--r--test/test_cerbero_packages_disttarball.py70
-rw-r--r--test/test_cerbero_packages_package.py148
-rw-r--r--test/test_cerbero_packages_packagemaker.py98
-rw-r--r--test/test_cerbero_packages_packagesstore.py128
-rw-r--r--test/test_cerbero_packages_pmdoc.py267
-rw-r--r--test/test_cerbero_packages_wix.py175
-rw-r--r--test/test_common.py55
-rw-r--r--test/test_packages_common.py113
21 files changed, 1668 insertions, 0 deletions
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 00000000..f58e249c
--- /dev/null
+++ b/test/__init__.py
@@ -0,0 +1,17 @@
+# 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.
diff --git a/test/pkgconfig/glib-2.0.pc b/test/pkgconfig/glib-2.0.pc
new file mode 100644
index 00000000..a99ab6b9
--- /dev/null
+++ b/test/pkgconfig/glib-2.0.pc
@@ -0,0 +1,15 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+glib_genmarshal=glib-genmarshal
+gobject_query=gobject-query
+glib_mkenums=glib-mkenums
+
+Name: GLib
+Description: C Utility Library
+Version: 2.30.0
+Libs: -L${libdir} -lglib-2.0
+Libs.private: -lrt
+Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
diff --git a/test/pkgconfig/gmodule-2.0.pc b/test/pkgconfig/gmodule-2.0.pc
new file mode 100644
index 00000000..08648ac1
--- /dev/null
+++ b/test/pkgconfig/gmodule-2.0.pc
@@ -0,0 +1,14 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+gmodule_supported=true
+
+Name: GModule
+Description: Dynamic module loader for GLib
+Requires: glib-2.0
+Version: 2.30.0
+Libs: -L${libdir} -Wl,--export-dynamic -lgmodule-2.0 -pthread -lrt
+Libs.private: -ldl
+Cflags: -pthread
diff --git a/test/pkgconfig/gmodule-no-export-2.0.pc b/test/pkgconfig/gmodule-no-export-2.0.pc
new file mode 100644
index 00000000..fef7a39b
--- /dev/null
+++ b/test/pkgconfig/gmodule-no-export-2.0.pc
@@ -0,0 +1,14 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+gmodule_supported=true
+
+Name: GModule
+Description: Dynamic module loader for GLib
+Requires: glib-2.0
+Version: 2.30.0
+Libs: -L${libdir} -lgmodule-2.0 -pthread -lrt
+Libs.private: -ldl
+Cflags: -pthread
diff --git a/test/pkgconfig/gobject-2.0.pc b/test/pkgconfig/gobject-2.0.pc
new file mode 100644
index 00000000..47981d93
--- /dev/null
+++ b/test/pkgconfig/gobject-2.0.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: GObject
+Description: GLib Type, Object, Parameter and Signal Library
+Requires: glib-2.0,gthread-2.0
+Version: 2.30.0
+Libs: -L${libdir} -lgobject-2.0
+Libs.private: -lffi
+Cflags:
diff --git a/test/pkgconfig/gstreamer-0.10.pc b/test/pkgconfig/gstreamer-0.10.pc
new file mode 100644
index 00000000..c4da2204
--- /dev/null
+++ b/test/pkgconfig/gstreamer-0.10.pc
@@ -0,0 +1,17 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include/gstreamer-0.10
+toolsdir=${exec_prefix}/bin
+pluginsdir=${exec_prefix}/lib/gstreamer-0.10
+datarootdir=${prefix}/share
+datadir=${datarootdir}
+girdir=${datadir}/gir-1.0
+typelibdir=${libdir}/girepository-1.0
+
+Name: GStreamer
+Description: Streaming media framework
+Requires: glib-2.0 >= 2.0, gobject-2.0, gmodule-no-export-2.0, gthread-2.0, libxml-2.0
+Version: 0.10.35
+Libs: -L${libdir} -lgstreamer-0.10
+Cflags: -I${includedir}
diff --git a/test/pkgconfig/gthread-2.0.pc b/test/pkgconfig/gthread-2.0.pc
new file mode 100644
index 00000000..4acc9a7c
--- /dev/null
+++ b/test/pkgconfig/gthread-2.0.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: GThread
+Description: Thread support for GLib
+Requires: glib-2.0
+Version: 2.30.0
+Libs: -L${libdir} -lgthread-2.0 -pthread -lrt
+Cflags: -pthread
diff --git a/test/pkgconfig/libxml-2.0.pc b/test/pkgconfig/libxml-2.0.pc
new file mode 100644
index 00000000..8588686f
--- /dev/null
+++ b/test/pkgconfig/libxml-2.0.pc
@@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+modules=1
+
+Name: libXML
+Version: 2.7.8
+Description: libXML library version2.
+Requires:
+Libs: -L${libdir} -lxml2
+Libs.private: -lz -lm
+Cflags: -I${includedir}/libxml2
diff --git a/test/test_build_common.py b/test/test_build_common.py
new file mode 100644
index 00000000..e2cfa608
--- /dev/null
+++ b/test/test_build_common.py
@@ -0,0 +1,136 @@
+# 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.
+
+import os
+
+from cerbero.config import Platform
+from cerbero.build.cookbook import CookBook
+from cerbero.build import recipe
+from cerbero.utils import shell
+
+
+class Recipe1(recipe.Recipe):
+
+ name = 'recipe1'
+ licence = 'LGPL'
+ uuid = '1'
+
+ files_misc = ['README', 'libexec/gstreamer-0.10/pluginsloader%(bext)s']
+ platform_files_misc = {
+ Platform.WINDOWS: ['windows'],
+ Platform.LINUX: ['linux']}
+
+ files_bins = ['gst-launch']
+ platform_files_bins = {
+ Platform.WINDOWS: ['windows'],
+ Platform.LINUX: ['linux']}
+
+ files_libs = ['libgstreamer-0.10']
+ platform_files_libs = {
+ Platform.WINDOWS: ['libgstreamer-win32'],
+ Platform.LINUX: ['libgstreamer-x11']}
+
+
+class Recipe2(recipe.Recipe):
+
+ name = 'recipe2'
+ licence = 'GPL'
+
+ files_misc = ['README2']
+
+
+class Recipe3(recipe.Recipe):
+
+ name = 'recipe3'
+ licences = 'BSD'
+
+ files_misc = ['README3']
+
+
+class Recipe4(recipe.Recipe):
+
+ name = 'recipe4'
+ licence = 'LGPL'
+
+ files_misc = ['README4']
+
+
+class Recipe5(recipe.Recipe):
+
+ name = 'recipe5'
+ licence = 'LGPL'
+
+ files_libs = ['libtest']
+
+
+def add_files(tmp):
+ bindir = os.path.join(tmp, 'bin')
+ libdir = os.path.join(tmp, 'lib')
+ gstlibdir = os.path.join(tmp, 'libexec', 'gstreamer-0.10')
+ os.makedirs(bindir)
+ os.makedirs(libdir)
+ os.makedirs(gstlibdir)
+ shell.call('touch '
+ 'windows '
+ 'linux '
+ 'README '
+ 'README2 '
+ 'README3 '
+ 'README4 '
+ 'bin/gst-launch.exe '
+ 'bin/gst-launch '
+ 'bin/windows.exe '
+ 'bin/linux '
+ 'bin/libgstreamer-0.10.dll '
+ 'bin/libgstreamer-win32.dll '
+ 'bin/libtest.dll '
+ 'lib/libtest.so.1 '
+ 'lib/libtest.la '
+ 'lib/libtest.a '
+ 'lib/libtest.so '
+ 'lib/libtest.dll.a '
+ 'lib/libtest.def '
+ 'lib/test.lib '
+ 'lib/libgstreamer-0.10.so.1 '
+ 'lib/libgstreamer-0.10.la '
+ 'lib/libgstreamer-0.10.a '
+ 'lib/libgstreamer-0.10.so '
+ 'lib/libgstreamer-0.10.dll.a '
+ 'lib/gstreamer-0.10.lib '
+ 'lib/libgstreamer-0.10.def '
+ 'lib/libgstreamer-win32.la '
+ 'lib/libgstreamer-win32.a '
+ 'lib/libgstreamer-win32.so '
+ 'lib/libgstreamer-win32.dll.a '
+ 'lib/gstreamer-win32.lib '
+ 'lib/libgstreamer-win32.def '
+ 'lib/libgstreamer-x11.so.1 '
+ 'lib/libgstreamer-x11.so '
+ 'lib/libgstreamer-x11.a '
+ 'lib/libgstreamer-x11.la '
+ 'libexec/gstreamer-0.10/pluginsloader '
+ 'libexec/gstreamer-0.10/pluginsloader.exe ',
+ tmp)
+
+
+def create_cookbook(config):
+ cb = CookBook(config, False)
+
+ for klass in [Recipe1, Recipe2, Recipe3, Recipe4, Recipe5]:
+ cb.add_recipe(klass(config))
+ return cb
diff --git a/test/test_cerbero_build_filesprovider.py b/test/test_cerbero_build_filesprovider.py
new file mode 100644
index 00000000..2c908939
--- /dev/null
+++ b/test/test_cerbero_build_filesprovider.py
@@ -0,0 +1,116 @@
+# 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.
+
+import shutil
+import unittest
+import tempfile
+
+from cerbero.build import filesprovider
+from cerbero.config import Platform
+from test.test_build_common import add_files
+from test.test_common import DummyConfig
+
+
+class Config(DummyConfig):
+
+ def __init__(self, tmp, platform):
+ self.prefix = tmp
+ self.target_platform = platform
+
+
+class FilesProvider(filesprovider.FilesProvider):
+
+ files_misc = ['README', 'libexec/gstreamer-0.10/pluginsloader%(bext)s']
+ files_libs = ['libgstreamer-0.10']
+ files_bins = ['gst-launch']
+ files_devel = ['include/gstreamer.h']
+ platform_files_bins = {
+ Platform.WINDOWS: ['windows'],
+ Platform.LINUX: ['linux']}
+ platform_files_libs = {
+ Platform.WINDOWS: ['libgstreamer-win32'],
+ Platform.LINUX: ['libgstreamer-x11']}
+
+
+class PackageTest(unittest.TestCase):
+
+ def setUp(self):
+ self.tmp = tempfile.mkdtemp()
+ win32config = Config(self.tmp, Platform.WINDOWS)
+ linuxconfig = Config(self.tmp, Platform.LINUX)
+ self.win32recipe = FilesProvider(win32config)
+ self.linuxrecipe = FilesProvider(linuxconfig)
+
+ self.winbin = ['bin/gst-launch.exe', 'bin/windows.exe']
+ self.linuxbin = ['bin/gst-launch', 'bin/linux']
+ self.winlib = ['bin/libgstreamer-0.10.dll', 'bin/libgstreamer-win32.dll']
+ self.linuxlib = ['lib/libgstreamer-0.10.so.1', 'lib/libgstreamer-x11.so.1']
+ self.winmisc = ['README', 'libexec/gstreamer-0.10/pluginsloader.exe']
+ self.linuxmisc = ['README', 'libexec/gstreamer-0.10/pluginsloader']
+ devfiles = ['include/gstreamer.h', 'lib/libgstreamer-0.10.a',
+ 'lib/libgstreamer-0.10.la']
+
+ self.windevfiles = devfiles + ['lib/libgstreamer-win32.a',
+ 'lib/libgstreamer-win32.la', 'lib/libgstreamer-win32.dll.a',
+ 'lib/libgstreamer-win32.def', 'lib/gstreamer-win32.lib',
+ 'lib/libgstreamer-0.10.dll.a', 'lib/libgstreamer-0.10.def',
+ 'lib/gstreamer-0.10.lib']
+ self.lindevfiles = devfiles + ['lib/libgstreamer-0.10.so',
+ 'lib/libgstreamer-x11.a', 'lib/libgstreamer-x11.la',
+ 'lib/libgstreamer-x11.so']
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def testFilesCategories(self):
+ self.assertEquals(sorted(['bins', 'libs', 'misc', 'devel']),
+ self.win32recipe._files_categories())
+
+ def testListBinaries(self):
+ self.assertEquals(self.win32recipe.files_list_by_category('bins'),
+ sorted(self.winbin))
+ self.assertEquals(self.linuxrecipe.files_list_by_category('bins'),
+ sorted(self.linuxbin))
+
+ def testListLibraries(self):
+ add_files(self.tmp)
+ self.assertEquals(self.win32recipe.files_list_by_category('libs'),
+ sorted(self.winlib))
+ self.assertEquals(self.linuxrecipe.files_list_by_category('libs'),
+ sorted(self.linuxlib))
+
+ def testDevelFiles(self):
+ add_files(self.tmp)
+ self.assertEquals(self.win32recipe.devel_files_list(),
+ sorted(self.windevfiles))
+ self.assertEquals(self.linuxrecipe.devel_files_list(),
+ sorted(self.lindevfiles))
+
+ def testDistFiles(self):
+ win32files = self.winlib + self.winbin + self.winmisc
+ linuxfiles = self.linuxlib + self.linuxbin + self.linuxmisc
+ add_files(self.tmp)
+ self.assertEquals(self.win32recipe.dist_files_list(), sorted(win32files))
+ self.assertEquals(self.linuxrecipe.dist_files_list(), sorted(linuxfiles))
+
+ def testGetAllFiles(self):
+ win32files = self.winlib + self.winbin + self.winmisc + self.windevfiles
+ linuxfiles = self.linuxlib + self.linuxbin + self.linuxmisc + self.lindevfiles
+ add_files(self.tmp)
+ self.assertEquals(self.win32recipe.files_list(), sorted(win32files))
+ self.assertEquals(self.linuxrecipe.files_list(), sorted(linuxfiles))
diff --git a/test/test_cerbero_build_recipe.py b/test/test_cerbero_build_recipe.py
new file mode 100644
index 00000000..73c518d7
--- /dev/null
+++ b/test/test_cerbero_build_recipe.py
@@ -0,0 +1,115 @@
+# 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.
+
+import unittest
+import os
+
+from cerbero.build import recipe
+from cerbero.config import Platform
+from test.test_common import DummyConfig
+
+
+class Class1(object):
+
+ test = None
+
+ def __init__(self):
+ self.test = 'CODEPASS'
+
+ class1_method = lambda x: None
+ compile = lambda x: 'CODEPASS'
+
+
+class Class2(object):
+
+ class2_method = lambda x: None
+ fetch = lambda x: 'CODEPASS'
+
+
+class RecipeTest(recipe.Recipe):
+
+ btype = Class1
+ stype = Class2
+
+ name = 'recipe'
+ version = '0.0.0'
+ deps = ['dep1', 'dep2']
+ platform_deps = {Platform.LINUX: ['dep3'], Platform.WINDOWS: ['dep4']}
+ post_install = lambda x: 'CODEPASS'
+
+
+class TestReceiptMetaClass(unittest.TestCase):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ self.config.local_sources = ''
+ self.config.sources = ''
+ self.t = RecipeTest(self.config)
+
+ def testReceiptBases(self):
+ r = recipe.Recipe(self.config)
+ bases = r.__class__.mro()
+ self.assertTrue(Class1 not in bases)
+ self.assertTrue(Class2 not in bases)
+
+ def testReceiptSubclassBases(self):
+ bases = self.t.__class__.mro()
+ self.assertTrue(Class1 in bases)
+ self.assertTrue(Class2 in bases)
+
+ def testFunctions(self):
+ self.assertTrue(hasattr(self.t, 'class1_method'))
+ self.assertTrue(hasattr(self.t, 'class2_method'))
+ self.assertEquals(self.t.fetch(), 'CODEPASS')
+ self.assertEquals(self.t.compile(), 'CODEPASS')
+ self.assertEquals(self.t.post_install(), 'CODEPASS')
+
+ def testSubclassesInit(self):
+ self.assertEquals(self.t.test, 'CODEPASS')
+
+
+class TestReceipt(unittest.TestCase):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ self.config.local_sources = 'path1'
+ self.config.sources = 'path2'
+ self.recipe = RecipeTest(self.config)
+
+ def testSources(self):
+ repo_dir = os.path.join(self.config.local_sources, self.recipe.package_name)
+ repo_dir = os.path.abspath(repo_dir)
+ build_dir = os.path.join(self.config.sources, self.recipe.package_name)
+ build_dir = os.path.abspath(build_dir)
+
+ self.assertEquals(self.recipe.repo_dir, repo_dir)
+ self.assertEquals(self.recipe.build_dir, build_dir)
+
+ def testListDeps(self):
+ self.recipe.config.target_platform = Platform.LINUX
+ self.assertEquals(['dep1', 'dep2', 'dep3'], self.recipe.list_deps())
+ self.recipe.config.target_platform = Platform.WINDOWS
+ self.assertEquals(['dep1', 'dep2', 'dep4'], self.recipe.list_deps())
+
+ def testRemoveSteps(self):
+ self.recipe._remove_steps(['donotexits'])
+ self.assertTrue(recipe.BuildSteps.FETCH in self.recipe._steps)
+ self.recipe._remove_steps([recipe.BuildSteps.FETCH])
+ self.assertTrue(recipe.BuildSteps.FETCH not in self.recipe._steps)
+ r = RecipeTest(self.config)
+ self.assertTrue(recipe.BuildSteps.FETCH in r._steps)
diff --git a/test/test_cerbero_ide_pkgconfig.py b/test/test_cerbero_ide_pkgconfig.py
new file mode 100644
index 00000000..4827efd7
--- /dev/null
+++ b/test/test_cerbero_ide_pkgconfig.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# 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.
+
+import unittest
+import os
+
+from cerbero.ide.pkgconfig import PkgConfig
+
+
+class TestPkgConfig(unittest.TestCase):
+
+ def setUp(self):
+ pc_path = os.path.join(os.path.dirname(__file__), 'pkgconfig')
+ os.environ['PKG_CONFIG_LIBDIR'] = pc_path
+ os.environ['PKG_CONFIG_PATH'] = pc_path
+ self.pkgconfig = PkgConfig('gstreamer-0.10')
+ self.pkgconfig2 = PkgConfig('gstreamer-0.10', False)
+
+ def testListAll(self):
+ expected = ['gobject-2.0', 'gmodule-2.0', 'libxml-2.0', 'gthread-2.0',
+ 'glib-2.0', 'gmodule-no-export-2.0', 'gstreamer-0.10']
+ self.assertEquals(sorted(PkgConfig.list_all()), sorted(expected))
+
+ def testIncludeDirs(self):
+ expected = ['/usr/include/gstreamer-0.10', '/usr/include/glib-2.0',
+ '/usr/lib/glib-2.0/include',
+ '/usr/include/libxml2']
+ self.assertEquals(self.pkgconfig.include_dirs(), expected)
+ expected = ['/usr/include/gstreamer-0.10']
+ self.assertEquals(self.pkgconfig2.include_dirs(), expected)
+
+ def testCFlags(self):
+ expected = ['-pthread']
+ self.assertEquals(self.pkgconfig.cflags(), expected)
+ expected = []
+ self.assertEquals(self.pkgconfig2.cflags(), expected)
+
+ def testLibrariesDir(self):
+ expected = []
+ self.assertEquals(self.pkgconfig.libraries_dirs(), expected)
+ expected = []
+ self.assertEquals(self.pkgconfig2.libraries_dirs(), expected)
+
+ def testLibraries(self):
+ expected = ['gstreamer-0.10', 'gobject-2.0', 'gmodule-2.0', 'xml2',
+ 'gthread-2.0', 'rt', 'glib-2.0']
+ self.assertEquals(self.pkgconfig.libraries(), expected)
+ expected = ['gstreamer-0.10']
+ self.assertEquals(self.pkgconfig2.libraries(), expected)
+
+ def testRequires(self):
+ expected = ['glib-2.0', 'gobject-2.0', 'gmodule-no-export-2.0',
+ 'gthread-2.0', 'libxml-2.0']
+ self.assertEquals(self.pkgconfig.requires(), expected)
+ self.assertEquals(self.pkgconfig2.requires(), expected)
+
+ def testPrefix(self):
+ self.assertEquals(self.pkgconfig.prefix(), '/usr')
+ self.assertEquals(self.pkgconfig2.prefix(), '/usr')
diff --git a/test/test_cerbero_ide_xcode_xcconfig.py b/test/test_cerbero_ide_xcode_xcconfig.py
new file mode 100644
index 00000000..87c76d94
--- /dev/null
+++ b/test/test_cerbero_ide_xcode_xcconfig.py
@@ -0,0 +1,59 @@
+# 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.
+
+import unittest
+import os
+import tempfile
+
+from cerbero.ide.xcode.xcconfig import XCConfig
+
+
+XCCONFIG = '''
+ALWAYS_SEARCH_USER_PATHS = YES
+USER_HEADER_SEARCH_PATHS = /usr/include/gstreamer-0.10\
+ /usr/include/glib-2.0 /usr/lib/glib-2.0/include\
+ /usr/include/libxml2
+LIBRARY_SEARCH_PATHS =
+OTHER_LDFLAGS = -lgstreamer-0.10 \
+-lgobject-2.0 -lgmodule-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0
+'''
+
+class TestPkgConfig(unittest.TestCase):
+
+ def setUp(self):
+ pc_path = os.path.join(os.path.dirname(__file__), 'pkgconfig')
+ os.environ['PKG_CONFIG_LIBDIR'] = pc_path
+ os.environ['PKG_CONFIG_PATH'] = pc_path
+
+ def testFill(self):
+ xcconfig = XCConfig('gstreamer-0.10')
+ expected = \
+ {'libs': ' -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 '
+ '-lxml2 -lgthread-2.0 -lrt -lglib-2.0',
+ 'hsp': '/usr/include/gstreamer-0.10 /usr/include/glib-2.0 '
+ '/usr/lib/glib-2.0/include '
+ '/usr/include/libxml2',
+ 'lsp': ''}
+ self.assertEquals(expected, xcconfig._fill())
+
+ def testXCConfig(self):
+ tmp = tempfile.NamedTemporaryFile()
+ xcconfig = XCConfig('gstreamer-0.10')
+ xcconfig.create(tmp.name)
+ with open(tmp.name, 'r') as f:
+ self.assertEquals(f.read(), XCCONFIG)
diff --git a/test/test_cerbero_packages_disttarball.py b/test/test_cerbero_packages_disttarball.py
new file mode 100644
index 00000000..b7427a2d
--- /dev/null
+++ b/test/test_cerbero_packages_disttarball.py
@@ -0,0 +1,70 @@
+# 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.
+
+import unittest
+import shutil
+import tarfile
+import tempfile
+
+from cerbero.packages.disttarball import DistTarball
+from test.test_packages_common import create_store
+from test.test_common import DummyConfig
+from test.test_build_common import add_files
+
+
+class DistTarballTest(unittest.TestCase):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ self.tmp = tempfile.mkdtemp()
+ self.config.prefix = self.tmp
+ self.store = create_store(self.config)
+ self.package = self.store.get_package('gstreamer-runtime')
+ self.packager = DistTarball(self.config, self.package, self.store)
+ add_files(self.tmp)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def testRuntimePackage(self):
+ # Creates one package with the runtime files
+ filenames = self.packager.pack(self.tmp, devel=False)
+ self.assertEquals(len(filenames), 1)
+ tar = tarfile.open(filenames[0], "r:bz2")
+ tarfiles = sorted([x.path for x in tar.getmembers()])
+ self.assertEquals(tarfiles, self.package.files_list())
+
+ def testRuntimeAndDevelPackages(self):
+ # Creates 2 packages, one with the runtime files a second one with the
+ # devel files
+ filenames = self.packager.pack(self.tmp, devel=True)
+ self.assertEquals(len(filenames), 2)
+ tar = tarfile.open(filenames[0], "r:bz2")
+ tarfiles = sorted([x.path for x in tar.getmembers()])
+ self.assertEquals(tarfiles, self.package.files_list())
+ tar = tarfile.open(filenames[1], "r:bz2")
+ tarfiles = sorted([x.path for x in tar.getmembers()])
+ self.assertEquals(tarfiles, self.package.devel_files_list())
+
+ def testRuntimeWithDevelPackage(self):
+ # Creates 1 package, with the runtime files and the devel files
+ filenames = self.packager.pack(self.tmp, devel=True, split=False)
+ self.assertEquals(len(filenames), 1)
+ tar = tarfile.open(filenames[0], "r:bz2")
+ tarfiles = sorted([x.path for x in tar.getmembers()])
+ self.assertEquals(tarfiles, self.package.all_files_list())
diff --git a/test/test_cerbero_packages_package.py b/test/test_cerbero_packages_package.py
new file mode 100644
index 00000000..78353330
--- /dev/null
+++ b/test/test_cerbero_packages_package.py
@@ -0,0 +1,148 @@
+# 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.
+
+import shutil
+import unittest
+import tempfile
+
+from cerbero.config import Platform, Distro, DistroVersion
+from test.test_packages_common import Package1, Package4, MetaPackage
+from test.test_build_common import create_cookbook, add_files
+from test.test_packages_common import create_store
+from test.test_common import DummyConfig
+
+
+class Config(DummyConfig):
+
+ def __init__(self, tmp, platform):
+ self.prefix = tmp
+ self.target_platform = platform
+
+
+class PackageTest(unittest.TestCase):
+
+ def setUp(self):
+ self.tmp = tempfile.mkdtemp()
+ win32config = Config(self.tmp, Platform.WINDOWS)
+ linuxconfig = Config(self.tmp, Platform.LINUX)
+ self.win32package = Package1(win32config, create_cookbook(win32config))
+ self.linuxpackage = Package1(linuxconfig, create_cookbook(linuxconfig))
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def testParseFiles(self):
+ self.assertEquals(self.win32package._recipes_files['recipe1'],
+ ['misc', 'libs', 'bins'])
+ self.assertEquals(self.win32package._recipes_files['recipe5'], ['libs'])
+
+ def testListRecipesDeps(self):
+ self.assertEquals(self.win32package.recipes_dependencies(),
+ ['recipe1', 'recipe5'])
+ self.assertEquals(self.linuxpackage.recipes_dependencies(),
+ ['recipe1'])
+
+ def testFilesList(self):
+ add_files(self.tmp)
+ winfiles = ['README', 'bin/gst-launch.exe', 'bin/libgstreamer-win32.dll',
+ 'bin/libgstreamer-0.10.dll', 'bin/windows.exe',
+ 'libexec/gstreamer-0.10/pluginsloader.exe',
+ 'windows', 'bin/libtest.dll']
+ linuxfiles = ['README', 'bin/gst-launch', 'bin/linux',
+ 'lib/libgstreamer-x11.so.1', 'lib/libgstreamer-0.10.so.1',
+ 'libexec/gstreamer-0.10/pluginsloader', 'linux']
+
+ self.assertEquals(sorted(winfiles),
+ sorted(self.win32package.files_list()))
+ self.assertEquals(sorted(linuxfiles),
+ sorted(self.linuxpackage.files_list()))
+
+ def testDevelFilesList(self):
+ add_files(self.tmp)
+ devfiles = ['lib/libgstreamer-0.10.a', 'lib/libgstreamer-0.10.la']
+ linuxdevfiles = devfiles + ['lib/libgstreamer-0.10.so',
+ 'lib/libgstreamer-x11.a', 'lib/libgstreamer-x11.la',
+ 'lib/libgstreamer-x11.so']
+ windevfiles = devfiles + ['lib/libgstreamer-win32.a',
+ 'lib/libgstreamer-win32.dll.a', 'lib/libgstreamer-win32.la',
+ 'lib/libgstreamer-win32.def', 'lib/gstreamer-win32.lib',
+ 'lib/libtest.a', 'lib/libtest.dll.a', 'lib/libtest.la',
+ 'lib/libtest.def', 'lib/test.lib', 'lib/libgstreamer-0.10.dll.a',
+ 'lib/libgstreamer-0.10.def', 'lib/gstreamer-0.10.lib']
+
+ self.assertEquals(sorted(windevfiles), self.win32package.devel_files_list())
+ self.assertEquals(sorted(linuxdevfiles), self.linuxpackage.devel_files_list())
+
+ def testSystemDependencies(self):
+ config = Config(self.tmp, Platform.LINUX)
+ config.target_distro = Distro.DEBIAN
+ package = Package4(config, None)
+ self.assertEquals(package.get_sys_deps(), ['python'])
+ config.target_distro = Distro.REDHAT
+ config.target_distro_version = DistroVersion.FEDORA_16
+ package = Package4(config, None)
+ self.assertEquals(package.get_sys_deps(), ['python27'])
+
+
+
+
+class TestMetaPackages(unittest.TestCase):
+
+ def setUp(self):
+ self.tmp = tempfile.mkdtemp()
+ config = Config(self.tmp, Platform.LINUX)
+ self.store = create_store(config)
+ self.package = MetaPackage(config, self.store)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def _compareList(self, func_name):
+ list_func = getattr(self.package, func_name)
+ packages = [self.store.get_package(x) for x in \
+ self.package.list_packages()]
+ files = []
+ for package in packages:
+ list_func = getattr(package, func_name)
+ files.extend(list_func())
+
+ list_func = getattr(self.package, func_name)
+ self.assertEquals(sorted(files), list_func())
+
+ def testListPackages(self):
+ expected = ['gstreamer-test1', 'gstreamer-test3',
+ 'gstreamer-test-bindings', 'gstreamer-test2']
+ self.assertEquals(self.package.list_packages(), expected)
+
+ def testPlatfromPackages(self):
+ packages_attr = object.__getattribute__(self.package, 'packages')
+ self.assertEquals(len(packages_attr), 3)
+ platform_packages_attr = object.__getattribute__(self.package,
+ 'platform_packages')
+ self.assertEquals(len(platform_packages_attr), 1)
+ self.assertEquals(len(self.package.packages),
+ len(packages_attr) + len(platform_packages_attr))
+
+ def testFilesList(self):
+ self._compareList('files_list')
+
+ def testDevelFilesList(self):
+ self._compareList('devel_files_list')
+
+ def testAllFilesList(self):
+ self._compareList('all_files_list')
diff --git a/test/test_cerbero_packages_packagemaker.py b/test/test_cerbero_packages_packagemaker.py
new file mode 100644
index 00000000..3266f515
--- /dev/null
+++ b/test/test_cerbero_packages_packagemaker.py
@@ -0,0 +1,98 @@
+# 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.
+
+import os
+import shutil
+import unittest
+import tempfile
+
+from cerbero.config import Platform
+from cerbero.packages import PackageType
+from cerbero.packages.packagemaker import OSXPackage, PackageMaker
+from cerbero.utils import shell
+from test.test_packages_common import create_store
+from test.test_common import DummyConfig
+
+
+class PackageMakerTest(unittest.TestCase):
+
+ def setUp(self):
+ self.tmp = tempfile.mkdtemp()
+ self.config = DummyConfig()
+ self.config.prefix = self.tmp
+ self.config.target_platform = Platform.LINUX
+ self.store = create_store(self.config)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def testCreateBundle(self):
+ self._add_files()
+ p = self.store.get_package('gstreamer-test1')
+ self.files = p.files_list()
+ packager = OSXPackage(self.config, p, self.store)
+ files = OSXPackage.files_list(packager, PackageType.RUNTIME, False)
+ tmpdest = packager._create_bundle(files)
+ bundlefiles = shell.check_call('find . -type f ', tmpdest).split('\n')
+ bundlefiles = sorted([f[2:] for f in bundlefiles])[1:]
+ self.assertEquals(bundlefiles, self.files)
+ shutil.rmtree(tmpdest)
+
+ def _add_files(self):
+ bindir = os.path.join(self.tmp, 'bin')
+ libdir = os.path.join(self.tmp, 'lib')
+ os.makedirs(bindir)
+ os.makedirs(libdir)
+ os.makedirs(os.path.join(self.tmp, 'libexec', 'gstreamer-0.10'))
+ shell.call('touch '
+ 'README '
+ 'linux '
+ 'libexec/gstreamer-0.10/pluginsloader '
+ 'bin/gst-launch '
+ 'bin/linux '
+ 'lib/libgstreamer-0.10.so.1 '
+ 'lib/libgstreamer-x11.so.1 '
+ 'lib/notincluded1 '
+ 'notincluded2 ', self.tmp)
+
+
+class DummyPackageMaker(PackageMaker):
+
+ def _execute(self, cmd):
+ self.cmd = cmd
+
+
+class TestPackageMaker(unittest.TestCase):
+
+
+ def testFillArgs(self):
+ pm = PackageMaker()
+ args = {'r': 'root', 'i': 'pkg_id', 'n': 'version', 't': 'title',
+ 'l': 'destination', 'o': 'output_file'}
+ cmd = pm._cmd_with_args(args)
+ self.assertEquals(cmd,
+ "./PackageMaker -i 'pkg_id' -l 'destination' -o 'output_file' "
+ "-n 'version' -r 'root' -t 'title'")
+
+ def testCreatePackage(self):
+ pm = DummyPackageMaker()
+ pm.create_package('root', 'pkg_id', 'version', 'title',
+ 'output_file', 'destination')
+ self.assertEquals(pm.cmd,
+ "./PackageMaker -i 'pkg_id' -l 'destination' -o 'output_file' "
+ "-n 'version' -r 'root' -t 'title'")
diff --git a/test/test_cerbero_packages_packagesstore.py b/test/test_cerbero_packages_packagesstore.py
new file mode 100644
index 00000000..accd99ee
--- /dev/null
+++ b/test/test_cerbero_packages_packagesstore.py
@@ -0,0 +1,128 @@
+# 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.
+
+import unittest
+import tempfile
+
+from cerbero.config import Platform
+from cerbero.errors import PackageNotFoundError
+from cerbero.packages.package import Package, MetaPackage
+from cerbero.packages.packagesstore import PackagesStore
+from test import test_packages_common as common
+
+
+PACKAGE = '''
+class Package(package.Package):
+
+ name = 'test-package'
+
+ def test_imports(self):
+ Platform.WINDOWS
+ Distro.WINDOWS
+ DistroVersion.WINDOWS_7
+ Architecture.X86
+'''
+
+METAPACKAGE = '''
+class MetaPackage(package.MetaPackage):
+
+ name = 'test-package'
+'''
+
+
+class PackageTest(unittest.TestCase):
+
+ def setUp(self):
+ self.config = common.DummyConfig()
+ self.config.packages_dir = '/test'
+ self.config.target_platform = Platform.LINUX
+ self.store = PackagesStore(self.config, False)
+
+ def testAddPackage(self):
+ package = common.Package1(self.config, None)
+ self.assertEquals(len(self.store._packages), 0)
+ self.store.add_package(package)
+ self.assertEquals(len(self.store._packages), 1)
+ self.assertEquals(package, self.store._packages[package.name])
+
+ def testGetPackage(self):
+ package = common.Package1(self.config, None)
+ self.store.add_package(package)
+ self.assertEquals(package, self.store.get_package(package.name))
+
+ def testPackageNotFound(self):
+ self.failUnlessRaises(PackageNotFoundError, self.store.get_package,
+ 'unknown')
+
+ def testPackagesList(self):
+ package = common.Package1(self.config, None)
+ metapackage = common.MetaPackage(self.config, None)
+ self.store.add_package(package)
+ self.store.add_package(metapackage)
+ l = sorted([package, metapackage], key=lambda x: x.name)
+ self.assertEquals(l, self.store.get_packages_list())
+
+ def testPackageDeps(self):
+ package = common.Package1(self.config, None)
+ package2 = common.Package2(self.config, None)
+ self.store.add_package(package)
+ self.store.add_package(package2)
+ self.assertEquals(package.deps,
+ [x.name for x in self.store.get_package_deps(package.name)])
+
+ def testMetaPackageDeps(self):
+ metapackage = common.MetaPackage(self.config, None)
+ self.store.add_package(metapackage)
+ # the metapackage depends on package that are not yet in the store
+ self.failUnlessRaises(PackageNotFoundError,
+ self.store.get_package_deps, metapackage.name)
+ for klass in [common.Package1, common.Package2, common.Package3,
+ common.Package4, common.MetaPackage]:
+ p = klass(self.config, None)
+ self.store.add_package(p)
+ deps = ['gstreamer-test-bindings', 'gstreamer-test1',
+ 'gstreamer-test2', 'gstreamer-test3']
+ self.assertEquals(deps,
+ [x.name for x in self.store.get_package_deps(metapackage.name)])
+
+ def testLoadPackageFromFile(self):
+ package_file = tempfile.NamedTemporaryFile()
+ package_file.write(PACKAGE)
+ package_file.flush()
+ p = self.store._load_package_from_file(package_file.name)
+ self.assertIsInstance(p, Package)
+ self.assertEquals('test-package', p.name)
+
+ def testLoadMetaPackageFromFile(self):
+ package_file = tempfile.NamedTemporaryFile()
+ package_file.write(METAPACKAGE)
+ package_file.flush()
+ p = self.store._load_package_from_file(package_file.name)
+ self.assertIsInstance(p, MetaPackage)
+ self.assertEquals('test-package', p.name)
+
+ def testImports(self):
+ package_file = tempfile.NamedTemporaryFile()
+ package_file.write(PACKAGE)
+ package_file.flush()
+ p = self.store._load_package_from_file(package_file.name)
+ self.assertIsInstance(p, Package)
+ try:
+ p.test_imports()
+ except ImportError, e:
+ self.fail("Import error raised, %s", e)
diff --git a/test/test_cerbero_packages_pmdoc.py b/test/test_cerbero_packages_pmdoc.py
new file mode 100644
index 00000000..2bebdc82
--- /dev/null
+++ b/test/test_cerbero_packages_pmdoc.py
@@ -0,0 +1,267 @@
+# 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.
+
+import os
+import unittest
+import tempfile
+import shutil
+import sys
+
+from cerbero.config import Platform
+from cerbero.packages import PackageType
+from cerbero.packages.pmdoc import Index, PkgRef, PkgContents, PMDoc
+from cerbero.utils import shell
+from test.test_packages_common import create_store, Package1
+from test.test_common import XMLMixin, DummyConfig
+
+
+class IndexTest(unittest.TestCase, XMLMixin):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ self.store = create_store(self.config)
+ self.package = self.store.get_package('gstreamer-runtime')
+ self.outdir = '/test'
+ self.index = Index(self.package, self.store, self.outdir, [],
+ PackageType.RUNTIME, False)
+
+ def testAddRoot(self):
+ self.index._add_root()
+ self.assertEquals(self.index.root.tag, Index.DOCUMENT_TAG)
+ self.assertEquals(self.index.root.attrib['spec'], Index.SPEC_VERSION)
+ self.assertEquals(len(self.index.root.getchildren()), 0)
+
+ def testAddProperties(self):
+ self.index._add_root()
+ self.index._add_properties()
+ children = self.index.root.getchildren()
+ self.assertEquals(len(children), 1)
+ properties = children[0]
+ self.assertEquals(len(properties.getchildren()), 6)
+ self.check_text(properties, Index.TAG_ORGANIZATION, self.package.org)
+ self.check_text(properties, Index.TAG_TITLE, self.package.title)
+ self.check_text(properties, Index.TAG_BUILD,
+ os.path.join(self.outdir, '%s.pkg' % self.package.name))
+ self.check_attrib(properties, Index.TAG_USER_SEES, 'ui',
+ Index.PROP_USER_SEES)
+ self.check_attrib(properties, Index.TAG_MIN_TARGET, 'os',
+ Index.PROP_MIN_TARGET)
+ self.check_attrib(properties, Index.TAG_DOMAIN, 'system',
+ Index.PROP_DOMAIN)
+
+ def testAddDistribution(self):
+ self.index._add_root()
+ self.index._add_distribution()
+ children = self.index.root.getchildren()
+ self.assertEquals(len(children), 1)
+ dist =children[0]
+ self.find_one(dist, Index.TAG_SCRIPTS)
+ self.check_attrib(dist, Index.TAG_VERSION, Index.ATTR_MIN_SPEC,
+ Index.MIN_SPEC)
+
+ def testAddDescription(self):
+ self.index._add_root()
+ self.index._add_description()
+ self.check_text(self.index.root, Index.TAG_DESCRIPTION,
+ self.package.shortdesc)
+
+ def testAddFlags(self):
+ self.index._add_root()
+ self.index._add_flags()
+ self.find_one(self.index.root, Index.TAG_FLAGS)
+
+ def testAddContents(self):
+ self.index._add_root()
+ self.index._add_contents()
+ children = self.index.root.getchildren()
+ # 1 choice + 4 item
+ self.assertEquals(len(children), 5)
+ contents = self.find_one(self.index.root, Index.TAG_CONTENTS)
+ packages =[]
+
+ for choice in contents.iterfind(Index.TAG_CHOICE):
+ if choice.attrib['id'] == 'gstreamer-test1':
+ # Should have 2 package ref because it has a dependency in
+ # gstreamer-test2
+ pkrefs = ['gstreamer-test1', 'gstreamer-test2']
+ elif choice.attrib['id'] == 'gstreamer-test3':
+ pkrefs = ['gstreamer-test3']
+ elif choice.attrib['id'] == 'gstreamer-test-bindings':
+ pkrefs = ['gstreamer-test-bindings']
+ else:
+ self.fail("Incorrect choice %s" % choice)
+ elpkrefs = [x.attrib['id'] for x in \
+ choice.iterfind(Index.TAG_PKGREF)]
+ self.assertEquals(sorted(pkrefs), sorted(elpkrefs))
+ packages.extend(pkrefs)
+
+ items = [x.text[:-4] for x in self.index.root.iterfind(Index.TAG_ITEM) if
+ x.attrib['type']=='pkgref']
+ self.assertEquals(sorted(packages), sorted(items))
+
+
+class PkgRefTest(unittest.TestCase, XMLMixin):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ self.config.target_platform = Platform.LINUX
+ self.package = Package1(self.config, None)
+ self.package_path = '/test/package.pkg'
+ self.pkgref = PkgRef(self.package, PackageType.RUNTIME, self.package_path)
+
+ def testAddRoot(self):
+ self.pkgref._add_root()
+ self.assertEquals(self.pkgref.root.tag, PkgRef.TAG_PKGREF)
+ self.assertEquals(self.pkgref.root.attrib['spec'], PkgRef.SPEC_VERSION)
+ self.assertEquals(self.pkgref.root.attrib['uuid'], self.package.uuid)
+ self.assertEquals(len(self.pkgref.root.getchildren()), 0)
+
+ def testAddScripts(self):
+ self.pkgref._add_root()
+ self.pkgref._add_scripts()
+ scripts = self.find_one(self.pkgref.root, PkgRef.TAG_SCRIPTS)
+ self.check_text(scripts, PkgRef.TAG_SCRIPTS_DIR,
+ os.path.join(self.package_path, 'Contents', 'Resources'))
+
+ def testAddExtra(self):
+ self.pkgref._add_root()
+ self.pkgref._add_extra()
+ extra = self.find_one(self.pkgref.root, PkgRef.TAG_EXTRA)
+ self.check_text(extra, PkgRef.TAG_PACKAGE_PATH, self.package_path)
+ self.check_text(extra, PkgRef.TAG_TITLE, self.package.shortdesc)
+
+ def testAddContents(self):
+ self.pkgref._add_root()
+ self.pkgref._add_contents()
+ contents = self.find_one(self.pkgref.root, PkgRef.TAG_CONTENTS)
+ self.check_text(contents, PkgRef.TAG_FILE_LIST, '%s-contents.xml' %
+ self.package.name)
+
+ def testAddConfig(self):
+ self.pkgref._add_root()
+ self.pkgref._add_config()
+ config = self.find_one(self.pkgref.root, PkgRef.TAG_CONFIG)
+ self.check_text(config, PkgRef.TAG_IDENTIFIER, self.package.name)
+ self.check_text(config, PkgRef.TAG_VERSION, self.package.version)
+ self.check_text(config, PkgRef.TAG_DESCRIPTION, self.package.shortdesc)
+ self.check_attrib(config, PkgRef.TAG_POST_INSTALL, 'type', 'none')
+ self.check_attrib(config, PkgRef.TAG_INSTALL_TO, 'relative', 'true')
+ self.check_attrib(config, PkgRef.TAG_INSTALL_TO, 'mod', 'true')
+ self.check_text(config, PkgRef.TAG_INSTALL_TO, '.')
+ self.find_one(config, PkgRef.TAG_REQ_AUTH)
+ mods = ['installTo.isAbsoluteType', 'installTo.path',
+ 'parent', 'installTo.isRelativeType', 'installTo']
+ docmods = [x.text for x in config.iterfind(PkgRef.TAG_MOD)]
+ self.assertEquals(sorted(mods), sorted(docmods))
+ flags = self.find_one(config, PkgRef.TAG_FLAGS)
+ self.find_one(flags, PkgRef.TAG_FOLLOW_SYMLINKS)
+
+
+
+class PkgContentsWrap(PkgContents):
+
+ dirs = ['.', './bin', './lib', './lib/gstreamer-0.10', '']
+ files = ['./bin/gst-inspect', './lib/libgstreamer.so.1.0',
+ './lib/gstreamer-0.10/libgstplugin.so', './README', '']
+
+ def _list_bom_dirs(self):
+ return '\n'.join(self.dirs)
+
+ def _list_bom_files(self):
+ paths = self.dirs + self.files
+ return '\n'.join(['%s\t00000' % f for f in paths])
+
+
+class PkgContentsTest(unittest.TestCase, XMLMixin):
+
+ def setUp(self):
+ self.tmp = tempfile.mkdtemp()
+ self.pkgcontents = PkgContentsWrap(self.tmp)
+ os.makedirs(os.path.join(self.tmp, 'bin'))
+ os.makedirs(os.path.join(self.tmp, 'lib/gstreamer-0.10'))
+ shell.call('touch %s' % ' '.join(PkgContentsWrap.files), self.tmp)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def testAddRoot(self):
+ self.pkgcontents._add_root()
+ self.assertEquals(self.pkgcontents.root.tag,
+ PkgContents.TAG_PKG_CONTENTS)
+ self.assertEquals(self.pkgcontents.root.attrib['spec'], PkgContents.SPEC_VERSION)
+ self.assertEquals(len(self.pkgcontents.root.getchildren()), 0)
+
+ def testAddPackageRoot(self):
+ self.pkgcontents._add_root()
+ self.pkgcontents._add_package_root()
+ for k, v in [('n', 'PackageRoot'), ('o', PkgContents.OWNER),
+ ('g', PkgContents.GROUP), ('pt', '.'), ('m', 'true'),
+ ('t', 'bom')]:
+ self.check_attrib(self.pkgcontents.root, PkgContents.TAG_F, k, v)
+
+ def testFill(self):
+ self.pkgcontents._fill()
+ children = [x for x in self.pkgcontents.proot.getchildren()
+ if x.tag == PkgContents.TAG_F]
+ children_path = [x.attrib['n'] for x in children]
+ self.assertEquals(sorted(children_path), sorted(['bin', 'lib', 'README']))
+ for c in children:
+ if c.attrib['n'] == 'bin':
+ self.check_attrib(c, PkgContents.TAG_F, 'n', 'gst-inspect')
+ elif c.attrib['n'] == 'lib':
+ for c in c.getchildren():
+ if c.attrib['n'] == 'gstreamer-0.10':
+ self.check_attrib(c, PkgContents.TAG_F, 'n',
+ 'libgstplugin.so')
+ else:
+ self.assertEquals(c.attrib['n'], 'libgstreamer.so.1.0')
+ else:
+ self.assertEquals(c.attrib['n'], 'README')
+
+class TestPMDoc(unittest.TestCase):
+
+ #if not sys.platform.startswith('darwin'):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ self.store = create_store(self.config)
+ self.tmp = tempfile.mkdtemp()
+ self.package = self.store.get_package('gstreamer-runtime')
+ self.packages_path = os.path.join(self.tmp, 'test.pkg')
+ os.mkdir(self.packages_path)
+ shell.call('touch %s file1 file2 file3', self.packages_path)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ @unittest.skipUnless(sys.platform.startswith("darwin"), "requires OSX")
+ def testAllFilesCreated(self):
+ d = dict()
+ packages = ['gstreamer-test1', 'gstreamer-test3',
+ 'gstreamer-test-bindings', 'gstreamer-test2']
+ for name in packages:
+ d[name] =self.packages_path
+ pmdoc = PMDoc(self.package, self.store, self.tmp, d)
+ path = pmdoc.create()
+ files = os.listdir(path)
+
+ expected_files = ['index.xml']
+ for p in packages:
+ expected_files.append("%s.xml" % p)
+ expected_files.append("%s-contents.xml" % p)
+ self.assertEquals(sorted(files), sorted(expected_files))
diff --git a/test/test_cerbero_packages_wix.py b/test/test_cerbero_packages_wix.py
new file mode 100644
index 00000000..2bcd3323
--- /dev/null
+++ b/test/test_cerbero_packages_wix.py
@@ -0,0 +1,175 @@
+# 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.
+
+import unittest
+
+from cerbero.build import recipe
+from cerbero.config import Platform
+from cerbero.packages import package
+from cerbero.packages.wix import MergeModule
+from cerbero.utils import etree
+from test.test_build_common import create_cookbook
+from test.test_common import DummyConfig
+
+
+class Recipe1(recipe.Recipe):
+ name = 'recipe-test'
+ files_misc = ['bin/test.exe', 'bin/test2.exe', 'bin/test3.exe',
+ 'README', 'lib/libfoo.dll', 'lib/gstreamer-0.10/libgstplugins.dll']
+
+
+class Package(package.Package):
+
+ name = 'gstreamer-test'
+ shortdesc = 'GStreamer Test'
+ longdesc = 'test'
+ version = '1.0'
+ licences = ['LGPL']
+ uuid = '1'
+ vendor = 'GStreamer Project'
+ files = ['recipe-test:misc']
+
+
+MERGE_MODULE = \
+'''<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><Module Id="gstreamer_test" Language="1033" Version="1.0"><Package Comments="test" Description="GStreamer Test" Id="1" Manufacturer="GStreamer Project" /><Directory Id="TARGETDIR" Name="SourceDir"><Component Guid="1" Id="README"><File Id="_test_README" Name="README" Source="/test/README" /></Component><Directory Id="bin" Name="bin"><Component Guid="1" Id="bin_test.exe"><File Id="_test_bin_testexe" Name="test.exe" Source="/test/bin/test.exe" /></Component><Component Guid="1" Id="bin_test2.exe"><File Id="_test_bin_test2exe" Name="test2.exe" Source="/test/bin/test2.exe" /></Component><Component Guid="1" Id="bin_test3.exe"><File Id="_test_bin_test3exe" Name="test3.exe" Source="/test/bin/test3.exe" /></Component></Directory><Directory Id="lib" Name="lib"><Directory Id="lib_gstreamer_0.10" Name="lib_gstreamer_0.10"><Component Guid="1" Id="lib_gstreamer_0.10_libgstplugins.dll"><File Id="_test_lib_gstreamer_010_libgstpluginsdll" Name="libgstplugins.dll" Source="/test/lib/gstreamer-0.10/libgstplugins.dll" /></Component></Directory><Component Guid="1" Id="lib_libfoo.dll"><File Id="_test_lib_libfoodll" Name="libfoo.dll" Source="/test/lib/libfoo.dll" /></Component></Directory></Directory></Module></Wix>'''
+
+class MergeModuleTest(unittest.TestCase):
+
+ def setUp(self):
+ self.config = DummyConfig()
+ cb = create_cookbook(self.config)
+ cb.add_recipe(Recipe1(self.config))
+ self.package = Package(self.config, cb)
+
+ def test_add_root(self):
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._add_root()
+ self.assertEquals(
+ '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" />',
+ etree.tostring(mergemodule.root))
+
+ def test_add_module(self):
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._add_root()
+ mergemodule._add_module()
+ self.assertEquals(
+ '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">'
+ '<Module Id="gstreamer_test" Language="1033" Version="1.0" />'
+ '</Wix>', etree.tostring(mergemodule.root))
+
+ def test_add_package(self):
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._add_root()
+ mergemodule._add_module()
+ mergemodule._add_package()
+ self.assertEquals(
+ '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">'
+ '<Module Id="gstreamer_test" Language="1033" Version="1.0">'
+ '<Package Comments="test" Description="GStreamer Test" Id="1" '
+ 'Manufacturer="GStreamer Project" />'
+ '</Module>'
+ '</Wix>', etree.tostring(mergemodule.root))
+
+ def test_add_root_dir(self):
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._add_root()
+ mergemodule._add_module()
+ mergemodule._add_package()
+ mergemodule._add_root_dir()
+ self.assertEquals(
+ '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">'
+ '<Module Id="gstreamer_test" Language="1033" Version="1.0">'
+ '<Package Comments="test" Description="GStreamer Test" Id="1" '
+ 'Manufacturer="GStreamer Project" />'
+ '<Directory Id="TARGETDIR" Name="SourceDir" />'
+ '</Module>'
+ '</Wix>', etree.tostring(mergemodule.root))
+
+ def test_add_directory(self):
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._add_root()
+ mergemodule._add_module()
+ mergemodule._add_package()
+ mergemodule._add_root_dir()
+ self.assertEquals(len(mergemodule._dirnodes), 1)
+ self.assertEquals(mergemodule._dirnodes[''], mergemodule.rdir)
+ mergemodule._add_directory('lib/gstreamer-0.10')
+ self.assertEquals(len(mergemodule._dirnodes), 3)
+ self.assertTrue('lib' in mergemodule._dirnodes)
+ self.assertTrue('lib/gstreamer-0.10' in mergemodule._dirnodes)
+ mergemodule._add_directory('bin')
+ self.assertEquals(len(mergemodule._dirnodes), 4)
+ self.assertTrue('bin' in mergemodule._dirnodes)
+
+ def test_add_file(self):
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._add_root()
+ mergemodule._add_module()
+ mergemodule._add_package()
+ mergemodule._add_root_dir()
+ self.assertEquals(len(mergemodule._dirnodes), 1)
+ self.assertEquals(mergemodule._dirnodes[''], mergemodule.rdir)
+ mergemodule._add_file('bin/gst-inspect-0.10.exe')
+ self.assertEquals(len(mergemodule._dirnodes), 2)
+ self.assertTrue('bin' in mergemodule._dirnodes)
+ self.assertTrue('gstreamer-0.10.exe' not in mergemodule._dirnodes)
+ mergemodule._add_file('bin/gst-launch-0.10.exe')
+ self.assertEquals(len(mergemodule._dirnodes), 2)
+ self.assertTrue('bin' in mergemodule._dirnodes)
+ self.assertTrue('gstreamer-0.10.exe' not in mergemodule._dirnodes)
+
+ def test_render_xml(self):
+ self.config.platform = Platform.WINDOWS
+ mergemodule = MergeModule(self.config, self.package, None)
+ mergemodule._get_uuid = lambda : '1'
+ mergemodule.fill()
+ self.assertEquals(MERGE_MODULE, mergemodule.render_xml())
+
+
+class InstallerTest(unittest.TestCase):
+
+
+ def setUp(self):
+ pass
+
+ def testAddRoot(self):
+ pass
+
+ def testAddProduct(self):
+ pass
+
+ def testAddPackage(self):
+ pass
+
+ def testAddInstallDir(self):
+ pass
+
+ def testAddUIProps(self):
+ pass
+
+ def testAddMedia(self):
+ pass
+
+ def testAddMergeModules(self):
+ pass
+
+ def testAddMergeModules(self):
+ pass
+
+ def testRender(self):
+ pass
diff --git a/test/test_common.py b/test/test_common.py
new file mode 100644
index 00000000..2932be06
--- /dev/null
+++ b/test/test_common.py
@@ -0,0 +1,55 @@
+# 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
+
+
+class DummyConfig(object):
+ prefix = '/test/'
+ target_platform = Platform.WINDOWS
+ platform = None
+ sources = ''
+ local_sources = ''
+ wix_prefix = ''
+ py_prefix= ''
+ git_root = ''
+ allow_parallel_build = False
+ num_of_cpus = 1
+ target_version = None
+ target_distro_version = None
+ packages_prefix = ''
+
+
+class XMLMixin():
+
+ def find_one(self, el, tag):
+ children = list(el.iterfind(tag))
+ if len(children) == 0:
+ self.fail("Element with tag %s not found in parent %s" % (tag, el))
+ return children[0]
+
+ def check_attrib(self, parent, tag, attrib, value):
+ n = self.find_one(parent, tag)
+ if attrib not in n.attrib:
+ self.fail("Attribute %s not found in %s" % (attrib, n))
+ self.assertEquals(n.attrib[attrib], value)
+
+ def check_text(self, parent, tag, value):
+ n = self.find_one(parent, tag)
+ self.assertEquals(n.text, value)
+
diff --git a/test/test_packages_common.py b/test/test_packages_common.py
new file mode 100644
index 00000000..4b338c98
--- /dev/null
+++ b/test/test_packages_common.py
@@ -0,0 +1,113 @@
+# 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 DummyConfig(object):
+ pass
+
+
+def create_store(config):
+ cookbook = create_cookbook(config)
+ store = PackagesStore(config, False)
+
+ for klass in [Package1, Package2, Package3, Package4]:
+ package = klass(config, cookbook)
+ store.add_package(package)
+ for klass in [MetaPackage]:
+ package = klass(config, store)
+ store.add_package(package)
+ return store