Exemplo n.º 1
0
 async def _cook_recipe_step_with_prompt(self, recipe, step, count):
     try:
         await self._cook_recipe_step(recipe, step, count)
     except BuildStepError as be:
         if not self.interactive:
             raise be
         print()
         msg = be.msg
         msg += _("Select an action to proceed:")
         action = shell.prompt_multiple(msg, RecoveryActions())
         if action == RecoveryActions.SHELL:
             environ = recipe.get_recipe_env()
             if recipe.use_system_libs:
                 add_system_libs(recipe.config, environ, environ)
             shell.enter_build_environment(self.config.target_platform,
                                           be.arch,
                                           recipe.get_for_arch(
                                               be.arch, 'build_dir'),
                                           env=environ)
             raise be
         elif action == RecoveryActions.RETRY_ALL:
             shutil.rmtree(recipe.get_for_arch(be.arch, 'build_dir'))
             self.cookbook.reset_recipe_status(recipe.name)
             # propagate up to the task manager to retry the recipe entirely
             raise RetryRecipeError()
         elif action == RecoveryActions.RETRY_STEP:
             await self._cook_recipe_step(recipe, step, count)
         elif action == RecoveryActions.SKIP:
             # propagate up to the task manager to retry the recipe entirely
             raise SkipRecipeError()
         elif action == RecoveryActions.ABORT:
             raise AbortedError()
Exemplo n.º 2
0
    def maybe_add_system_libs(self, step=''):
        '''
        Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file
        can be found.
        '''
        # Note: this is expected to be called with the environment already
        # modified using @{async_,}modify_environment

        # don't add system libs unless explicitly asked for
        if not self.use_system_libs or not self.config.allow_system_libs:
            return

        # this only works because add_system_libs() does very little
        # this is a possible source of env conflicts
        new_env = {}
        add_system_libs(self.config, new_env, self.env)

        if step != 'configure':
            # gobject-introspection gets the paths to internal libraries all
            # wrong if we add system libraries during compile.  We should only
            # need PKG_CONFIG_PATH during configure so just unset it everywhere
            # else we will get linker errors compiling introspection binaries
            if 'PKG_CONFIG_PATH' in new_env:
                del new_env['PKG_CONFIG_PATH']
        for var, val in new_env.items():
            self.set_env(var, val, when='now-with-restore')
Exemplo n.º 3
0
 def generate_gst_la_files(self):
     '''
     Generate .la files for all libraries and plugins packaged by this Meson
     recipe using the pkg-config files installed by our Meson build files.
     '''
     pluginpcdir = os.path.join(self.config.libdir, 'gstreamer-1.0', 'pkgconfig')
     env = os.environ.copy()
     env['PKG_CONFIG_LIBDIR'] += os.pathsep + pluginpcdir
     if self.use_system_libs:
         add_system_libs(self.config, env)
     # Get la file -> pkg-config name mapping
     libs_la_files = {}
     plugin_la_files = {}
     for f in self.devel_files_list():
         if not f.endswith('.a') or not f.startswith('lib/'):
             continue
         if f.startswith('lib/gstreamer-1.0/'):
             libtype = 'plugin'
         else:
             libtype = 'library'
         fpath = os.path.join(self._get_arch_prefix(), f)
         if not os.path.isfile(fpath):
             arch = self.config.target_arch
             m.warning('{} {} {!r} not found'.format(arch, libtype, fpath))
             continue
         pcname = os.path.basename(f)[3:-2]
         la = os.path.splitext(f)[0] + '.la'
         if libtype == 'plugin':
             self._write_gst_la_file(la, pcname, None, None, None, env)
         else:
             pcname = pcname.replace('gst', 'gstreamer-')
             # Same versioning as gstreamer
             minor, micro = (map(int, self.version.split('.')[1:3]))
             minor = minor * 100 + micro
             self._write_gst_la_file(la, pcname, 0, minor, 0, env)
Exemplo n.º 4
0
 def _add_system_libs(self):
     '''
     Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file
     can be found.
     '''
     new_env = {}
     add_system_libs(self.config, new_env)
     for var, val in new_env.items():
         self.set_env(var, val)
Exemplo n.º 5
0
 def _add_system_libs(self):
     '''
     Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file
     can be found.
     '''
     new_env = {}
     add_system_libs(self.config, new_env)
     for var, val in new_env.items():
         self.set_env(var, val)
Exemplo n.º 6
0
    def run(self, config, args):
        # Load the cookbook which will parse all recipes and update config.bash_completions
        cookbook = CookBook(config)
        env = config.env.copy()
        if args.use_system_libs:
            add_system_libs(config, env, config.env)

        shell.enter_build_environment(config.target_platform,
                config.target_arch, sourcedir=None, env=env,
                bash_completions=config.bash_completions)
Exemplo n.º 7
0
 def _add_system_libs(self):
     '''
     Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file
     can be found.
     '''
     # Don't modify env again if already did it once for this function call
     if self._old_env:
         return
     new_env = {}
     add_system_libs(self.config, new_env)
     for var, val in new_env.items():
         self.set_env(var, val)
Exemplo n.º 8
0
    def run(self, config, args):
        # Load the cookbook which will parse all recipes and update config.bash_completions
        # We don't care about errors while loading recipes, which can happen
        # just because of the current configuration not matching what the
        # recipe supports
        cookbook = CookBook(config, skip_errors=True)
        env = config.env.copy()
        if args.use_system_libs:
            add_system_libs(config, env, config.env)

        shell.enter_build_environment(config.target_platform,
                config.target_arch, sourcedir=None, env=env,
                bash_completions=config.bash_completions)
