From: Michael Tremer Date: Sat, 26 Aug 2023 11:18:22 +0000 (+0000) Subject: sources: Only check out those files that we need X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6d0db26992e99f77584980f8bfcd512f8c8faa7;p=pbs.git sources: Only check out those files that we need 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 --- diff --git a/src/buildservice/sources.py b/src/buildservice/sources.py index b31c59a4..ac96b3d5 100644 --- a/src/buildservice/sources.py +++ b/src/buildservice/sources.py @@ -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 ".", )