arvados 1.3.0.20190122164002 → 1.3.1.20181129194931
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/arvados/keep.rb +13 -32
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebedc440d70c4a447080e1e5c0c03e85e51b95c6
|
4
|
+
data.tar.gz: 684aa1208ea94e66445f6ef983b3de54162f7a32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eaace22f022dcd2c4b0b69785aa74cdb786eb93a93ca78c896dfec9b205f757ff96ebea3a3d9fcba3d299a50b6ce44bbcdb63f1782da1e22d98cf4dfaf76d40
|
7
|
+
data.tar.gz: 87921a34e55707b318e1ffbc76dd2dc54da80f8060c26d9a6194cc95d9bca631c1470a87857647c68aa70b0d8e31d3ea888c60653ec3dcb0e5a4094347a01297
|
data/lib/arvados/keep.rb
CHANGED
@@ -101,14 +101,8 @@ module Keep
|
|
101
101
|
end
|
102
102
|
|
103
103
|
class Manifest
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
EMPTY_DIR_TOKEN_REGEXP = /^0:0:\.$/ # The exception when a file can have '.' as a name
|
108
|
-
FILE_TOKEN_REGEXP = /^[[:digit:]]+:[[:digit:]]+:([^\000-\040\\]|\\[0-3][0-7][0-7])+$/
|
109
|
-
FILE_NAME_REGEXP = /^[[:digit:]]+:[[:digit:]]+:([^\/]+(\/[^\/]+)*)$/
|
110
|
-
|
111
|
-
NON_8BIT_ENCODED_CHAR = /[^\\]\\[4-7][0-7][0-7]/
|
104
|
+
STRICT_STREAM_TOKEN_REGEXP = /^(\.)(\/[^\/\s]+)*$/
|
105
|
+
STRICT_FILE_TOKEN_REGEXP = /^[[:digit:]]+:[[:digit:]]+:([^\s\/]+(\/[^\s\/]+)*)$/
|
112
106
|
|
113
107
|
# Class to parse a manifest text and provide common views of that data.
|
114
108
|
def initialize(manifest_text)
|
@@ -137,9 +131,7 @@ module Keep
|
|
137
131
|
end
|
138
132
|
end
|
139
133
|
|
140
|
-
def
|
141
|
-
return nil if s.nil?
|
142
|
-
|
134
|
+
def unescape(s)
|
143
135
|
# Parse backslash escapes in a Keep manifest stream or file name.
|
144
136
|
s.gsub(/\\(\\|[0-7]{3})/) do |_|
|
145
137
|
case $1
|
@@ -151,10 +143,6 @@ module Keep
|
|
151
143
|
end
|
152
144
|
end
|
153
145
|
|
154
|
-
def unescape(s)
|
155
|
-
self.class.unescape(s)
|
156
|
-
end
|
157
|
-
|
158
146
|
def split_file_token token
|
159
147
|
start_pos, filesize, filename = token.split(':', 3)
|
160
148
|
if filename.nil?
|
@@ -174,15 +162,15 @@ module Keep
|
|
174
162
|
elsif in_file_tokens or not Locator.valid? token
|
175
163
|
in_file_tokens = true
|
176
164
|
|
177
|
-
|
165
|
+
file_tokens = split_file_token(token)
|
178
166
|
stream_name_adjuster = ''
|
179
|
-
if
|
180
|
-
|
181
|
-
stream_name_adjuster =
|
182
|
-
|
167
|
+
if file_tokens[2].include?('/') # '/' in filename
|
168
|
+
parts = file_tokens[2].rpartition('/')
|
169
|
+
stream_name_adjuster = parts[1] + parts[0] # /dir_parts
|
170
|
+
file_tokens[2] = parts[2]
|
183
171
|
end
|
184
172
|
|
185
|
-
yield [stream_name + stream_name_adjuster
|
173
|
+
yield [stream_name + stream_name_adjuster] + file_tokens
|
186
174
|
end
|
187
175
|
end
|
188
176
|
end
|
@@ -209,13 +197,10 @@ module Keep
|
|
209
197
|
# files. This can help you avoid parsing the entire manifest if you
|
210
198
|
# just want to check if a small number of files are specified.
|
211
199
|
if stop_after.nil? or not @files.nil?
|
212
|
-
|
213
|
-
return files.reject{|_, name, size| name == '.' and size == 0}.size
|
200
|
+
return files.size
|
214
201
|
end
|
215
202
|
seen_files = {}
|
216
|
-
each_file_spec do |streamname, _,
|
217
|
-
# Avoid counting empty dir placeholders
|
218
|
-
next if filename == "." and filesize == 0
|
203
|
+
each_file_spec do |streamname, _, _, filename|
|
219
204
|
seen_files[[streamname, filename]] = true
|
220
205
|
return stop_after if (seen_files.size >= stop_after)
|
221
206
|
end
|
@@ -265,9 +250,7 @@ module Keep
|
|
265
250
|
count = 0
|
266
251
|
|
267
252
|
word = words.shift
|
268
|
-
|
269
|
-
unescaped_word = unescape(word)
|
270
|
-
count += 1 if word =~ STREAM_TOKEN_REGEXP and unescaped_word =~ STREAM_NAME_REGEXP and unescaped_word !~ /\/\.\.?(\/|$)/
|
253
|
+
count += 1 if word =~ STRICT_STREAM_TOKEN_REGEXP and word !~ /\/\.\.?(\/|$)/
|
271
254
|
raise ArgumentError.new "Manifest invalid for stream #{line_count}: missing or invalid stream name #{word.inspect if word}" if count != 1
|
272
255
|
|
273
256
|
count = 0
|
@@ -279,9 +262,7 @@ module Keep
|
|
279
262
|
raise ArgumentError.new "Manifest invalid for stream #{line_count}: missing or invalid locator #{word.inspect if word}" if count == 0
|
280
263
|
|
281
264
|
count = 0
|
282
|
-
|
283
|
-
while unescape(word) =~ EMPTY_DIR_TOKEN_REGEXP or
|
284
|
-
(word =~ FILE_TOKEN_REGEXP and unescape(word) =~ FILE_NAME_REGEXP and ($~[1].split('/') & ['..', '.']).empty?)
|
265
|
+
while word =~ STRICT_FILE_TOKEN_REGEXP and ($~[1].split('/') & ['..','.']).empty?
|
285
266
|
word = words.shift
|
286
267
|
count += 1
|
287
268
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvados
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1.20181129194931
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvados Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: 0.1.5
|
121
|
-
description: Arvados client library, git commit
|
121
|
+
description: Arvados client library, git commit 0d22de74ea069003b49a9d52878d5f1ac04d71bb
|
122
122
|
email: gem-dev@curoverse.com
|
123
123
|
executables: []
|
124
124
|
extensions: []
|