Ejemplo n.º 1
0
    def create(self, ebuild_path=None):
        """Write ebuild and update it after unpacking and examining ${S}"""
        # Need to write the ebuild first so we can unpack it and check for $S
        if ebuild_path:
            self.ebuild_path = ebuild_path

        if self.write(overwrite=self.options.overwrite):
            if self.unpacked_dir is None:
                PortageUtils.unpack_ebuild(self.ebuild_path)
            self.update_with_s()
            self.post_unpack()

            # Write ebuild again after unpacking and adding ${S}
            self.write(overwrite=True)

            if self.options.command != 'echo':
                # apply workflows
                Metadata(self.options, os.path.dirname(self.ebuild_path))()
                Echangelog(self.options, os.path.dirname(self.ebuild_path))()
                Repoman(self.options, os.path.dirname(self.ebuild_path))()

                log.info("Your ebuild is here: " + self.ebuild_path)

        # TODO: If ebuild already exists, we don't unpack and get dependencies
        # because they must exist.
        # We should add an option to force creating dependencies or should
        # overwrite be used?
        return self.requires