]> git.decadent.org.uk Git - dak.git/commitdiff
fstransactions.py: also use mode for directories
authorAnsgar Burchardt <ansgar@debian.org>
Fri, 15 Jun 2012 13:41:47 +0000 (15:41 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sun, 1 Jul 2012 11:16:44 +0000 (13:16 +0200)
daklib/fstransactions.py

index 8fb737674fecb30a9bb4d43e3d4433543399b857..468e2859b2d5ee804714b002734c981ab1a0ff23 100644 (file)
@@ -38,10 +38,19 @@ class _FilesystemCopyAction(_FilesystemAction):
         self.destination = destination
         self.need_cleanup = False
 
+        dirmode = 0o2755
+        if mode is not None:
+            dirmode = 0o2700 | mode
+            # Allow +x for group and others if they have +r.
+            if dirmode & 0o0040:
+                dirmode = dirmode | 0o0010
+            if dirmode & 0o0004:
+                dirmode = dirmode | 0o0001
+
         self.check_for_temporary()
         destdir = os.path.dirname(self.destination)
         if not os.path.exists(destdir):
-            os.makedirs(destdir, 0o2775)
+            os.makedirs(destdir, dirmode)
         if symlink:
             os.symlink(source, self.destination)
         elif link: