summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-02-23 18:09:12 -0500
committerWill Woods <wwoods@redhat.com>2009-02-23 18:09:12 -0500
commitf7e891d0c337cf62d77df85e24f46afc307c6e7d (patch)
treee2a9207e607f2e878addec5e7909652777b1116f
parent84f78c101211139fef0b10d63676e5d0f42c2a45 (diff)
downloaddebuginfofs-f7e891d0c337cf62d77df85e24f46afc307c6e7d.zip
debuginfofs-f7e891d0c337cf62d77df85e24f46afc307c6e7d.tar.gz
debuginfofs-f7e891d0c337cf62d77df85e24f46afc307c6e7d.tar.xz
Fix fix_perms to hit the topdir too
-rwxr-xr-xdebuginfofs-mirror17
1 files changed, 9 insertions, 8 deletions
diff --git a/debuginfofs-mirror b/debuginfofs-mirror
index f9e9154..127b996 100755
--- a/debuginfofs-mirror
+++ b/debuginfofs-mirror
@@ -20,6 +20,7 @@
import os
import sys
+import stat
import shutil
import tempfile
import optparse
@@ -125,16 +126,16 @@ def pkg_to_nevra(p):
def fix_perms(targetdir):
'''Make all files readable, and all directories read+execute'''
+ def chmod_or(f, mask):
+ mode = os.lstat(f)[0]
+ if not stat.S_ISLNK(mode):
+ newmode = mode | mask
+ if newmode != mode:
+ os.chmod(f, newmode)
for top, dirs, files in os.walk(targetdir):
- for d in dirs:
- i = os.path.join(top, d)
- mode = os.stat(i)[0]
- os.chmod(i, mode | 0555)
+ chmod_or(top, 0555)
for f in files:
- i = os.path.join(top, f)
- if not os.path.islink(i):
- mode = os.stat(i)[0]
- os.chmod(i, mode | 0444)
+ chmod_or(os.path.join(top, f), 0444)
def _unpack_rpm(rpm, targetdir):
'''Unpack the given rpm into the given directory'''