Exemplo n.º 9
0
 def _add_system_libs(self, new_env):
     '''
     Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file
     can be found.
     '''
     add_system_libs(self.config, new_env)
Exemplo n.º 10
0
    def generate_gst_la_files(self):
        '''
        Generate .la files for all libraries and plugins packaged by this Meson
        recipe using the pkg-config files installed by our Meson build files.
        '''
        class GeneratedLA(object):
            name = None
            major = None
            minor = None
            micro = None
            libdir = None
            platform = None
            deps = None

            def __init__(self,
                         la_name,
                         major,
                         minor,
                         micro,
                         libdir,
                         deps=None):
                if not deps:
                    deps = []

                self.name = la_name
                self.major = major
                self.minor = minor
                self.micro = micro
                self.libdir = libdir
                self.deps = deps

            def __eq__(self, other):
                if not isinstance(other, GeneratedLA):
                    return False
                return self.name == other.name and self.libdir == other.libdir

            def __str__(self):
                return "<GeneratedLA:%s@%s version:%s.%s.%s in \'%s\' deps: [%s]" % (
                    str(self.name), str(hex(id(self))), str(self.major),
                    str(self.minor), str(self.micro), str(
                        self.libdir), ", ".join(self.deps))

        lib_to_pcname_map = {
            'gstadaptivedemux-1.0': None,
            'gstbadaudio-1.0': 'gstreamer-bad-audio-1.0',
            'gstbadvideo-1.0': 'gstreamer-bad-video-1.0',
            'gstbasecamerabinsrc-1.0': None,
            'gstisoff-1.0': None,
            'gstphotography-1.0': None,
            'gsturidownloader-1.0': None,
            'gstrtspserver-1.0': 'gstreamer-rtsp-server-1.0',
            'gstvalidate-1.0': 'gst-validate-1.0',
            'ges-1.0': 'gst-editing-services-1.0',
        }
        generated_libs = []

        pluginpcdir = os.path.join(self.config.libdir, 'gstreamer-1.0',
                                   'pkgconfig')
        env = os.environ.copy()
        env['PKG_CONFIG_LIBDIR'] += os.pathsep + pluginpcdir
        if self.use_system_libs:
            add_system_libs(self.config, env)

        # retrieve the list of files we need to generate
        for f in self.devel_files_list():
            if not f.endswith('.a') or not f.startswith('lib/'):
                continue
            if f.startswith('lib/gstreamer-1.0/'):
                libtype = 'plugin'
            else:
                libtype = 'library'
            fpath = os.path.join(self._get_arch_prefix(), f)
            if not os.path.isfile(fpath):
                arch = self.config.target_arch
                m.warning('{} {} {!r} not found'.format(arch, libtype, fpath))
                continue
            pcname = os.path.basename(f)[3:-6 if f.endswith('.dll.a') else -2]
            la_path = os.path.splitext(f)[0]
            ladir, laname = os.path.split(la_path)
            ladir = os.path.join(self._get_arch_prefix(), ladir)

            major = minor = micro = None
            if libtype == 'library':
                if pcname in lib_to_pcname_map:
                    pcname = lib_to_pcname_map[pcname]
                elif not pcname.startswith('gstreamer-'):
                    pcname = pcname.replace('gst', 'gstreamer-')

                # some libs don't have .pc files
                if not pcname:
                    continue

                minor, micro = (map(int, self.version.split('.')[1:3]))
                minor = minor * 100 + micro
                major = micro = 0

            pcpath = os.path.join(ladir, 'pkgconfig', pcname + '.pc')
            if not os.path.isfile(pcpath):
                arch = self.config.target_arch
                # XXX: make this fatal?
                m.warning('{} pkg-config file {!r} not found'.format(
                    arch, pcpath))
                continue

            deps = self._get_la_deps_from_pc(laname, pcname, env)

            generated = GeneratedLA(laname, major, minor, micro, ladir, deps)
            generated_libs.append(generated)

        # resolve dependencies so that dependant libs are generated
        # before libraries/plugins using them
        for lib in self._resolve_deps(generated_libs):
            dep_libs = []
            for dep in lib.deps:
                # check if the lib is available as an .la and use that instead
                # of -l arguments
                lafile = os.path.join(self.config.libdir, dep + '.la')
                if os.path.isfile(lafile):
                    # LibtoolLibrary prepends the libdir and appends '.la' for us
                    dep_libs.append(lafile[:-3])
                else:
                    if dep.startswith('lib'):
                        dep = dep[3:]
                    dep_libs.append('-l' + dep)

            LibtoolLibrary(lib.name,
                           lib.major,
                           lib.minor,
                           lib.micro,
                           lib.libdir,
                           self.config.target_platform,
                           deps=dep_libs).save()
Exemplo n.º 11
0
 def _add_system_libs(self, new_env):
     '''
     Add /usr/lib/pkgconfig to PKG_CONFIG_PATH so the system's .pc file
     can be found.
     '''
     add_system_libs(self.config, new_env)
Exemplo n.º 12
0
 def run(self, config, args):
     if args.use_system_libs:
         add_system_libs(config, os.environ)
     shell.enter_build_environment(config.target_platform,
                                   config.target_arch)
Exemplo n.º 13
0
 def run(self, config, args):
     if args.use_system_libs:
         add_system_libs(config, os.environ)
     shell.enter_build_environment(config.target_platform,
             config.target_arch)