X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcommon-variables.sh;h=6a5d2fb098a88c20703f18593e6805bed6162751;hb=6eefde1f463638b5021c2ec96eb67a017d379f1f;hp=deb105891fa06bbf0860d245ef1d7da49ac38def;hpb=757650c835599c0aa4fe62ed99f05eab324c6f37;p=releng%2Fglobal-jjb.git diff --git a/shell/common-variables.sh b/shell/common-variables.sh index deb10589..6a5d2fb0 100644 --- a/shell/common-variables.sh +++ b/shell/common-variables.sh @@ -29,63 +29,3 @@ lftools_activate() { source "/tmp/v/lftools/bin/activate" set -u # Restore unbound variable checking } - -# Check maven-metadata.xml for any unexpected timestamp mismatches -maven_metadata_validate() { - stage_dir="$1" - - if [ -z "$1" ]; then - echo "Usage: maven_metadata_validate STAGE_REPO_DIR" - exit 1 - fi - - error_detected=0 - mapfile -t files < <(find "$stage_dir" -name maven-metadata.xml | grep SNAPSHOT) - - for f in "${files[@]}"; do - timestamp=$(xmlstarlet sel \ - -t -v "/metadata/versioning/snapshot/timestamp" "$f") - - # Scan all snapshot versions but ignore javadoc and source jars - mapfile -t ext_timestamps < <(xmlstarlet sel \ - -t -m "/metadata/versioning/snapshotVersions/snapshotVersion" \ - -n \ - --if "classifier='javadoc'" \ - -o "" \ - --elif "classifier='sources'" \ - -o "" \ - --else \ - -o "extension:" -v extension \ - -o " value:" -v value \ - -o " updated:" -v updated \ - "$f") - - for t in "${ext_timestamps[@]}"; do - # Ignore blank timestamps caused by xmlstarlet ignores - if [[ -z "$t" ]]; then - continue - fi - - timestamp_error=0 - if [[ $t != *"$timestamp"* ]]; then - echo "Metadata $f 'value:$timestamp' mismatch vs '$t'" - timestamp_error=1 - fi - # Updated is timestamp without the dot character - if [[ $t != *"${timestamp//\./}"* ]]; then - echo "Metadata $f 'updated:${timestamp//\./}' mismatch vs '$t'" - timestamp_error=1 - fi - - if [[ $timestamp_error != 0 ]]; then - error_detected=1 - cat "$f" - fi - done - done - - if [ $error_detected -ne 0 ]; then - echo "ERROR: Mismatches in maven-metadata discovered. Quitting..." - exit 1 - fi -}