From 8350b30d2a93f2f75a6a105274069ed85d0388db Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <art1@andreas-romeyke.de> Date: Sat, 23 Oct 2021 18:12:56 +0200 Subject: [PATCH] - removed cli switch "--SIP_version" - added cli switch "--print_sip_version" - added predefined $sipVersion - removed caller call, because not needed if lib/ used --- bin/slubsipbuilderbagit.pl | 60 ++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl index 09e56d9..65c07ce 100644 --- a/bin/slubsipbuilderbagit.pl +++ b/bin/slubsipbuilderbagit.pl @@ -44,6 +44,11 @@ use strict; use warnings; 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{ @@ -51,11 +56,7 @@ BEGIN{ require Win32::Console::ANSI; 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 SLUB::LZA::SIPBuilderBagIt; @@ -71,7 +72,6 @@ my $outputPath; my $ppn; my $noppn; # bag-info data -my $sipVersion; my $externalWorkflow; my $externalId; my $externalIsilId = ""; @@ -89,27 +89,27 @@ my $help; my $man; GetOptions( - "save_option:s" => \$save, # required - "IE_directory:s" => \$ieDirectory, # required - "SIP_output_path:s" => \$outputPath, # required, but by save=replace can be ignored - "ppn:s" => \$ppn, # semi-optional (choice 1 of 2) - "noppn:s" => \$noppn, # semi-optional (choice 2 of 2) + "save_option:s" => \$save, # required + "IE_directory:s" => \$ieDirectory, # required + "SIP_output_path:s" => \$outputPath, # required, but by save=replace can be ignored + "ppn:s" => \$ppn, # semi-optional (choice 1 of 2) + "noppn:s" => \$noppn, # semi-optional (choice 2 of 2) # bag-info data - "SIP_version:s" => \$sipVersion, # required - "external_workflow:s" => \$externalWorkflow, # required - "external_id:s" => \$externalId, # required - "external_ISIL:s" => \$externalIsilId, # optional, default: no ISIL - "external_conservation_flag" => \$hasConservationReason, # optional, default: no special conservation - "external_value_descr:s" => \$archivalValueDescription, # required - "rights_version:s" => \$rightsVersion, # required + "external_workflow:s" => \$externalWorkflow, # required + "external_id:s" => \$externalId, # required + "external_ISIL:s" => \$externalIsilId, # optional, default: no ISIL + "external_conservation_flag" => \$hasConservationReason, # optional, default: no special conservation + "external_value_descr:s" => \$archivalValueDescription, # required + "rights_version:s" => \$rightsVersion, # required # not payload files - "rights_xml:s" => \$rightsFilePath, # required - "add_meta_file:s" => \@addMetaFile, # optional - "add_key_value:s" => \@addKeyValue, # optional + "rights_xml:s" => \$rightsFilePath, # required + "add_meta_file:s" => \@addMetaFile, # optional + "add_key_value:s" => \@addKeyValue, # optional # extra - "debug" => \$SLUB::LZA::SIPBuilderBagIt::with_debug, # optional - "help|?" => \$help, # optional - "man" => \$man, # optional + "debug" => \$SLUB::LZA::SIPBuilderBagIt::with_debug, # optional + "help|?" => \$help, # optional + "man" => \$man, # optional + "print_sip_version" => sub{ print "supported sip version is $sipVersion\n"; exit 1; } # optional ) or pod2usage(2); # help @@ -150,15 +150,7 @@ if ((!defined $ppn && !defined $noppn) || (!defined $ppn && $noppn eq "") || (!d } #########################################################> 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); push @addBagInfo, {'SLUBArchiv-sipVersion' => $sipVersion}; # externalWorkflow @@ -334,7 +326,6 @@ Options: -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) - -SIP_version=<version> mandatory, needs for identification of SIP format, supported <v2020.1> -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_ISIL=<isil> optional, ISIL number of library @@ -345,6 +336,7 @@ Options: -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_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 @@ -355,7 +347,6 @@ perl bin/slubsipbuilderbagit.pl -IE_directory=./export_dir_kitodo/bagit/test2 -SIP_output_path=./output_sips -ppn=457035137 - -SIP_version=v2020.1 -external_id=10008 -external_workflow=kitodo -external_ISIL=DE-14 @@ -376,7 +367,6 @@ perl bin/slubsipbuilderbagit.pl -save_option=replace -IE_directory=./ie_to_be_replaced -ppn=457035137 - -SIP_version=v2020.1 -external_id=10008 -external_workflow=kitodo -external_ISIL=DE-14 -- GitLab