jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r23033 - /dev/jackrabbit/check-release.sh
Date Fri, 10 Nov 2017 02:59:48 GMT
Author: tripod
Date: Fri Nov 10 02:59:47 2017
New Revision: 23033

Log:
Adding support for filevault and filevault-plugin components

(tested that oak release check still works w/o warnings)

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 Fri Nov 10 02:59:47 2017
@@ -20,6 +20,10 @@
 BASEDIR="`dirname "$0"`"
 DEFAULT_PROFILES="pedantic"
 PROFILES=${RUN_PROFILES:-$DEFAULT_PROFILES}
+MVN_ARGS="-P$PROFILES"
+CLEAN_SVN=".??* .gitignore"
+HASHES="md5 sha1"
+CLEAN_ZIP=""
 
 if [ -z "$1" -o -z "$1" ]; then
   echo "Usage: $0 [component] version checksum"
@@ -37,10 +41,36 @@ 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"
+      HASHES="md5 sha512"
+      CLEAN_ZIP="DEPENDENCIES" # the DEPENDENCIES are automatically generated during the
release and are not in svn
+    ;;
+    "filevault")
+      COMPONENT="jackrabbit-filevault"
+      RCDIR="filevault/$VERSION"
+      SRCZIP="$COMPONENT-$VERSION-src.zip"
+      SRCDIR="$COMPONENT-$VERSION"
+      TAGURL="https://svn.apache.org/repos/asf/jackrabbit/commons/filevault/tags/$COMPONENT-$VERSION"
+      MVN_ARGS=""
+      CLEAN_SVN=""
+      CLEAN_ZIP=""
+      HASHES="md5 sha1 sha512"
+    ;;
+  *)
+    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 +83,12 @@ info()
   echo "[INFO] $1"
 }
 
+warn()
+{
+  echo "[WARN] $1" >> "$LOGFILE"
+  echo "[WARN] $1"
+}
+
 error()
 {
   echo "[ERROR] $1" >> "$LOGFILE"
@@ -78,8 +114,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"
@@ -89,6 +125,28 @@ done
 info ""
 info "3. Verify checksums and signatures"
 
+# usage: verify_checksum NAME EXT
+verify_checksum() {
+    NAME=$1
+    EXT=$2
+    if [ ! -f "$BASEDIR/$RCDIR/$NAME.$EXT" ]; then
+      error "  NOT FOUND: $NAME.$EXT"
+    fi
+
+    case "$EXT" in
+      "sha")     ALG="sha1" ;;
+      "sha-512") ALG="sha -sha512" ;;
+      *)         ALG="$HASH" ;;
+    esac
+
+    EXPECTED="`openssl "$ALG" "$BASEDIR/$RCDIR/$NAME" 2>> "$LOGFILE" | sed 's/.*= *//'`"
+    if grep -q "$EXPECTED" "$BASEDIR/$RCDIR/$NAME.$EXT"; then
+        info "   OK: $NAME.$EXT"
+    else
+        error "  NOT OK: $NAME.$EXT (expected $EXPECTED)"
+    fi
+}
+
 for NAME in `ls "$BASEDIR/$RCDIR" | grep '\.\(zip\|.ar\)$'`; do
   info ""
   info "   Verifying $NAME..."
@@ -100,28 +158,24 @@ for NAME in `ls "$BASEDIR/$RCDIR" | grep
     error "  NOT OK: $NAME.asc"
   fi
 
-  for HASH in md5 sha1; do
-    EXT=$HASH # removed truncation to three characters due to sha1 name change
-    if [ ! -f "$BASEDIR/$RCDIR/$NAME.$EXT" ]; then
-      error "  NOT FOUND: $NAME.$EXT"
-    else
-      EXPECTED="`openssl "$HASH" "$BASEDIR/$RCDIR/$NAME" 2>> "$LOGFILE" | sed 's/.*=
*//'`"
-      if grep -q "$EXPECTED" "$BASEDIR/$RCDIR/$NAME.$EXT"; then
-        info "   OK: $NAME.$EXT"
-      else
-        error "  NOT OK: $NAME.$EXT (expected $EXPECTED)"
-      fi
-    fi
+  for EXT in $HASHES; do
+    verify_checksum $NAME $EXT
   done
 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 +187,45 @@ 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
+set -f # disable globbing during pattern loop
+for PATTERN in $CLEAN_SVN; do
+  echo "Cleaning $PATTERN from $SVNDIR" >> "$LOGFILE"
+  find "$SVNDIR" -name "$PATTERN" -print0 | xargs -0 rm -rfv >> "$LOGFILE"
+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
+set +f # re-enable globbing
+
+# 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 = *



Mime
View raw message