[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)
_at_@ -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:
_at_@ -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):
 
     _at_cmdln.option('-n', '--dry-run', action='store_true',
                         help='don\'t actually do anything')
+    _at_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.')
     _at_cmdln.option('-f', '--file-mask', metavar='REGEX',
                         help='regular expression to select files to create hashes for')
     _at_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 Thu Feb 12 2009 - 01:03:23 GMT

This archive was generated by hypermail 2.3.0 : Thu Mar 25 2010 - 19:18:16 GMT