From 069b12a21b7ed65f598ae8f241c7573df1916c42 Mon Sep 17 00:00:00 2001
From: Christian Goetze <cg@lindenlab.com>
Date: Thu, 27 Mar 2008 23:58:18 +0000
Subject: [PATCH] If the correct wy doesn't work, hack it instead -sigh-

---
 indra/lib/python/indra/util/llmanifest.py |  2 --
 indra/newview/viewer_manifest.py          | 19 +++++++++----------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 858034bad6..9679650104 100644
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -238,7 +238,6 @@ class LLManifest(object):
     def __init__(self, srctree, dsttree, args):
         super(LLManifest, self).__init__()
         self.args = args
-        self.dir_list = []
         self.file_list = []
         self.excludes = []
         self.actions = []
@@ -425,7 +424,6 @@ class LLManifest(object):
         if(not self.includes(src, dst)):
             print "Excluding: ", src, dst
             return
-        self.dir_list.append([src, dst])
         names = os.listdir(src)
         self.cmakedirs(dst)
         errors = []
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 8f6865d13b..c5fdab5b7b 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -479,16 +479,6 @@ class LinuxManifest(ViewerManifest):
                         if re.search("lib/lib.+\.so.*", d):
                                 self.run_command('strip -S %s' % d)
 
-                # Fixing access permissions
-                for s,d in self.dir_list:
-                    self.run_command("chmod 755 '%s'" % d)
-                for s,d in self.file_list:
-                    if os.access(d, os.X_OK):
-                        self.run_command("chmod 755 '%s'" % d)
-                    else:
-                        self.run_command("chmod 644 '%s'" % d) 
-
-
         def package_finish(self):
                 if(self.args.has_key('installer_name')):
                         installer_name = self.args['installer_name']
@@ -500,6 +490,15 @@ class LinuxManifest(ViewerManifest):
                         else:
                                 installer_name += '_' + self.channel_oneword().upper()
 
+                # Fix access permissions
+                self.run_command("""
+                find %(dst)s -type d | xargs chmod 755;
+                find %(dst)s -type f -perm 0700 | xargs chmod 0755;
+                find %(dst)s -type f -perm 0500 | xargs chmod 0555;
+                find %(dst)s -type f -perm 0600 | xargs chmod 0644;
+                find %(dst)s -type f -perm 0400 | xargs chmod 0444;
+                """ %  {'dst':self.get_dst_prefix() })
+
                 # temporarily move directory tree so that it has the right name in the tarfile
                 self.run_command("mv %(dst)s %(inst)s" % {'dst':self.get_dst_prefix(),'inst':self.src_path_of(installer_name)})
                 # --numeric-owner hides the username of the builder for security etc.
-- 
GitLab