libis-rosetta_checker 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8586a77252fe8f251c32bb348149b91a68af8ccc
|
4
|
+
data.tar.gz: f89774bd8dadd489dbf67df4ca5f025b05da9bf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3efb31f23bb3ef27d436f8742c3466947ee8616269ff9466cc5bfacc3f21e560e1a8d9c2cd0999a4357a042e470c2f0d662eb98f3fc8c5a8c239507a3dafcacb
|
7
|
+
data.tar.gz: a9ebe6db7c594e19a0e2ea6bfa587ba8cbe20bc850dd7e2a3492bdb518c887a082519ff1897fd9d2ecc8872872638d90f7e9c396342a2882cc9a88297f66834e
|
@@ -59,8 +59,8 @@ module Libis
|
|
59
59
|
|
60
60
|
protected
|
61
61
|
|
62
|
-
SQL_DATA = %w'ie_id rep_id fl_id original_name owner label group_id entity_type user_c'
|
63
|
-
CSV_HEADER = %w'parent_type parent file size md5 found name_match' + SQL_DATA
|
62
|
+
SQL_DATA = %w'ie_id rep_id fl_id original_name owner label group_id entity_type user_c path'
|
63
|
+
CSV_HEADER = %w'parent_type parent file size md5 sha1 found name_match' + SQL_DATA
|
64
64
|
|
65
65
|
LOG_PATTERN = "[%d #%p] %-5l : %m\n".freeze
|
66
66
|
|
@@ -82,7 +82,9 @@ module Libis
|
|
82
82
|
ci.LABEL as label,
|
83
83
|
cf.GROUPID as group_id,
|
84
84
|
ci.ENTITYTYPE as entity_type,
|
85
|
-
ci.PARTITIONC as user_c
|
85
|
+
ci.PARTITIONC as user_c,
|
86
|
+
pm.MID AS mid,
|
87
|
+
md.VALUE AS dnx
|
86
88
|
FROM
|
87
89
|
V2KU_PER00.PERMANENT_INDEX ps
|
88
90
|
LEFT JOIN V2KU_SHR00.STORAGE_PARAMETER sp ON sp.STORAGE_ID = ps.STORAGE_ID
|
@@ -90,6 +92,8 @@ module Libis
|
|
90
92
|
LEFT JOIN V2KU_REP00.HDECONTROL cf ON cf.PID = ps.STORED_ENTITY_ID
|
91
93
|
LEFT JOIN V2KU_REP00.HDECONTROL cr ON cr.PID = cf.PARENTID
|
92
94
|
LEFT JOIN V2KU_REP00.HDECONTROL ci ON ci.PID = cr.PARENTID
|
95
|
+
LEFT JOIN V2KU_REP00.HDEPIDMID pm ON pm.PID = cf.PID
|
96
|
+
LEFT JOIN V2KU_REP00.HDEMETADATA md ON md.MID = pm.MID
|
93
97
|
WHERE
|
94
98
|
sp."KEY" = 'DIR_ROOT'
|
95
99
|
AND ps.FILE_SIZE = :filesize
|
@@ -98,6 +102,7 @@ module Libis
|
|
98
102
|
AND cf.OBJECTTYPE = 'FILE'
|
99
103
|
AND cr.OBJECTTYPE = 'REPRESENTATION'
|
100
104
|
AND ci.OBJECTTYPE = 'INTELLECTUAL_ENTITY'
|
105
|
+
AND md.mdid = 21
|
101
106
|
SQL
|
102
107
|
|
103
108
|
def setup_logging
|
@@ -189,19 +194,11 @@ module Libis
|
|
189
194
|
logger.info "- #{file}"
|
190
195
|
if File.extname(file) == '.bz2'
|
191
196
|
logger.info MSG_DEFLATE
|
192
|
-
info[:size] = 0
|
193
|
-
reader = Bzip2::FFI::Reader.open file
|
194
|
-
md5 = Digest::MD5.new
|
195
|
-
logger.info MSG_CALC_FC
|
196
|
-
while (data = reader.read 2048000) do
|
197
|
-
info[:size] += data.length
|
198
|
-
md5 << data
|
199
|
-
end
|
200
|
-
reader.close
|
201
197
|
info[:parent_type] = 'F'
|
202
198
|
info[:parent] = file
|
203
199
|
info[:file] = File.basename file, '.bz2'
|
204
|
-
info
|
200
|
+
logger.info MSG_CALC_FC
|
201
|
+
checksum_file Bzip2::FFI::Reader.open(file), info
|
205
202
|
check_file info
|
206
203
|
elsif File.extname(file) == '.zip'
|
207
204
|
logger.info ' - Unpacking'.freeze
|
@@ -213,23 +210,14 @@ module Libis
|
|
213
210
|
info[:file] = entry.name
|
214
211
|
logger.info "- #{file}/#{entry.name}"
|
215
212
|
logger.info MSG_CALC_FC
|
216
|
-
|
217
|
-
md5 = Digest::MD5.new
|
218
|
-
reader = entry.get_input_stream
|
219
|
-
while (data = reader.read 2048000) do
|
220
|
-
info[:size] += data.length
|
221
|
-
md5 << data
|
222
|
-
end
|
223
|
-
reader.close
|
224
|
-
info[:md5] = md5.hexdigest
|
213
|
+
checksum_file entry.get_input_stream, info
|
225
214
|
check_file info
|
226
215
|
end
|
227
216
|
end
|
228
217
|
else
|
229
218
|
begin
|
230
219
|
logger.info MSG_CALC_FC
|
231
|
-
|
232
|
-
info[:md5] = Digest::MD5.file file
|
220
|
+
checksum_file File.open(file), info
|
233
221
|
check_file info
|
234
222
|
rescue Exception
|
235
223
|
logger.error "Could not access file '#{file}'"
|
@@ -237,6 +225,20 @@ module Libis
|
|
237
225
|
end
|
238
226
|
end
|
239
227
|
|
228
|
+
def checksum_file(reader, info)
|
229
|
+
info[:size] = 0
|
230
|
+
md5 = Digest::MD5.new
|
231
|
+
sha1 = Digest::SHA1.new
|
232
|
+
while (data = reader.read 2048000) do
|
233
|
+
info[:size] += data.length
|
234
|
+
md5 << data
|
235
|
+
sha1 << data
|
236
|
+
end
|
237
|
+
reader.close
|
238
|
+
info[:md5] = md5.hexdigest
|
239
|
+
info[:sha1] = sha1.hexdigest
|
240
|
+
end
|
241
|
+
|
240
242
|
def check_file(info)
|
241
243
|
logger.info MSG_CHCK_DB
|
242
244
|
|
@@ -245,9 +247,12 @@ module Libis
|
|
245
247
|
|
246
248
|
cursor.exec
|
247
249
|
|
250
|
+
info[:found] = 0
|
248
251
|
info_list = []
|
249
252
|
|
250
253
|
while (found = cursor.fetch_hash)
|
254
|
+
dnx = found['DNX'].read
|
255
|
+
next unless dnx =~ /<key id="fixityType">SHA1<\/key><key id="fixityValue">#{info[:sha1]}<\/key>/
|
251
256
|
SQL_DATA.each {|x| info[x.to_sym] = found[x.upcase]}
|
252
257
|
logger.info " found match: #{info[:ie_id]}/#{info[:rep_id]}/#{info[:fl_id]}"
|
253
258
|
if info[:original_name] =~ Regexp.new(info[:file].split(/[ #._-]/).join('.*'))
|
@@ -261,15 +266,13 @@ module Libis
|
|
261
266
|
|
262
267
|
end
|
263
268
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
to_report i
|
272
|
-
end
|
269
|
+
if info_list.empty?
|
270
|
+
to_report info
|
271
|
+
else
|
272
|
+
info_list.each do |i|
|
273
|
+
i[:found] = info_list.count
|
274
|
+
to_report i
|
275
|
+
end
|
273
276
|
end
|
274
277
|
|
275
278
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-rosetta_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-oci8
|