[game-data-packager] 14/20: Standardize permissions on packaged files

Simon McVittie smcv at debian.org
Mon Jan 12 01:07:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 128a912fdee71a836357c0e8a5f0db8fb81ff346
Author: Simon McVittie <smcv at debian.org>
Date:   Mon Jan 12 00:06:50 2015 +0000

    Standardize permissions on packaged files
---
 lib/game_data_packager/__init__.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index ad7c074..50ff6f9 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -30,6 +30,7 @@ import random
 import re
 import shlex
 import shutil
+import stat
 import subprocess
 import sys
 import tarfile
@@ -1096,6 +1097,20 @@ class GameData(object):
                 encoding='utf-8')
         os.chmod(os.path.join(debdir, 'control'), 0o644)
 
+        for dirpath, dirnames, filenames in os.walk(destdir):
+            for fn in filenames + dirnames:
+                full = os.path.join(dirpath, fn)
+                stat_res = os.lstat(full)
+                if stat.S_ISLNK(stat_res.st_mode):
+                    continue
+                elif (stat.S_ISDIR(stat_res.st_mode) or
+                        (stat.S_IMODE(stat_res.st_mode) & 0o111) != 0):
+                    # make directories and executable files rwxr-xr-x
+                    os.chmod(full, 0o755)
+                else:
+                    # make other files rw-r--r--
+                    os.chmod(full, 0o644)
+
         return True
 
     def modify_control_template(self, control, package, destdir):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list