Skip to content
Snippets Groups Projects
Commit 8350b30d authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- removed cli switch "--SIP_version"

- added cli switch "--print_sip_version"
- added predefined $sipVersion
- removed caller call, because not needed if lib/ used
parent 5e5facc6
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,11 @@ use strict; ...@@ -44,6 +44,11 @@ use strict;
use warnings; use warnings;
use utf8; use utf8;
# version of SIP,
# see L<https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten>,
# document "SIP Spezifikation für automatischen Ingest SLUBArchiv (v2.0.1)" for details
my $sipVersion='v2020.1';
#=============================================================================== #===============================================================================
BEGIN{ BEGIN{
...@@ -51,11 +56,7 @@ BEGIN{ ...@@ -51,11 +56,7 @@ BEGIN{
require Win32::Console::ANSI; require Win32::Console::ANSI;
Win32::Console::ANSI->import(); Win32::Console::ANSI->import();
} }
## no critic
$INC{'SLUB/LZA/SIPBuilderBagIt.pm'} = 1; # needed because inlined module
## use critic
} }
return 1 if caller; # avoids main code running if module stuff is needed
use utf8; use utf8;
use SLUB::LZA::SIPBuilderBagIt; use SLUB::LZA::SIPBuilderBagIt;
...@@ -71,7 +72,6 @@ my $outputPath; ...@@ -71,7 +72,6 @@ my $outputPath;
my $ppn; my $ppn;
my $noppn; my $noppn;
# bag-info data # bag-info data
my $sipVersion;
my $externalWorkflow; my $externalWorkflow;
my $externalId; my $externalId;
my $externalIsilId = ""; my $externalIsilId = "";
...@@ -89,27 +89,27 @@ my $help; ...@@ -89,27 +89,27 @@ my $help;
my $man; my $man;
GetOptions( GetOptions(
"save_option:s" => \$save, # required "save_option:s" => \$save, # required
"IE_directory:s" => \$ieDirectory, # required "IE_directory:s" => \$ieDirectory, # required
"SIP_output_path:s" => \$outputPath, # required, but by save=replace can be ignored "SIP_output_path:s" => \$outputPath, # required, but by save=replace can be ignored
"ppn:s" => \$ppn, # semi-optional (choice 1 of 2) "ppn:s" => \$ppn, # semi-optional (choice 1 of 2)
"noppn:s" => \$noppn, # semi-optional (choice 2 of 2) "noppn:s" => \$noppn, # semi-optional (choice 2 of 2)
# bag-info data # bag-info data
"SIP_version:s" => \$sipVersion, # required "external_workflow:s" => \$externalWorkflow, # required
"external_workflow:s" => \$externalWorkflow, # required "external_id:s" => \$externalId, # required
"external_id:s" => \$externalId, # required "external_ISIL:s" => \$externalIsilId, # optional, default: no ISIL
"external_ISIL:s" => \$externalIsilId, # optional, default: no ISIL "external_conservation_flag" => \$hasConservationReason, # optional, default: no special conservation
"external_conservation_flag" => \$hasConservationReason, # optional, default: no special conservation "external_value_descr:s" => \$archivalValueDescription, # required
"external_value_descr:s" => \$archivalValueDescription, # required "rights_version:s" => \$rightsVersion, # required
"rights_version:s" => \$rightsVersion, # required
# not payload files # not payload files
"rights_xml:s" => \$rightsFilePath, # required "rights_xml:s" => \$rightsFilePath, # required
"add_meta_file:s" => \@addMetaFile, # optional "add_meta_file:s" => \@addMetaFile, # optional
"add_key_value:s" => \@addKeyValue, # optional "add_key_value:s" => \@addKeyValue, # optional
# extra # extra
"debug" => \$SLUB::LZA::SIPBuilderBagIt::with_debug, # optional "debug" => \$SLUB::LZA::SIPBuilderBagIt::with_debug, # optional
"help|?" => \$help, # optional "help|?" => \$help, # optional
"man" => \$man, # optional "man" => \$man, # optional
"print_sip_version" => sub{ print "supported sip version is $sipVersion\n"; exit 1; } # optional
) or pod2usage(2); ) or pod2usage(2);
# help # help
...@@ -150,15 +150,7 @@ if ((!defined $ppn && !defined $noppn) || (!defined $ppn && $noppn eq "") || (!d ...@@ -150,15 +150,7 @@ if ((!defined $ppn && !defined $noppn) || (!defined $ppn && $noppn eq "") || (!d
} }
#########################################################> bag-info.txt <############################################################################### #########################################################> bag-info.txt <###############################################################################
# sipversion
if (!defined $sipVersion || $sipVersion eq "") {
SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "ERROR: you need to specify --SIP_version, current tool supports <v2020.1>", "", "red");
exit 1;
}
if ($sipVersion ne "v2020.1") {
SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "ERROR: not valid --SIP_version, current tool supports <v2020.1>", "", "red");
exit 1;
}
utf8::decode($sipVersion); utf8::decode($sipVersion);
push @addBagInfo, {'SLUBArchiv-sipVersion' => $sipVersion}; push @addBagInfo, {'SLUBArchiv-sipVersion' => $sipVersion};
# externalWorkflow # externalWorkflow
...@@ -334,7 +326,6 @@ Options: ...@@ -334,7 +326,6 @@ Options:
-SIP_output_path=<target dir> where to put the SIP dir (absolute path!) -SIP_output_path=<target dir> where to put the SIP dir (absolute path!)
-ppn=<ppn>|-noppn=<noppn> SWB-PPN or any identifier (uses minimalistic MODS) -ppn=<ppn>|-noppn=<noppn> SWB-PPN or any identifier (uses minimalistic MODS)
-SIP_version=<version> mandatory, needs for identification of SIP format, supported <v2020.1>
-external_workflow=<workflow> mandatory, should be uniqe workflow name -external_workflow=<workflow> mandatory, should be uniqe workflow name
-external_id=<id> mandatory, should be uniqe ID (i.e. a catalog ID), reuse an ID only when updating existing AIP -external_id=<id> mandatory, should be uniqe ID (i.e. a catalog ID), reuse an ID only when updating existing AIP
-external_ISIL=<isil> optional, ISIL number of library -external_ISIL=<isil> optional, ISIL number of library
...@@ -345,6 +336,7 @@ Options: ...@@ -345,6 +336,7 @@ Options:
-rights_xml=<file> mandatory, path to SLUB rights xml file(absolute path!) -rights_xml=<file> mandatory, path to SLUB rights xml file(absolute path!)
-add_meta_file=<file> optional, can be repeated, additional meta files(absolute path!) -add_meta_file=<file> optional, can be repeated, additional meta files(absolute path!)
-add_key_value=<"key:value"> optional, can be repeated, additional key value pairs for bag-info.txt -add_key_value=<"key:value"> optional, can be repeated, additional key value pairs for bag-info.txt
-print_sip_version optional, print the supported SIP version
=head1 EXAMPLES =head1 EXAMPLES
...@@ -355,7 +347,6 @@ perl bin/slubsipbuilderbagit.pl ...@@ -355,7 +347,6 @@ perl bin/slubsipbuilderbagit.pl
-IE_directory=./export_dir_kitodo/bagit/test2 -IE_directory=./export_dir_kitodo/bagit/test2
-SIP_output_path=./output_sips -SIP_output_path=./output_sips
-ppn=457035137 -ppn=457035137
-SIP_version=v2020.1
-external_id=10008 -external_id=10008
-external_workflow=kitodo -external_workflow=kitodo
-external_ISIL=DE-14 -external_ISIL=DE-14
...@@ -376,7 +367,6 @@ perl bin/slubsipbuilderbagit.pl ...@@ -376,7 +367,6 @@ perl bin/slubsipbuilderbagit.pl
-save_option=replace -save_option=replace
-IE_directory=./ie_to_be_replaced -IE_directory=./ie_to_be_replaced
-ppn=457035137 -ppn=457035137
-SIP_version=v2020.1
-external_id=10008 -external_id=10008
-external_workflow=kitodo -external_workflow=kitodo
-external_ISIL=DE-14 -external_ISIL=DE-14
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment