def _load_recipes_from_dir(self, repo, skip_errors): recipes = {} recipes_files = shell.find_files('*%s' % self.RECIPE_EXT, repo) recipes_files.extend(shell.find_files('*/*%s' % self.RECIPE_EXT, repo)) custom = None # If a manifest is being used or if recipes_commits is defined, disable # usage of tarballs when tagged for release. We need to do this before # `custom.py` is loaded, so we can't set it on the module afterwards. # We need to set it on the parent class. if self._config.manifest or self._config.recipes_commits: crecipe.Recipe._using_manifest_force_git = True m_path = os.path.join(repo, 'custom.py') if os.path.exists(m_path): custom = imp.load_source('custom', m_path) for f in recipes_files: # Try to load recipes with the custom.py module located in the # recipes dir which can contain private classes and methods with # common code for gstreamer recipes. try: recipes_from_file = self._load_recipes_from_file( f, skip_errors, custom) except RecipeNotFoundError: m.warning(_("Could not found a valid recipe in %s") % f) if recipes_from_file is None: continue for recipe in recipes_from_file: recipes[recipe.name] = recipe return recipes
def _load_packages_from_dir(self, repo): packages_dict = {} packages = shell.find_files('*%s' % self.PKG_EXT, repo) packages.extend(shell.find_files('*/*%s' % self.PKG_EXT, repo)) for f in packages: p = self._load_package_from_file(f) if p is None: m.warning(_("Could not found a valid package in %s") % f) continue packages_dict[p.name] = p return packages_dict
def _load_packages_from_dir(self, repo): packages_dict = {} packages = shell.find_files('*%s' % self.PKG_EXT, repo) packages.extend(shell.find_files('*/*%s' % self.PKG_EXT, repo)) try: custom = None m_path = os.path.join(repo, 'custom.py') if os.path.exists(m_path): custom = imp.load_source('custom', m_path) except Exception, ex: # import traceback # traceback.print_exc() # m.warning("Error loading package %s" % ex) custom = None
def _make_paths_relative(self): sofiles = shell.find_files('*.so', self.tmp_install_dir) for sof in sofiles: try: shell.call("chrpath -d %s" % sof, self.tmp_install_dir, fail=False) except FatalError: m.warning("Could not 'chrpath' %s" % sof) shell.call("ln -s . usr", self.tmp_install_dir, fail=False) for icondir in os.listdir( os.path.join(self.tmp_install_dir, "share/icons/")): if os.path.exists(os.path.join(icondir, "index.theme")): shell.call("gtk-update-icon-cache %s" % icondir, fail=False) shell.call("update-mime-database %s" % os.path.join(self.tmp_install_dir, "share", "mime"), fail=False) shell.call("glib-compile-schemas %s/share/glib-2.0/schemas" % self.tmp_install_dir) # Use system wide applications in case the bundle needs to open apps not included in # the bundle (to show the documentation most probably) shell.call("rm -rf %s" % os.path.join(self.tmp_install_dir, "share", "applications"), fail=False) shell.call( "ln -s %s %s" % (os.path.join("/usr", "share", "applications"), os.path.join(self.tmp_install_dir, "share", "applications")), fail=False)
def _make_paths_relative(self): sofiles = shell.find_files('*.so', self.tmp_install_dir) for sof in sofiles: try: shell.call("chrpath -d %s" % sof, self.tmp_install_dir, fail=False) except FatalError: m.warning("Could not 'chrpath' %s" % sof) shell.call("ln -s . usr", self.tmp_install_dir, fail=False) # Make gd-pixbuf loader.cache file use relative paths cache = os.path.join(self.tmp_install_dir, 'lib', 'gdk-pixbuf-2.0', '2.10.0', 'loaders.cache') shell.replace(cache, {self.config.install_dir: '.'}) for icondir in os.listdir(os.path.join(self.tmp_install_dir, "share/icons/")): if os.path.exists(os.path.join(icondir, "index.theme")): shell.call("gtk-update-icon-cache %s" % icondir, fail=False) shell.call("update-mime-database %s" % os.path.join(self.tmp_install_dir, "share", "mime"), fail=False) # Use system wide applications in case the bundle needs to open apps not included in # the bundle (to show the documentation most probably) shell.call("rm -rf %s" % os.path.join(self.tmp_install_dir, "share", "applications"), fail=False) shell.call("ln -s %s %s" % (os.path.join("/usr", "share", "applications"), os.path.join(self.tmp_install_dir, "share", "applications")), fail=False)
def _load_recipes_from_dir(self, repo): recipes = {} recipes_files = shell.find_files('*%s' % self.RECIPE_EXT, repo) recipes_files.extend(shell.find_files('*/*%s' % self.RECIPE_EXT, repo)) custom = None m_path = os.path.join(repo, 'custom.py') if os.path.exists(m_path): custom = imp.load_source('custom', m_path) custom.GStreamer.using_manifest_force_git = self._config.manifest is not None for f in recipes_files: # Try to load the custom.py module located in the recipes dir # which can contain private classes to extend cerbero's recipes # and reuse them in our private repository try: recipes_from_file = self._load_recipes_from_file(f, custom) except RecipeNotFoundError: m.warning(_("Could not found a valid recipe in %s") % f) if recipes_from_file is None: continue for recipe in recipes_from_file: recipes[recipe.name] = recipe return recipes
def _load_packages_from_dir(self, repo): packages_dict = {} packages = shell.find_files('*%s' % self.PKG_EXT, repo) packages.extend(shell.find_files('*/*%s' % self.PKG_EXT, repo)) try: custom = None m_path = os.path.join(repo, 'custom.py') if os.path.exists(m_path): custom = imp.load_source('custom', m_path) except Exception as ex: # import traceback # traceback.print_exc() # m.warning("Error loading package %s" % ex) custom = None for f in packages: p = self._load_package_from_file(f, custom) if p is None: m.warning(_("Could not found a valid package in %s") % f) continue p.__file__ = os.path.abspath(f) packages_dict[p.name] = p return packages_dict
def _load_recipes_from_dir(self, repo): recipes = {} recipes_files = shell.find_files('*%s' % self.RECIPE_EXT, repo) recipes_files.extend(shell.find_files('*/*%s' % self.RECIPE_EXT, repo)) try: custom = None m_path = os.path.join(repo, 'custom.py') if os.path.exists(m_path): custom = imp.load_source('custom', m_path) except Exception: custom = None for f in recipes_files: # Try to load the custom.py module located in the recipes dir # which can contain private classes to extend cerbero's recipes # and reuse them in our private repository try: recipe = self._load_recipe_from_file(f, custom) except RecipeNotFoundError: m.warning(_("Could not found a valid recipe in %s") % f) if recipe is None: continue recipes[recipe.name] = recipe return recipes
def _make_paths_relative(self): sofiles = shell.find_files('*.so', self.tmp_install_dir) for sof in sofiles: try: shell.call("chrpath -d %s" % sof, self.tmp_install_dir, fail=False) except FatalError: m.warning("Could not 'chrpath' %s" % sof) shell.call("ln -s . usr", self.tmp_install_dir, fail=False) for icondir in os.listdir(os.path.join(self.tmp_install_dir, "share/icons/")): if os.path.exists(os.path.join(icondir, "index.theme")): shell.call("gtk-update-icon-cache %s" % icondir, fail=False) shell.call("update-mime-database %s" % os.path.join(self.tmp_install_dir, "share", "mime"), fail=False) shell.call("glib-compile-schemas %s/share/glib-2.0/schemas" % self.tmp_install_dir) # Use system wide applications in case the bundle needs to open apps not included in # the bundle (to show the documentation most probably) shell.call("rm -rf %s" % os.path.join(self.tmp_install_dir, "share", "applications"), fail=False) shell.call("ln -s %s %s" % (os.path.join("/usr", "share", "applications"), os.path.join(self.tmp_install_dir, "share", "applications")), fail=False)