You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2017/10/25 07:39:57 UTC

svn commit: r22663 - /dev/jackrabbit/check-release.sh

Author: tripod
Date: Wed Oct 25 07:39:57 2017
New Revision: 22663

Log:
Improve code to work with the 'filevault-plugin' component

Modified:
    dev/jackrabbit/check-release.sh   (contents, props changed)

Modified: dev/jackrabbit/check-release.sh
==============================================================================
--- dev/jackrabbit/check-release.sh (original)
+++ dev/jackrabbit/check-release.sh Wed Oct 25 07:39:57 2017
@@ -20,6 +20,9 @@
 BASEDIR="`dirname "$0"`"
 DEFAULT_PROFILES="pedantic"
 PROFILES=${RUN_PROFILES:-$DEFAULT_PROFILES}
+MVN_ARGS="-P$PROFILES"
+CLEAN_SVN=".??* .gitignore"
+CLEAN_ZIP=""
 
 if [ -z "$1" -o -z "$1" ]; then
   echo "Usage: $0 [component] version checksum"
@@ -37,10 +40,24 @@ else
   COMPONENT="$1"
   VERSION="$2"
   SHA="$3"
-  RCDIR="$COMPONENT/$VERSION"
-  SRCZIP="jackrabbit-$COMPONENT-$VERSION-src.zip"
-  SRCDIR="jackrabbit-$COMPONENT-$VERSION"
-  TAGURL="https://svn.apache.org/repos/asf/jackrabbit/$COMPONENT/tags/jackrabbit-$COMPONENT-$VERSION"
+  case "$COMPONENT" in
+  "filevault-plugin")
+    COMPONENT="filevault-package-maven-plugin"
+    RCDIR="$COMPONENT/$VERSION"
+    SRCZIP="$COMPONENT-$VERSION-source-release.zip"
+    SRCDIR="filevault-package-maven-plugin-$VERSION"
+    TAGURL="https://svn.apache.org/repos/asf/jackrabbit/commons/$COMPONENT/tags/$COMPONENT-$VERSION"
+    MVN_ARGS=""
+    CLEAN_SVN=".gitignore"
+    CLEAN_ZIP="DEPENDENCIES" # the DEPENDENCIES are automatically generated during the release and are not in svn
+    ;;
+  *)
+    RCDIR="$COMPONENT/$VERSION"
+    SRCZIP="jackrabbit-$COMPONENT-$VERSION-src.zip"
+    SRCDIR="jackrabbit-$COMPONENT-$VERSION"
+    TAGURL="https://svn.apache.org/repos/asf/jackrabbit/$COMPONENT/tags/jackrabbit-$COMPONENT-$VERSION"
+    ;;
+  esac
 fi
 
 LOGFILE="$BASEDIR/target/$SRCDIR.log"
@@ -53,6 +70,12 @@ info()
   echo "[INFO] $1"
 }
 
