[kernel] r14425 - dists/trunk/firmware-nonfree/linux-nonfree

Ben Hutchings benh at alioth.debian.org
Fri Oct 23 02:34:35 UTC 2009


Author: benh
Date: Fri Oct 23 02:34:32 2009
New Revision: 14425

Log:
Add support for multiple destination direcories.

This allows comparing linux-firmware.git against the contents of all our
binary packages, not just one.

Modified:
   dists/trunk/firmware-nonfree/linux-nonfree/update.py

Modified: dists/trunk/firmware-nonfree/linux-nonfree/update.py
==============================================================================
--- dists/trunk/firmware-nonfree/linux-nonfree/update.py	Fri Oct 23 01:48:35 2009	(r14424)
+++ dists/trunk/firmware-nonfree/linux-nonfree/update.py	Fri Oct 23 02:34:32 2009	(r14425)
@@ -2,7 +2,7 @@
 
 import errno, filecmp, os.path, re, sys
 
-def main(for_main, source_dir, dest_dir):
+def main(for_main, source_dir, dest_dirs):
     sections = []
     section = None
     keyword = None
@@ -74,18 +74,21 @@
             continue
         for filename, file_info in section['file'].iteritems():
             if file_info.get('source') or not for_main:
-                update_file(source_dir, dest_dir, filename)
+                update_file(source_dir, dest_dirs, filename)
 
-def update_file(source_dir, dest_dir, filename):
-    try:
-        if not filecmp.cmp(os.path.join(source_dir, filename),
-                           os.path.join(dest_dir, filename),
-                           True):
-            print '%s: changed' % filename
-    except EnvironmentError, e:
-        if e.errno == errno.ENOENT:
-            if os.path.isfile(os.path.join(source_dir, filename)):
-                print '%s: could be added' % filename
+def update_file(source_dir, dest_dirs, filename):
+    source_file = os.path.join(source_dir, filename)
+    if not os.path.isfile(source_file):
+        return
+    for dest_dir in dest_dirs:
+        dest_file = os.path.join(dest_dir, filename)
+        if os.path.isfile(dest_file):
+            if not filecmp.cmp(os.path.join(source_dir, filename),
+                               os.path.join(dest_dir, filename),
+                               True):
+                print '%s: changed' % filename
+            return
+    print '%s: could be added' % filename
 
 if __name__ == '__main__':
     for_main = False
@@ -93,17 +96,18 @@
     if len(sys.argv) > i and sys.argv[i] == '--main':
         for_main = True
         i += 1
-    if len(sys.argv) != i + 2:
+    if len(sys.argv) < i + 2:
         print >>sys.stderr, '''\
-Usage: ./update.py [--main] <linux-firmware-dir> <dest-dir>
+Usage: ./update.py [--main] <linux-firmware-dir> <dest-dir>...
 
 Report changes or additions in linux-firmware.git that may be suitable
 for inclusion in firmware-nonfree or linux-2.6.
 
-For firmware-nonfree, specify the linux-nonfree directory as <dest-dir>.
+For firmware-nonfree, specify the per-package subdirectories as
+<dest-dir>...
 
 For linux-2.6, use the '--main' option and specify the
 debian/build/build-firmware/firmware directory as <dest-dir>.
 '''
         sys.exit(2)
-    main(for_main, sys.argv[i], sys.argv[i + 1])
+    main(for_main, sys.argv[i], sys.argv[i + 1 :])



More information about the Kernel-svn-changes mailing list