Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools for technical analysts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
tools for technical analysts
Commits
53563a97
Verified
Commit
53563a97
authored
10 months ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- path mapping added
parent
9f74b321
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SLUB/LZA/TA/Command/sample_testing.pm
+33
-8
33 additions, 8 deletions
lib/SLUB/LZA/TA/Command/sample_testing.pm
with
33 additions
and
8 deletions
lib/SLUB/LZA/TA/Command/sample_testing.pm
+
33
−
8
View file @
53563a97
...
...
@@ -152,16 +152,35 @@ sub validate_args { ## no critic (CognitiveComplexity::ProhibitExcessCognitiveCo
return
1
;
}
sub
_check_aip
($sample) {
sub
_check_aip
($sample
, $opt
) {
my
$path
=
$sample
->
{
filePath
};
my
$is_valid
=
0
;
if
(
-
d
$path
)
{
my
$bag
=
Archive::BagIt::
Fast
->
new
(
$path
);
$bag
->
use_plugins
('
Archive::BagIt::Plugin::Algorithm::SHA512
');
$is_valid
=
$bag
->
verify_bag
(
{
report_all_errors
=>
1
}
);
if
(
!
$is_valid
)
{
$is_valid
=
0
;}
}
my
$prefix_permanent
=
'
/var/archivematica/sharedDirectory/www/AIPsStore
';
my
$line
;
my
$tries
=
0
;
foreach
my
$current_permanent
(
@
{
$
SLUB::LZA::TA::
config
{
permanent_volume
}})
{
(
my
$remapped
=
$path
)
=~
s#^$prefix_permanent#$current_permanent#
;
if
(
$opt
->
{
debug
})
{
say
STDERR
"
try remap
$path
to
$remapped
";
}
if
(
$tries
==
0
)
{
$line
->
{
localPath
}
=
$remapped
;
}
else
{
$line
->
{"
localPath
$tries
"}
=
$remapped
;
}
if
(
-
d
$remapped
)
{
my
$bag
=
Archive::BagIt::
Fast
->
new
(
$remapped
);
$bag
->
use_plugins
('
Archive::BagIt::Plugin::Algorithm::SHA512
');
$is_valid
=
$bag
->
verify_bag
({
report_all_errors
=>
1
});
if
(
!
$is_valid
)
{
$is_valid
=
0
;}
last
;
}
else
{
$is_valid
=
-
1
;
}
$tries
++
;
}
$line
->
{
aipid
}
=
$sample
->
{
uuid
};
$line
->
{
filePath
}
=
$sample
->
{
filePath
};
$line
->
{
lzaid
}
=
$sample
->
{
transferMetadata
}
->
[
0
]
->
{'
bim:bag-info_dict
'}
->
{'
bim:SLUBArchiv-lzaId
'};
...
...
@@ -200,7 +219,7 @@ sub _execute {
}
# select first sample size aips
my
@sample_set
=
sort
{
$a
->
{
uuid
}
cmp
$b
->
{
uuid
}}
List::Util::
sample
$sample_size
,
map
{
$_
->
{'
_source
'}
}
@
{
$aips_response
->
{
hits
}
->
{
hits
}
};
my
@result
=
map
{
_check_aip
(
$_
)
}
@sample_set
;
my
@result
=
map
{
_check_aip
(
$_
,
$opt
)
}
@sample_set
;
return
\
@result
;
}
...
...
@@ -237,10 +256,16 @@ sub _print_aip($line) {
my
$isvalid
=
(
$line
->
{
isvalid
}?"
valid
":"
invalid
");
my
$lzaid
=
$line
->
{
lzaid
}?"
With lzaid '
$line
->{lzaid}'
":"
No lzaid defined
";
my
$path
=
$line
->
{
filePath
};
my
$mapped
=
$line
->
{
localPath
};
foreach
my
$additional_key
(
grep
{
/^localPath\d/
}
keys
%
{
$line
})
{
my
$additional_path
=
$line
->
{
$additional_key
};
$mapped
.=
"
or
$additional_path
";
}
say
"
* AIP `
$aipid
`
";
say
"
** Is
$isvalid
";
say
"
**
$lzaid
";
say
"
** Path is `
$path
`
";
say
"
** Mapped Path is
$mapped
";
say
"
** processed at
$line
->{checkdate}, created at
$line
->{creationdate}
";
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment