Commit 4d133811 authored by Tristan Maat's avatar Tristan Maat Committed by Tristan Van Berkom
Browse files

element.py: Add _stage_sources_at

parent 74d5dde9
Loading
Loading
Loading
Loading
+17 −7
Original line number Original line Diff line number Diff line
@@ -402,7 +402,7 @@ class Element(Plugin):
                    raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))
                    raise ElementError("Command '{}' failed with exitcode {}".format(cmd, exitcode))


    def stage_sources(self, sandbox, directory):
    def stage_sources(self, sandbox, directory):
        """Stage this element's sources to a directory
        """Stage this element's sources to a directory in the sandbox


        Args:
        Args:
           sandbox (:class:`.Sandbox`): The build sandbox
           sandbox (:class:`.Sandbox`): The build sandbox
@@ -412,12 +412,7 @@ class Element(Plugin):
        sandbox_root = sandbox.get_directory()
        sandbox_root = sandbox.get_directory()
        host_directory = os.path.join(sandbox_root, directory.lstrip(os.sep))
        host_directory = os.path.join(sandbox_root, directory.lstrip(os.sep))


        with self.timed_activity("Staging sources", silent_nested=True):
        self._stage_sources_at(host_directory)
            for source in self.__sources:
                source._stage(host_directory)

        # Ensure deterministic mtime of sources at build time
        utils._set_deterministic_mtime(host_directory)


    def get_public_data(self, domain):
    def get_public_data(self, domain):
        """Fetch public data on this element
        """Fetch public data on this element
@@ -974,6 +969,21 @@ class Element(Plugin):
                                   SandboxFlags.INTERACTIVE,
                                   SandboxFlags.INTERACTIVE,
                                   env=environment)
                                   env=environment)


    # _stage_sources_at():
    #
    # Stage this element's sources to a directory
    #
    # Args:
    #     directory (str): An absolute path to stage the sources at
    #
    def _stage_sources_at(self, directory):
        with self.timed_activity("Staging sources", silent_nested=True):
            for source in self.__sources:
                source._stage(directory)

        # Ensure deterministic mtime of sources at build time
        utils._set_deterministic_mtime(directory)

    #############################################################
    #############################################################
    #                   Private Local Methods                   #
    #                   Private Local Methods                   #
    #############################################################
    #############################################################