[mirrorbrain-commits] [opensuse-svn] r6441 - trunk/tools/download-redirector-v2/tools

From: Novell Forge SVN <noreply_at_novell.com>
Date: Wed, 11 Feb 2009 18:03:09 -0700 (MST)
Author: poeml
Date: 2009-02-11 18:03:06 -0700 (Wed, 11 Feb 2009)
New Revision: 6441

Modified:
   trunk/tools/download-redirector-v2/tools/metalink-hasher.py
Log:
metalink-hasher: make sure that the file and directory permissions are not copied, because for staged content this means that they might be unreadable. Since the hashes don't contain any reversible information, there is no reason to treat them as confidential (and Apache would not deliver them anyway, since they are not in the Docroot at all). Add an option that allows permission copying.

Modified: trunk/tools/download-redirector-v2/tools/metalink-hasher.py
===================================================================
--- trunk/tools/download-redirector-v2/tools/metalink-hasher.py	2009-02-11 23:52:27 UTC (rev 6440)
+++ trunk/tools/download-redirector-v2/tools/metalink-hasher.py	2009-02-12 01:03:06 UTC (rev 6441)
@@ -33,7 +33,10 @@
     if not opts.dry_run:
         if not os.path.isdir(dst_dir):
             os.makedirs(dst_dir, mode = 0755)
-        os.chmod(dst_dir, src_dir_mode)
+        if opts.copy_permissions:
+            os.chmod(dst_dir, src_dir_mode)
+        else:
+            os.chmod(dst_dir, 0755)
 
     src_mtime = os.path.getmtime(src)
     try:
@@ -81,13 +84,21 @@
     d.write(''.join(lines))
     d.close()
 
-    os.chmod(dst, os.stat(src).st_mode)
+    if opts.copy_permissions:
+        os.chmod(dst, os.stat(src).st_mode)
+    else:
+        os.chmod(dst, 0644)
 
 
 class Metalinks(cmdln.Cmdln):
 
     @cmdln.option('-n', '--dry-run', action='store_true',
                         help='don\'t actually do anything')
+    @cmdln.option('--copy-permissions', action='store_true',
+                        help='copy the permissions of directories and files '
+                             'to the hashes files. Normally, this should not '
+                             'be needed, because the hash files don\'t contain '
+                             'any reversible information.')
     @cmdln.option('-f', '--file-mask', metavar='REGEX',
                         help='regular expression to select files to create hashes for')
     @cmdln.option('-b', '--base-dir', metavar='PATH',

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on 2009-02-12Z01:03:23

This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:11 GMT