diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl index a269935500912565bdbe39964d62335a77de4b82..654964e9cb0a76dc9f0d38869f58e53fb5388e7c 100755 --- a/bin/slubsipbuilderbagit.pl +++ b/bin/slubsipbuilderbagit.pl @@ -7711,12 +7711,12 @@ MARC21SLIMUTILS </xsl:stylesheet> MARC21SLIM2MODS36 } - SLUB::LZA::SIPBuilderBagIt::write_file($marc_mods_path, $xsl); + write_file($marc_mods_path, $xsl); my $xsl_modified = $xsl; - my $marc_utils_path = SLUB::LZA::SIPBuilderBagIt::check_marc21_utility($xsl_dir, $ua); + my $marc_utils_path = check_marc21_utility($xsl_dir, $ua); $xsl_modified =~ s#$marc_utils_url#$marc_utils_path#g; say "Saving MARC21->MODS xsl to file '$marc_mods_path'"; - SLUB::LZA::SIPBuilderBagIt::write_file($marc_mods_patched_path, $xsl_modified); + write_file($marc_mods_patched_path, $xsl_modified); } return $marc_mods_patched_path; } @@ -7937,10 +7937,13 @@ PATCH my $parser = XML::LibXML->new; my $doc = $parser->parse_file($xml_file); - eval { $schema->validate($doc) }; - die "File rights.xml failed validation: $@" if $@; - - return 1; + my $success = try { $schema->validate($doc); 1 } catch {}; + if ($success) { + return 1; + } else { + die "File rights.xml failed validation: $@"; + }; + return; } @@ -7950,7 +7953,9 @@ package main; #=============================================================================== BEGIN{ + ## 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 @@ -8108,15 +8113,15 @@ if (@addKeyValue) { $key eq 'SLUBArchiv-archivalValueDescription' || $key eq 'SLUBArchiv-rightsVersion'){ confess("Duplicate key $key present at --add_key_value. Notice: $key is reserved by SLUB Dresden."); - SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); } if($key eq 'Bag-Count'){ confess("$key present at --add_key_value. This key is not available due to SLUB spesification."); - SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); } if($key eq 'Bag-Group-Identifier'){ confess("$key present at --add_key_value. This key is not available due to SLUB spesification."); - SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); + print_scalar_data("", "INFO: Read Docu for more information at https://slubarchiv.slub-dresden.de/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/", "", "white"); } push @addBagInfo, {$key => $value}; } @@ -8223,7 +8228,7 @@ Options: -help brief help message -man full documentation - -save_option=<option> save as <copy>, <move>, <replace> + -save_option=<option> save as <copy>, <move>, <replace>, the <copy> option should be prefered -IE_directory=<IE dir> existing IE directory (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) @@ -8241,14 +8246,75 @@ Options: -add_key_value=<"key:value"> optional, can be repeated, additional key value pairs for bag-info.txt =head1 EXAMPLES -# Replace (minimalistic) NOT RECOMMENDED! IF FAILS, "IE" MUST BE MANUAL RESTORED TO THE PREVIOUS STATE!!! -perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=replace --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml -# Copy (minimalistic) -perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=copy --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-02.xml -# Move (minimalistic) NOT RECOMMENDED! IF FAILS, "IE" MUST BE MANUAL RESTORED TO THE PREVIOUS STATE!!! -perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=move --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-03.xml -# Copy -perl -I lib/ bin/slubsipbuilderbagit.pl --save_option=copy --IE_directory=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 --SIP_output_path=/home/bolkun/git/SLUB_SIP_Builder/tmp --ppn=457035137 --SIP_version=v2020.1 --external_id=10008 --external_workflow=kitodo --external_ISIL=DE-14 --external_value_descr="Gesetzlicher Auftrag" --rights_version=1.0 --rights_xml=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/rights/Fallbeispiel-01.xml --add_meta_file=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/meta/lido.xml --add_meta_file=/home/bolkun/git/SLUB_SIP_Builder/export_dir_kitodo/bagit/meta/mods.xml --add_key_value="Author:Lew Nikolajewitsch Tolstoi" --add_key_value="Titel:Krieg und Frieden" --add_key_value="Genre:Roman" + +=head2 Copy (minimalistic) + +perl -I lib/ bin/slubsipbuilderbagit.pl + --save_option=copy + --IE_directory=/IE/git/SLUB_SIP_Builder/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 + --external_value_descr="Gesetzlicher Auftrag" + --rights_version=1.0 + --rights_xml=/metadata/rights/Fallbeispiel-02.xml + +=head2 Copy + +perl -I lib/ bin/slubsipbuilderbagit.pl + --save_option=copy + --IE_directory=/IE/git/SLUB_SIP_Builder/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 + --external_value_descr="Gesetzlicher Auftrag" + --rights_version=1.0 + --rights_xml=/metadata/rights/Fallbeispiel-01.xml + --add_meta_file=/metadata/lido.xml + --add_meta_file=/metadata/mods.xml + --add_key_value="Author:Lew Nikolajewitsch Tolstoi" + --add_key_value="Titel:Krieg und Frieden" + --add_key_value="Genre:Roman" + +=head2 Replace (minimalistic) + +NOT RECOMMENDED! IF FAILS, "IE" MUST BE MANUAL RESTORED TO THE PREVIOUS STATE!!! + +perl -I lib/ bin/slubsipbuilderbagit.pl + --save_option=replace + --IE_directory=/IE/SLUB_SIP_Builder/export_dir_kitodo/bagit/test2 + --ppn=457035137 + --SIP_version=v2020.1 + --external_id=10008 + --external_workflow=kitodo + --external_ISIL=DE-14 + --external_value_descr="Gesetzlicher Auftrag" + --rights_version=1.0 + --rights_xml=/metadata/rights/Fallbeispiel-01.xml + +=head2 Move (minimalistic) + +NOT RECOMMENDED! IF FAILS, "IE" MUST BE MANUAL RESTORED TO THE PREVIOUS STATE!!! + +perl -I lib/ bin/slubsipbuilderbagit.pl + --save_option=move + --IE_directory=/IE/git/SLUB_SIP_Builder/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 + --external_value_descr="Gesetzlicher Auftrag" + --rights_version=1.0 + --rights_xml=/metadata/rights/Fallbeispiel-03.xml + =head1 OPTIONS @@ -8262,6 +8328,7 @@ Print a brief help message and exits. =head1 DESCRIPTION -B<This program> will process the given IE directory, add bibliographic metadata from catalogue with given PICA number and check and create a BagIt directory ready for SLUBarchiv +B<This program> will process the given IE directory, add bibliographic metadata from catalogue with +given PICA number and check and create a BagIt directory ready for SLUBarchiv =cut