~ubuntu-branches/ubuntu/raring/yapra/raring

« back to all changes in this revision

Viewing changes to debian/patches/20_deduped_directory_hashing

  • Committer: Package Import Robot
  • Author(s): Taku YASUI
  • Date: 2012-03-26 00:33:47 UTC
  • Revision ID: package-import@ubuntu.com-20120326003347-hnepw83oytxvc9em
Tags: 0.1.2-6
* Use quilt instead of dpatch
* Bump Standards-Version to 3.9.3
* Moved repository to svn.debian.org
  - svn://svn.debian.org/svn/collab-maint/deb-maint/yapra

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## 20_deduped_directory_hashing.dpatch by Taku YASUI <tach@debian.org>
 
2
## DP: No description.
 
3
 
 
4
diff -urNad trunk~/lib-plugins/yapra/plugin/filter/deduped.rb trunk/lib-plugins/yapra/plugin/filter/deduped.rb
 
5
--- trunk~/lib-plugins/yapra/plugin/filter/deduped.rb   2009-06-23 21:39:50.000000000 +0900
 
6
+++ trunk/lib-plugins/yapra/plugin/filter/deduped.rb    2009-09-04 21:37:37.719146332 +0900
 
7
@@ -33,7 +33,8 @@
 
8
         if attribute && d.respond_to?(attribute)
 
9
           v = d.__send__(attribute).to_s
 
10
         end
 
11
-        hashpath = File.join(cachepath.to_s, Digest::MD5.hexdigest(v))
 
12
+        digest = Digest::MD5.hexdigest(v)
 
13
+        hashpath = File.join(cachepath.to_s, digest[0,2], digest[2,2], digest)
 
14
         if File.exists?(hashpath)
 
15
           false
 
16
         else
 
17
@@ -41,6 +42,9 @@
 
18
             File.open(hashpath, "wb").write(v)
 
19
             @cache_paths << hashpath
 
20
             true
 
21
+          rescue Errno::ENOENT
 
22
+            FileUtils.mkdir_p(File.dirname(hashpath))
 
23
+            retry
 
24
           rescue 
 
25
             false
 
26
           end
 
27
@@ -54,4 +58,4 @@
 
28
       FileUtils.rm(@cache_paths, {:force => true})
 
29
     end
 
30
   end
 
31
-end
 
32
\ No newline at end of file
 
33
+end