]> git.ipfire.org Git - pbs.git/commitdiff
packages: Store all packages as read-only
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Mar 2023 16:22:06 +0000 (16:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Mar 2023 16:22:06 +0000 (16:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/__init__.py
src/buildservice/packages.py

index b8d0f6ffc39452a0773320fb83a6e6fd8a31d01f..9a750af271b8a5fe9747df56c7d39cd0cc2f9a06 100644 (file)
@@ -291,7 +291,7 @@ class Backend(object):
                        "kinit", "-k", "-t", keytab, principal, **kwargs,
                )
 
-       async def copy(self, src, dst):
+       async def copy(self, src, dst, mode=None):
                """
                        Copies a file from src to dst
                """
@@ -303,6 +303,10 @@ class Backend(object):
                # Copy data without any metadata
                await asyncio.to_thread(shutil.copyfile, src, dst)
 
+               # Set mode
+               if mode:
+                       await asyncio.to_thread(os.chmod, dst, mode)
+
        async def make_parent_directory(self, path):
                """
                        Creates the parent directory of path
index 322b83e67f43d7ccc28eca5757b2575e96d564c8..ad139d274484979e97d7d3038b6dbb1baba60f82 100644 (file)
@@ -405,7 +405,7 @@ class Package(base.DataObject):
                log.debug("Importing %s to %s..." % (self, path))
 
                # Copy the file
-               await self.backend.copy(archive.path, path)
+               await self.backend.copy(archive.path, path, mode=0o444)
 
                # Store the path
                self._set_attribute("path", path)