+warn()
+{
+  echo "[WARN] $1" >> "$LOGFILE"
+  echo "[WARN] $1"
+}
+
 error()
 {
   echo "[ERROR] $1" >> "$LOGFILE"
@@ -78,8 +101,8 @@ svn cat https://dist.apache.org/repos/di
 info ""
 info "2. Check for the presence of the staged release candidate"
 info ""
-for NAME in "$SRCZIP" "RELEASE-NOTES.txt"; do
-  if [ -f "$BASEDIR/$RCDIR/$NAME" ]; then
+for NAME in "$SRCZIP" "RELEASE-NOTES.*"; do
+  if compgen -G "$BASEDIR/$RCDIR/$NAME" > /dev/null; then
     info "   OK: $NAME"
   else
     error "  NOT FOUND: $NAME"
@@ -100,28 +123,46 @@ for NAME in `ls "$BASEDIR/$RCDIR" | grep
     error "  NOT OK: $NAME.asc"
   fi
 
-  for HASH in md5 sha1; do
+  SHA_OK=false
+  for HASH in md5 sha sha1 sha512; do
     EXT=$HASH # removed truncation to three characters due to sha1 name change
+    case "$HASH" in 
+      "sha")     ALG="sha1" ;;
+      "sha-512") ALG="sha -sha512" ;;
+      *)         ALG="$HASH" ;;
+    esac
     if [ ! -f "$BASEDIR/$RCDIR/$NAME.$EXT" ]; then
-      error "  NOT FOUND: $NAME.$EXT"
+      warn "  NOT FOUND: $NAME.$EXT"
     else
-      EXPECTED="`openssl "$HASH" "$BASEDIR/$RCDIR/$NAME" 2>> "$LOGFILE" | sed 's/.*= *//'`"
+      EXPECTED="`openssl "$ALG" "$BASEDIR/$RCDIR/$NAME" 2>> "$LOGFILE" | sed 's/.*= *//'`"
       if grep -q "$EXPECTED" "$BASEDIR/$RCDIR/$NAME.$EXT"; then
         info "   OK: $NAME.$EXT"
+        if [[ $HASH == "sha"* ]]; then
+          SHA_OK=true
+        fi
       else
         error "  NOT OK: $NAME.$EXT (expected $EXPECTED)"
       fi
     fi
   done
+  if ! $SHA_OK; then 
+    error "  No SHA checksum found."
+  fi
 done
 
 info ""
 info "4. Compare provided SHA1 checksum with that of the release"
 info ""
-if grep -q "$SHA" "$BASEDIR/$RCDIR/$SRCZIP.sha1"; then
-  info "   OK: $SHA"
+SHA_OK=false
+for HASH in sha sha1 sha512; do
+  if grep -q "$SHA" "$BASEDIR/$RCDIR/$SRCZIP.$HASH" 2>> "$LOGFILE" 1>&2; then
+    SHA_OK=true
+  fi
+done
+if $SHA_OK; then 
+    info "   OK: $SHA"
 else
-  error "  NOT OK: $SHA"
+    error "  NOT OK: $SHA"
 fi
 
 info ""
@@ -133,30 +174,42 @@ test -e "$WORKDIR" && rm -rf "$WORKDIR"
 mkdir -p "$WORKDIR/svn"
 SVNDIR="$WORKDIR/svn/$SRCDIR"
 svn --quiet export "$TAGURL" "$SVNDIR" 2>> "$LOGFILE" 1>&2 || exit 1
-find "$SVNDIR" -name ".??*" -print0 | xargs -0 rm -rf
+for PATTERN in $CLEAN_SVN; do
+  echo "Cleaning $PATTERN from svn" >> "$LOGFILE"
+  find "$SVNDIR" -name "$PATTERN" -print0 | xargs -0 rm -rf
+done
 info "   Unzipping $SRCZIP..."
 ZIPDIR="$WORKDIR/zip/$SRCDIR"
 unzip -q "$BASEDIR/$RCDIR/$SRCZIP" -d "$WORKDIR/zip" 2>> "$LOGFILE" 1>&2 || exit 1
+for PATTERN in $CLEAN_ZIP; do
+  echo "Cleaning $PATTERN from zip" >> "$LOGFILE"
+  find "$ZIPDIR" -name "$PATTERN" -print0 | xargs -0 rm -rf
+done
+
+# diff fails if either the dirs don't exist, or if the dirs differs
+# so we need to be sure that the diff actually diffed something.
 info "   Comparing sources..."
 info ""
 DIFFOUT="$WORKDIR/diff-output.txt"
-diff -b -r "$SVNDIR" "$ZIPDIR" > "$DIFFOUT" 2>> "$LOGFILE"
-if [ -s "$DIFFOUT" ]; then
-  cat "$DIFFOUT" >> "$LOGFILE"
-  error "  NOT OK: Tagged sources are different from those in the archive"
-else
-  info "   OK: No differences found"
+if ! diff -b -r "$SVNDIR" "$ZIPDIR" > "$DIFFOUT" 2>> "$LOGFILE"; then
+  if [ -s "$DIFFOUT" ]; then
+    cat "$DIFFOUT" >> "$LOGFILE"
+    error "  NOT OK: Tagged sources are different from those in the archive"
+  else
+    error "  NOT OK: diff failed. see $LOGFILE for"
+  fi
 fi
+info "   OK: No differences found"
 
 info ""
 info "6. Build the release candidate"
 info ""
-info "   Running the Maven build: mvn verify -P $PROFILES"
+info "   Running the Maven build: mvn clean verify $MVN_ARGS"
 info ""
-if (cd $ZIPDIR; exec mvn verify -P "$PROFILES") 2>> "$LOGFILE" 1>&2; then
-  info "   OK: mvn verify -P $PROFILES"
+if (cd $ZIPDIR; exec mvn clean verify $MVN_ARGS) 2>> "$LOGFILE" 1>&2; then
+  info "   OK: mvn clean verify $MVN_ARGS"
 else
-  error "  NOT OK: mvn verify -P $PROFILES"
+  error "  NOT OK: mvn clean verify $MVN_ARGS"
 fi
 info ""
 

Propchange: dev/jackrabbit/check-release.sh
------------------------------------------------------------------------------
    svn:executable = *