[ARVADOS] updated: 9887cbea6421c442de1439f8c0050f81c4474dfd
git at public.curoverse.com
git at public.curoverse.com
Mon Feb 17 15:12:41 EST 2014
Summary of changes:
services/api/app/models/collection.rb | 35 ++++++++++++++++++++------------
1 files changed, 22 insertions(+), 13 deletions(-)
via 9887cbea6421c442de1439f8c0050f81c4474dfd (commit)
from ffa11e9dc42740652da1d8382b89bc7eaaac5e2e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 9887cbea6421c442de1439f8c0050f81c4474dfd
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Feb 17 15:13:48 2014 -0500
Do a partial normalization of file list before sending to client.
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index efe41cb..ea18789 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -62,18 +62,19 @@ class Collection < ArvadosModel
return
end
- normalized_manifest = ""
- IO.popen(['arv-normalize'], 'w+b') do |io|
- io.write manifest_text
- io.close_write
- while buf = io.read(2**20)
- normalized_manifest += buf
- end
- end
+ #normalized_manifest = ""
+ #IO.popen(['arv-normalize'], 'w+b') do |io|
+ # io.write manifest_text
+ # io.close_write
+ # while buf = io.read(2**20)
+ # normalized_manifest += buf
+ # end
+ #end
@data_size = 0
- @files = []
- normalized_manifest.split("\n").each do |stream|
+ tmp = {}
+
+ manifest_text.split("\n").each do |stream|
toks = stream.split(" ")
stream = toks[0].gsub /\\(\\|[0-7]{3})/ do |escape_sequence|
@@ -104,14 +105,22 @@ class Collection < ArvadosModel
else $1.to_i(8).chr
end
end
- if @files > 0 and @files[-1][0] == stream and @files[-1][1] == filename
- @files[-1][2] += re[2].to_i
+ fn = stream + '/' + filename
+ i = re[2].to_i
+ if tmp[fn]
+ tmp[fn] += i
else
- @files << [stream, filename, re[2].to_i]
+ tmp[fn] = i
end
end
end
end
+
+ @files = []
+ tmp.each do |k, v|
+ re = k.match(/^(.+)\/(.+)/)
+ @files << [re[1], re[2], v]
+ end
end
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list