]> git.ipfire.org Git - pbs.git/commitdiff
sources: Only check out those files that we need
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Aug 2023 11:18:22 +0000 (11:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Aug 2023 11:18:22 +0000 (11:18 +0000)
Since the entire build service is very heavy on I/O, we should avoid
writing files that we don't need.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/sources.py

index b31c59a4661e0f706869311ec48d0989fb9b0236..ac96b3d5b842df8eeaa0a1476091c1b622f24533 100644 (file)
@@ -809,7 +809,7 @@ class Job(base.DataObject):
                try:
                        # Create a new temporary directory and check out the requested revision
                        async with self.backend.tempdir() as path:
-                               await self.source.git.checkout(self.commit.revision, path)
+                               await self.source.git.checkout(self.commit.revision, path, self.name)
 
                                # Create a path for the source packages
                                target = os.path.join(path, ".target")
@@ -1036,7 +1036,7 @@ class Git(object):
 
                return files
 
-       async def checkout(self, revision, path):
+       async def checkout(self, revision, destination, path=None):
                """
                        Creates a working directory at the revision in path
                """
@@ -1044,8 +1044,8 @@ class Git(object):
 
                await self.command(
                        # Set the destination path as work tree
-                       "--work-tree", path,
+                       "--work-tree", destination,
 
                        # Perform a checkout of the specified revision
-                       "checkout", revision, ".",
+                       "checkout", revision, path or ".",
                )