|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +testRoot="test-root" |
| 4 | +paramCandidateVersion="" |
| 5 | +paramBaselineVersion="" |
| 6 | +baselineRoot="${testRoot}/baselines" |
| 7 | +candidateRoot="${testRoot}/candidates" |
| 8 | +targetRoot="${testRoot}/targets" |
| 9 | +# Check the passed params to avoid disapointment |
| 10 | +checkParams () { |
| 11 | + OPTIND=1 # Reset in case getopts previously used |
| 12 | + |
| 13 | + while getopts "h?b:c:" opt; do # Grab the options |
| 14 | + case "$opt" in |
| 15 | + h|\?) |
| 16 | + showHelp |
| 17 | + exit 0 |
| 18 | + ;; |
| 19 | + b) paramBaselineVersion=$OPTARG |
| 20 | + ;; |
| 21 | + c) paramCandidateVersion=$OPTARG |
| 22 | + ;; |
| 23 | + esac |
| 24 | + done |
| 25 | + |
| 26 | + if [ -z "$paramBaselineVersion" ] || [ -z "$paramCandidateVersion" ] |
| 27 | + then |
| 28 | + showHelp |
| 29 | + exit 0 |
| 30 | + fi |
| 31 | + |
| 32 | + baselineRoot="${baselineRoot}/${paramBaselineVersion}" |
| 33 | + candidateRoot="${candidateRoot}/${paramCandidateVersion}" |
| 34 | + targetRoot="${targetRoot}/${paramCandidateVersion}" |
| 35 | +} |
| 36 | + |
| 37 | +# Show usage message |
| 38 | +showHelp() { |
| 39 | + echo "usage: create-target [-b <baselineVersion>] [-c <candidateVersion>] [-h|?]" |
| 40 | + echo "" |
| 41 | + echo " baselineVersion : The version number id for the baseline data." |
| 42 | + echo " candidateVersion : The version number id for the candidate data." |
| 43 | + echo "" |
| 44 | + echo " -h|? : This message." |
| 45 | +} |
| 46 | + |
| 47 | +# Execution starts here |
| 48 | +checkParams "$@"; |
| 49 | +if [[ -d "${targetRoot}" ]]; then |
| 50 | + echo " - removing existing baseline at ${targetRoot}." |
| 51 | + rm -rf "${targetRoot}" |
| 52 | +fi |
| 53 | + |
| 54 | +echo "TEST BASELINE: Creating baseline" |
| 55 | +# Simply copy baseline for now we're not making any changes |
| 56 | +echo " - copying ${baselineRoot} baseline to ${targetRoot}" |
| 57 | +cp -R "${baselineRoot}" "${targetRoot}" |
| 58 | + |
| 59 | +# Patch release details of the reporting module in the audit file |
| 60 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/outputHandler release="1.11">XML/outputHandler release="1.12">XML/' {} \; |
| 61 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/outputHandler release="1.2">JSON/outputHandler release="1.3">JSON/' {} \; |
| 62 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/outputHandler release="1.6">TEXT/outputHandler release="1.7">TEXT/' {} \; |
| 63 | + |
| 64 | +# Update release details for HTML module |
| 65 | +find "${targetRoot}" -type f -name "*.html.jhove.xml" -exec sed -i 's/<reportingModule release="1.4.3" date="2023-03-16">HTML-hul<\/reportingModule>/<reportingModule release="1.4.4" date="2024-08-22">HTML-hul<\/reportingModule>/' {} \; |
| 66 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/<module release="1.4.3">HTML-hul<\/module>/<module release="1.4.4">HTML-hul<\/module>/' {} \; |
| 67 | +find "${targetRoot}" -type f -name "audit-HTML-hul.jhove.xml" -exec sed -i 's/<release>1.4.3<\/release>/<release>1.4.4<\/release>/' {} \; |
| 68 | +find "${targetRoot}" -type f -name "audit-HTML-hul.jhove.xml" -exec sed -i 's/2023-03-16/2024-08-22/' {} \; |
| 69 | + |
| 70 | +# Update release details for PDF module |
| 71 | +find "${targetRoot}" -type f -name "*.pdf.jhove.xml" -exec sed -i 's/<reportingModule release="1.12.6" date="2024-07-31">PDF-hul<\/reportingModule>/<reportingModule release="1.12.7" date="2024-08-22">PDF-hul<\/reportingModule>/' {} \; |
| 72 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/<module release="1.12.6">PDF-hul<\/module>/<module release="1.12.7">PDF-hul<\/module>/' {} \; |
| 73 | +find "${targetRoot}" -type f -name "audit-PDF-hul.jhove.xml" -exec sed -i 's/<release>1.12.6<\/release>/<release>1.12.7<\/release>/' {} \; |
| 74 | +find "${targetRoot}" -type f -name "audit-PDF-hul.jhove.xml" -exec sed -i 's/2024-07-31/2024-08-22/' {} \; |
| 75 | + |
| 76 | +# Update release details for TIFF module |
| 77 | +find "${targetRoot}" -type f -name "*.tiff.jhove.xml" -exec sed -i 's/<reportingModule release="1.9.4" date="2023-03-16">TIFF-hul<\/reportingModule>/<reportingModule release="1.9.5" date="2024-08-22">TIFF-hul<\/reportingModule>/' {} \; |
| 78 | +find "${targetRoot}" -type f -name "*.tif.jhove.xml" -exec sed -i 's/<reportingModule release="1.9.4" date="2023-03-16">TIFF-hul<\/reportingModule>/<reportingModule release="1.9.5" date="2024-08-22">TIFF-hul<\/reportingModule>/' {} \; |
| 79 | +find "${targetRoot}" -type f -name "*.g3.jhove.xml" -exec sed -i 's/<reportingModule release="1.9.4" date="2023-03-16">TIFF-hul<\/reportingModule>/<reportingModule release="1.9.5" date="2024-08-22">TIFF-hul<\/reportingModule>/' {} \; |
| 80 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/<module release="1.9.4">TIFF-hul<\/module>/<module release="1.9.5">TIFF-hul<\/module>/' {} \; |
| 81 | +find "${targetRoot}" -type f -name "audit-TIFF-hul.jhove.xml" -exec sed -i 's/<release>1.9.4<\/release>/<release>1.9.5<\/release>/' {} \; |
| 82 | +find "${targetRoot}" -type f -name "audit-TIFF-hul.jhove.xml" -exec sed -i 's/2023-03-16/2024-08-22/' {} \; |
| 83 | + |
| 84 | +# Update release details for XML module |
| 85 | +find "${targetRoot}" -type f -name "*.xml.jhove.xml" -exec sed -i 's/<reportingModule release="1.5.4" date="2024-03-05">XML-hul<\/reportingModule>/<reportingModule release="1.5.5" date="2024-08-22">XML-hul<\/reportingModule>/' {} \; |
| 86 | +find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/<module release="1.5.4">XML-hul<\/module>/<module release="1.5.5">XML-hul<\/module>/' {} \; |
| 87 | +find "${targetRoot}" -type f -name "audit-XML-hul.jhove.xml" -exec sed -i 's/<release>1.5.4<\/release>/<release>1.5.5<\/release>/' {} \; |
| 88 | +find "${targetRoot}" -type f -name "audit-XML-hul.jhove.xml" -exec sed -i 's/2024-03-05/2024-08-22/' {} \; |
| 89 | + |
| 90 | +# Copy the TIFF Module results changed by https://github.com/openpreserve/jhove/pull/915 |
| 91 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/AA_Banner.tif.jhove.xml" ]]; then |
| 92 | + cp "${candidateRoot}/examples/modules/TIFF-hul/AA_Banner.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/AA_Banner.tif.jhove.xml" |
| 93 | +fi |
| 94 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/strike.tif.jhove.xml" ]]; then |
| 95 | + cp "${candidateRoot}/examples/modules/TIFF-hul/strike.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/strike.tif.jhove.xml" |
| 96 | +fi |
| 97 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/testpage-large.tif.jhove.xml" ]]; then |
| 98 | + cp "${candidateRoot}/examples/modules/TIFF-hul/testpage-large.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/testpage-large.tif.jhove.xml" |
| 99 | +fi |
| 100 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/testpage-medium.tif.jhove.xml" ]]; then |
| 101 | + cp "${candidateRoot}/examples/modules/TIFF-hul/testpage-medium.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/testpage-medium.tif.jhove.xml" |
| 102 | +fi |
| 103 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/oxford.tif.jhove.xml" ]]; then |
| 104 | + cp "${candidateRoot}/examples/modules/TIFF-hul/oxford.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/oxford.tif.jhove.xml" |
| 105 | +fi |
| 106 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/jim___gg.tif.jhove.xml" ]]; then |
| 107 | + cp "${candidateRoot}/examples/modules/TIFF-hul/jim___gg.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/jim___gg.tif.jhove.xml" |
| 108 | +fi |
| 109 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/bathy1.tif.jhove.xml" ]]; then |
| 110 | + cp "${candidateRoot}/examples/modules/TIFF-hul/bathy1.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/bathy1.tif.jhove.xml" |
| 111 | +fi |
| 112 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/jim___cg.tif.jhove.xml" ]]; then |
| 113 | + cp "${candidateRoot}/examples/modules/TIFF-hul/jim___cg.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/jim___cg.tif.jhove.xml" |
| 114 | +fi |
| 115 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/quad-tile.tif.jhove.xml" ]]; then |
| 116 | + cp "${candidateRoot}/examples/modules/TIFF-hul/quad-tile.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/quad-tile.tif.jhove.xml" |
| 117 | +fi |
| 118 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/compos.tif.jhove.xml" ]]; then |
| 119 | + cp "${candidateRoot}/examples/modules/TIFF-hul/compos.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/compos.tif.jhove.xml" |
| 120 | +fi |
| 121 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/pagemaker.tif.jhove.xml" ]]; then |
| 122 | + cp "${candidateRoot}/examples/modules/TIFF-hul/pagemaker.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/pagemaker.tif.jhove.xml" |
| 123 | +fi |
| 124 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/jello.tif.jhove.xml" ]]; then |
| 125 | + cp "${candidateRoot}/examples/modules/TIFF-hul/jello.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/jello.tif.jhove.xml" |
| 126 | +fi |
| 127 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/little-endian.tif.jhove.xml" ]]; then |
| 128 | + cp "${candidateRoot}/examples/modules/TIFF-hul/little-endian.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/little-endian.tif.jhove.xml" |
| 129 | +fi |
| 130 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/cramps-tile.tif.jhove.xml" ]]; then |
| 131 | + cp "${candidateRoot}/examples/modules/TIFF-hul/cramps-tile.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/cramps-tile.tif.jhove.xml" |
| 132 | +fi |
| 133 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/jim___ah.tif.jhove.xml" ]]; then |
| 134 | + cp "${candidateRoot}/examples/modules/TIFF-hul/jim___ah.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/jim___ah.tif.jhove.xml" |
| 135 | +fi |
| 136 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/g3test.tif.jhove.xml" ]]; then |
| 137 | + cp "${candidateRoot}/examples/modules/TIFF-hul/g3test.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/g3test.tif.jhove.xml" |
| 138 | +fi |
| 139 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/6mp_soft.tif.jhove.xml" ]]; then |
| 140 | + cp "${candidateRoot}/examples/modules/TIFF-hul/6mp_soft.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/6mp_soft.tif.jhove.xml" |
| 141 | +fi |
| 142 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/ycbcr-cat.tif.jhove.xml" ]]; then |
| 143 | + cp "${candidateRoot}/examples/modules/TIFF-hul/ycbcr-cat.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/ycbcr-cat.tif.jhove.xml" |
| 144 | +fi |
| 145 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/quad-lzw.tif.jhove.xml" ]]; then |
| 146 | + cp "${candidateRoot}/examples/modules/TIFF-hul/quad-lzw.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/quad-lzw.tif.jhove.xml" |
| 147 | +fi |
| 148 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/jim___dg.tif.jhove.xml" ]]; then |
| 149 | + cp "${candidateRoot}/examples/modules/TIFF-hul/jim___dg.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/jim___dg.tif.jhove.xml" |
| 150 | +fi |
| 151 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/fax2d.tif.jhove.xml" ]]; then |
| 152 | + cp "${candidateRoot}/examples/modules/TIFF-hul/fax2d.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/fax2d.tif.jhove.xml" |
| 153 | +fi |
| 154 | +if [[ -f "${candidateRoot}/examples/modules/TIFF-hul/peppers.tif.jhove.xml" ]]; then |
| 155 | + cp "${candidateRoot}/examples/modules/TIFF-hul/peppers.tif.jhove.xml" "${targetRoot}/examples/modules/TIFF-hul/peppers.tif.jhove.xml" |
| 156 | +fi |
| 157 | + |
| 158 | +# Copy the TIFF fix affected files from the candidate to the target |
| 159 | +declare -a tiff_affected=("examples/modules/TIFF-hul/cramps.tif.jhove.xml" |
| 160 | + "examples/modules/TIFF-hul/text.tif.jhove.xml" |
| 161 | + "examples/modules/TIFF-hul/testpage-small.tif.jhove.xml") |
| 162 | +for filename in "${tiff_affected[@]}" |
| 163 | +do |
| 164 | + if [[ -f "${candidateRoot}/${filename}" ]]; then |
| 165 | + cp "${candidateRoot}/${filename}" "${targetRoot}/${filename}" |
| 166 | + fi |
| 167 | +done |
| 168 | + |
| 169 | +# Copy the XHTML fix affected files from the candidate to the target |
| 170 | +declare -a xhtml_affected=("errors/modules/HTML-hul/xhtml-trans-no-xml-dec.html.jhove.xml" |
| 171 | + "errors/modules/HTML-hul/xhtml-strict-no-xml-dec.html.jhove.xml" |
| 172 | + "errors/modules/HTML-hul/xhtml-frames-no-xml-dec.html.jhove.xml" |
| 173 | + "errors/modules/HTML-hul/xhtml-1-1-no-xml-dec.html.jhove.xml") |
| 174 | +for filename in "${xhtml_affected[@]}" |
| 175 | +do |
| 176 | + if [[ -f "${candidateRoot}/${filename}" ]]; then |
| 177 | + cp "${candidateRoot}/${filename}" "${targetRoot}/${filename}" |
| 178 | + fi |
| 179 | +done |
| 180 | + |
| 181 | +# Copy the XML fix affected files from the candidate to the target |
| 182 | +declare -a xhtml_affected=("errors/modules/HTML-hul/xhtml-trans-xml-dec.html.jhove.xml" |
| 183 | + "errors/modules/HTML-hul/xhtml-strict-xml-dec.html.jhove.xml" |
| 184 | + "errors/modules/HTML-hul/xhtml-frames-xml-dec.html.jhove.xml" |
| 185 | + "errors/modules/HTML-hul/xhtml-1-1-xml-dec.html.jhove.xml" |
| 186 | + "examples/modules/XML-hul/valid-external.dtd.jhove.xml" |
| 187 | + "examples/modules/XML-hul/external-unparsed-entity.ent.jhove.xml" |
| 188 | + "examples/modules/XML-hul/external-parsed-entity.ent.jhove.xml") |
| 189 | +for filename in "${xhtml_affected[@]}" |
| 190 | +do |
| 191 | + if [[ -f "${candidateRoot}/${filename}" ]]; then |
| 192 | + cp "${candidateRoot}/${filename}" "${targetRoot}/${filename}" |
| 193 | + fi |
| 194 | +done |
| 195 | + |
| 196 | +# Copy all of the AIF and WAV results as these are changed by the AES schema changes |
| 197 | +cp -rf "${candidateRoot}/examples/modules/AIFF-hul" "${targetRoot}/examples/modules/" |
| 198 | +cp -rf "${candidateRoot}/examples/modules/WAVE-hul" "${targetRoot}/examples/modules/" |
| 199 | +cp -rf "${candidateRoot}/errors/modules/WAVE-hul" "${targetRoot}/errors/modules/" |
| 200 | + |
| 201 | +# Copy the results of the new XML fixes for multiple redirect lookups and to ensure no regression for repeat XML warnings |
| 202 | +cp -rf "${candidateRoot}/errors/modules/XML-hul" "${targetRoot}/errors/modules/" |
| 203 | + |
| 204 | +# Copy the results of the PDF offset message fix |
| 205 | +declare -a pdf_offset_affected=("errors/modules/PDF-hul/pdf-hul-5-govdocs-659152.pdf.jhove.xml" |
| 206 | + "errors/modules/PDF-hul/pdf-hul-10-govdocs-803945.pdf.jhove.xml" |
| 207 | + "regression/modules/PDF-hul/issue_306.pdf.jhove.xml") |
| 208 | +for filename in "${pdf_offset_affected[@]}" |
| 209 | +do |
| 210 | + if [[ -f "${candidateRoot}/${filename}" ]]; then |
| 211 | + cp "${candidateRoot}/${filename}" "${targetRoot}/${filename}" |
| 212 | + fi |
| 213 | +done |
0 commit comments