Esempio n. 1
0
    def _do_step(self, step):
        if step in BuildSteps.FETCH:
            # No, really, let's not download a million times...
            stepfunc = getattr(list(self._recipes.values())[0], step)
            stepfunc()
            return

        # For the universal build we need to configure both architectures with
        # with the same final prefix, but we want to install each architecture
        # on a different path (eg: /path/to/prefix/x86).

        archs_prefix = list(self._recipes.keys())

        for arch, recipe in self._recipes.items():
            config = self._config.arch_config[arch]
            config.do_setup_env()
            stepfunc = getattr(recipe, step)

            # Create a stamp file to list installed files based on the
            # modification time of this file
            if step in [BuildSteps.INSTALL[1], BuildSteps.POST_INSTALL[1]]:
                time.sleep(2)  #wait 2 seconds to make sure new files get the
                #proper time difference, this fixes an issue of
                #the next recipe to be built listing the previous
                #recipe files as their own
                tmp = tempfile.NamedTemporaryFile()
                # the modification time resolution depends on the filesystem,
                # where FAT32 has a resolution of 2 seconds and ext4 1 second
                t = time.time() - 2
                os.utime(tmp.name, (t, t))

            # Call the step function
            stepfunc()

            # Move installed files to the architecture prefix
            if step in [BuildSteps.INSTALL[1], BuildSteps.POST_INSTALL[1]]:
                installed_files = shell.find_newer_files(
                    self._config.prefix, tmp.name, True)
                tmp.close()
                for f in installed_files:

                    def not_in_prefix(src):
                        for p in archs_prefix + ['Libraries']:
                            if src.startswith(p):
                                return True
                        return False

                    # skip files that are installed in the arch prefix
                    if not_in_prefix(f):
                        continue
                    src = os.path.join(self._config.prefix, f)

                    dest = os.path.join(self._config.prefix,
                                        recipe.config.target_arch, f)
                    if not os.path.exists(os.path.dirname(dest)):
                        os.makedirs(os.path.dirname(dest))
                    shutil.move(src, dest)
Esempio n. 2
0
    def _do_step(self, step):
        if step in BuildSteps.FETCH:
            # No, really, let's not download a million times...
            stepfunc = getattr(self._recipes.values()[0], step)
            stepfunc()
            return

        # For the universal build we need to configure both architectures with
        # with the same final prefix, but we want to install each architecture
        # on a different path (eg: /path/to/prefix/x86).

        archs_prefix = self._recipes.keys()

        for arch, recipe in self._recipes.iteritems():
            config = self._config.arch_config[arch]
            config.do_setup_env()
            stepfunc = getattr(recipe, step)

            # Create a stamp file to list installed files based on the
            # modification time of this file
            if step in [BuildSteps.INSTALL[1], BuildSteps.POST_INSTALL[1]]:
                time.sleep(2) #wait 2 seconds to make sure new files get the
                              #proper time difference, this fixes an issue of
                              #the next recipe to be built listing the previous
                              #recipe files as their own
                tmp = tempfile.NamedTemporaryFile()
                # the modification time resolution depends on the filesystem,
                # where FAT32 has a resolution of 2 seconds and ext4 1 second
                t = time.time() - 2
                os.utime(tmp.name, (t, t))

            # Call the step function
            stepfunc()

            # Move installed files to the architecture prefix
            if step in [BuildSteps.INSTALL[1], BuildSteps.POST_INSTALL[1]]:
                installed_files = shell.find_newer_files(self._config.prefix,
                                                         tmp.name, True)
                tmp.close()
                for f in installed_files:

                    def not_in_prefix(src):
                        for p in archs_prefix + ['Libraries']:
                            if src.startswith(p):
                                return True
                        return False

                    # skip files that are installed in the arch prefix
                    if not_in_prefix(f):
                        continue
                    src = os.path.join(self._config.prefix, f)

                    dest = os.path.join(self._config.prefix,
                                        recipe.config.target_arch, f)
                    if not os.path.exists(os.path.dirname(dest)):
                        os.makedirs(os.path.dirname(dest))
                    shutil.move(src, dest)
Esempio n. 3
0
    def _do_step(self, step):
        # For the universal build we need to configure both architectures with
        # with the same final prefix, but we want to install each architecture
        # on a different path (eg: /path/to/prefix/x86).

        archs_prefix = [
            os.path.join(self._config.prefix, a) for a in self._recipes.keys()
        ]

        for arch, recipe in self._recipes.iteritems():
            config = self._config.arch_config[arch]
            config.do_setup_env()
            stepfunc = getattr(recipe, step)

            # Create a stamp file to list installed files based on the
            # modification time of this file
            if step in [BuildSteps.INSTALL[1], BuildSteps.POST_INSTALL[1]]:
                tmp = tempfile.NamedTemporaryFile()
                # the modification time resolution depends on the filesystem,
                # where FAT32 has a resolution of 2 seconds and ext4 1 second
                t = time.time() - 2
                os.utime(tmp.name, (t, t))

            # Call the step function
            stepfunc()

            # Move installed files to the architecture prefix
            if step in [BuildSteps.INSTALL[1], BuildSteps.POST_INSTALL[1]]:
                installed_files = shell.find_newer_files(
                    self._config.prefix, tmp.name, True)
                for f in installed_files:

                    def not_in_prefix(src):
                        for p in archs_prefix + ['Libraries']:
                            if src.startswith(p):
                                return True
                        return False

                    # skip files that are installed in the arch prefix
                    if not_in_prefix(f):
                        continue
                    src = os.path.join(self._config.prefix, f)

                    dest = os.path.join(self._config.prefix,
                                        recipe.config.target_arch, f)
                    if not os.path.exists(os.path.dirname(dest)):
                        os.makedirs(os.path.dirname(dest))
                    shutil.move(src, dest)
Esempio n. 4
0
    def _print_missing_files(self, recipe, tmp):
        recipe_files = set(recipe.files_list())
        installed_files = set(shell.find_newer_files(recipe.config.prefix,
                                                     tmp.name))
        not_in_recipe = list(installed_files - recipe_files)
        not_installed = list(recipe_files - installed_files)

        if len(not_in_recipe) != 0:
            m.message(_("The following files where installed, but are not "
                        "listed in the recipe:"))
            m.message('\n'.join(sorted(not_in_recipe)))

        if len(not_installed) != 0:
            m.message(_("The following files are listed in the recipe, but "
                        "where not installed:"))
            m.message('\n'.join(sorted(not_installed)))
Esempio n. 5
0
    def _print_missing_files(self, recipe, tmp):
        recipe_files = set(recipe.files_list())
        installed_files = set(shell.find_newer_files(recipe.config.prefix,
                                                     tmp.name))
        not_in_recipe = list(installed_files - recipe_files)
        not_installed = list(recipe_files - installed_files)

        if len(not_in_recipe) != 0:
            m.message(_("The following files were installed, but are not "
                        "listed in the recipe:"))
            m.message('\n'.join(sorted(not_in_recipe)))

        if len(not_installed) != 0:
            m.message(_("The following files are listed in the recipe, but "
                        "were not installed:"))
            m.message('\n'.join(sorted(not_installed)))