[Python-modules-commits] r17148 - in packages/gamera/trunk/debian (4 files)

jwilk at users.alioth.debian.org jwilk at users.alioth.debian.org
Wed May 25 22:52:05 UTC 2011


    Date: Wednesday, May 25, 2011 @ 22:52:04
  Author: jwilk
Revision: 17148

Eliminate files with duplicate contents from the documentation package using fdupes and a dedicated script.

Added:
  packages/gamera/trunk/debian/symlink-helper
Modified:
  packages/gamera/trunk/debian/changelog
  packages/gamera/trunk/debian/control
  packages/gamera/trunk/debian/rules

Modified: packages/gamera/trunk/debian/changelog
===================================================================
--- packages/gamera/trunk/debian/changelog	2011-05-25 22:45:13 UTC (rev 17147)
+++ packages/gamera/trunk/debian/changelog	2011-05-25 22:52:04 UTC (rev 17148)
@@ -1,8 +1,12 @@
 gamera (3.3.0-2) UNRELEASED; urgency=low
 
   * Remove python-stats from Build-Depends (closes: #627726).
+  * Eliminate files with duplicate contents from the documentation package
+    using fdupes and a dedicated script.
+    + Update debian/rules accordingly.
+    + Add fdupes and python (>= 2.5) to Build-Depends-Indep.
 
- -- Jakub Wilk <jwilk at debian.org>  Mon, 23 May 2011 23:36:26 +0200
+ -- Jakub Wilk <jwilk at debian.org>  Thu, 26 May 2011 00:46:38 +0200
 
 gamera (3.3.0-1) unstable; urgency=low
 

Modified: packages/gamera/trunk/debian/control
===================================================================
--- packages/gamera/trunk/debian/control	2011-05-25 22:45:13 UTC (rev 17147)
+++ packages/gamera/trunk/debian/control	2011-05-25 22:52:04 UTC (rev 17148)
@@ -13,7 +13,8 @@
  libga-dev
 Build-Depends-Indep:
  python-numpy, python-wxgtk2.8,
- help2man, netpbm
+ help2man, netpbm,
+ python (>= 2.5), fdupes
 XS-Python-Version: >= 2.4
 Standards-Version: 3.9.2
 Homepage: http://gamera.sourceforge.net/

Modified: packages/gamera/trunk/debian/rules
===================================================================
--- packages/gamera/trunk/debian/rules	2011-05-25 22:45:13 UTC (rev 17147)
+++ packages/gamera/trunk/debian/rules	2011-05-25 22:52:04 UTC (rev 17148)
@@ -67,6 +67,11 @@
 .PHONY: override_dh_installdocs
 override_dh_installdocs: doc/stamp
 	dh_installdocs
+ifneq ($(shell dh_listpackages | grep -x -F gamera-doc),)
+	cd debian/gamera-doc/usr/share/doc/gamera-doc/html/ && \
+		$(CURDIR)/debian/symlink-helper ../src/ . && \
+		fdupes -r --linkhard .
+endif
 
 doc/manpage/gamera_gui.1: build/stamp
 	mkdir -p doc/manpage/

Added: packages/gamera/trunk/debian/symlink-helper
===================================================================
--- packages/gamera/trunk/debian/symlink-helper	                        (rev 0)
+++ packages/gamera/trunk/debian/symlink-helper	2011-05-25 22:52:04 UTC (rev 17148)
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+import hashlib
+import os
+import sys
+
+def file_hash(path):
+    hashsum = hashlib.sha256()
+    file = open(path, 'rb')
+    try:
+        hashsum.update(file.read())
+    finally:
+        file.close()
+    return hashsum.digest()
+
+def main():
+    data = {}
+    if len(sys.argv) != 3:
+        print >>sys.stderr, 'Usage: %s <src-dir> <dst-dir>'
+        sys.exit(1)
+    _, src_dir, dst_dir = sys.argv
+    for root, dirs, files in os.walk(src_dir):
+        for filename in files:
+            path = os.path.join(root, filename)
+            path = os.path.normpath(path)
+            data[file_hash(path)] = path
+    for root, dirs, files in os.walk(dst_dir):
+        for filename in files:
+            if not '_generic' in filename:
+                continue
+            path = os.path.join(root, filename)
+            path = os.path.normpath(path)
+            data[file_hash(path)] = path
+    for root, dirs, files in os.walk(dst_dir):
+        for filename in files:
+            if '_generic' in filename:
+                continue
+            path = os.path.join(root, filename)
+            path = os.path.normpath(path)
+            try:
+                sympath = data[file_hash(path)]
+            except LookupError:
+                pass
+            else:
+                sympath = os.path.join('../' * root.count('/'), sympath)
+                sympath = os.path.normpath(sympath)
+                print >>sys.stderr, 'symlinking %s -> %s' % (path, sympath)
+                os.unlink(path)
+                os.symlink(sympath, path)
+
+if __name__ == '__main__':
+    main()
+
+# vim:ts=4 sw=4 et


Property changes on: packages/gamera/trunk/debian/symlink-helper
___________________________________________________________________
Added: svn:executable
   + *




More information about the Python-modules-commits mailing list