You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2010/02/08 20:22:43 UTC

svn commit: r907764 - in /httpd/site/trunk/tools: hash-sign.sh release-fcgid.sh

Author: trawick
Date: Mon Feb  8 19:22:43 2010
New Revision: 907764

URL: http://svn.apache.org/viewvc?rev=907764&view=rev
Log:
add script to create release artifacts for mod_fcgid

shared logic to hash and sign tarballs/zips is in hash-sign.sh
(roll.sh for httpd hasn't been modified to use this)

Added:
    httpd/site/trunk/tools/hash-sign.sh   (with props)
    httpd/site/trunk/tools/release-fcgid.sh   (with props)

Added: httpd/site/trunk/tools/hash-sign.sh
URL: http://svn.apache.org/viewvc/httpd/site/trunk/tools/hash-sign.sh?rev=907764&view=auto
==============================================================================
--- httpd/site/trunk/tools/hash-sign.sh (added)
+++ httpd/site/trunk/tools/hash-sign.sh Mon Feb  8 19:22:43 2010
@@ -0,0 +1,133 @@
+#!/bin/sh
+#
+# hash-sign.sh : hash and sign the specified files
+#
+# USAGE: hash-sign.sh file1 file2 ...
+#
+
+user=""
+case "$1" in
+  -u)
+    shift
+    user="$1"
+    shift
+    ;;
+esac
+
+allfiles=$*
+
+
+split="---------------------------------------------------------------------"
+
+echo $split
+echo ""
+echo "Generating MD5/SHA1 checksum files ..."
+echo ""
+
+# check for executables
+gpg="`which gpg 2> /dev/null | head -1`"
+pgp="`which pgp 2> /dev/null | head -1`"
+openssl="`which openssl 2> /dev/null | head -1`"
+md5sum="`which md5sum 2> /dev/null | head -1`"
+sha1sum="`which sha1sum 2> /dev/null | head -1`"
+md5="`which md5 2> /dev/null | head -1`"
+sha1="`which sha1 2> /dev/null | head -1`"
+
+# if found we use openssl for generating the checksums
+# and convert the results into machine-readable format.
+if test -x "${openssl}"; then
+  for file in ${allfiles}; do
+    if test -f "${file}"; then
+      echo "openssl: creating md5 checksum file for ${file} ..."
+      ${openssl} md5 ${file} |\
+          sed -e 's#^MD5(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.md5
+      echo "openssl: creating sha1 checksum file for ${file} ..."
+      ${openssl} sha1 ${file} |\
+          sed -e 's#^SHA1(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha1
+    fi
+  done
+# no openssl found - check if we have gpg
+elif test -x "${gpg}"; then
+  for file in ${allfiles}; do
+    if test -f "${file}"; then
+      echo "gpg: creating md5 checksum file for ${file} ..."
+      ${gpg} --print-md md5 ${file} |\
+          sed -e '{N;s#\n##;}' |\
+          sed -e 's#\(.*\): \(.*\)#\2::\1#;s#[\r\n]##g;s# ##g' \
+              -e 'y#ABCDEF#abcdef#;s#::# *#' > ${file}.md5
+      echo "gpg: creating sha1 checksum file for ${file} ..."
+      ${gpg} --print-md sha1 ${file} |\
+          sed -e '{N;s#\n##;}' |\
+          sed -e 's#\(.*\): \(.*\)#\2::\1#;s#[\r\n]##g;s# ##g' \
+              -e 'y#ABCDEF#abcdef#;s#::# *#' > ${file}.sha1
+    fi
+  done
+else
+  # no openssl or gpg found - check for md5sum
+  if test -x "${md5sum}"; then
+    for file in ${allfiles}; do
+      if test -f "${file}"; then
+        echo "md5sum: creating md5 checksum file for ${file} ..."
+        ${md5sum} -b ${file} > ${file}.md5
+      fi
+    done
+  # no openssl or gpg found - check for md5
+  elif test -x "${md5}"; then
+    for file in ${allfiles}; do
+      if test -f "${file}"; then
+        echo "md5: creating md5 checksum file for ${file} ..."
+        ${md5} -r ${file} | sed -e 's# # *#' > ${file}.md5
+      fi
+    done
+  fi
+  # no openssl or gpg found - check for sha1sum
+  if test -x "${sha1sum}"; then
+    for file in ${allfiles}; do
+      if test -f "${file}"; then
+        echo "sha1sum: creating sha1 checksum file for ${file} ..."
+        ${sha1sum} -b ${file} > ${file}.sha1
+      fi
+    done
+  # no openssl or gpg found - check for sha1
+  elif test -x "${sha1}"; then
+    for file in ${allfiles}; do
+      if test -f "${file}"; then
+        echo "sha1: creating sha1 checksum file for ${file} ..."
+        ${sha1} -r ${file} | sed -e 's# # *#' > ${file}.sha1
+      fi
+    done
+  fi
+fi
+
+echo $split
+echo ""
+echo "Signing the files ..."
+echo ""
+
+# if found we use pgp for signing the files
+if test -x "${pgp}"; then
+  if test -n "${user}"; then
+    args="-u ${user}"
+  fi
+  for file in ${allfiles}; do
+    if test -f "${file}"; then
+      echo "pgp: creating asc signature file for ${file} ..."
+      ${pgp} -sba ${file} ${args}
+    fi
+  done
+# no pgp found - check for gpg
+elif test -x "${gpg}"; then
+  if test -z "${user}"; then
+    args="--default-key ${args}"
+  else
+    args="-u ${user} ${args}"
+  fi
+  for file in ${allfiles}; do
+    if test -f "${file}"; then
+      echo "gpg: creating asc signature file for ${file} ..."
+      ${gpg} --armor ${args} --detach-sign ${file}
+    fi
+  done
+else
+  echo "PGP or GnuPG not found!  Not signing release!"
+fi

Propchange: httpd/site/trunk/tools/hash-sign.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: httpd/site/trunk/tools/release-fcgid.sh
URL: http://svn.apache.org/viewvc/httpd/site/trunk/tools/release-fcgid.sh?rev=907764&view=auto
==============================================================================
--- httpd/site/trunk/tools/release-fcgid.sh (added)
+++ httpd/site/trunk/tools/release-fcgid.sh Mon Feb  8 19:22:43 2010
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+# release-fcgid.sh : build a mod_fcgid release tarball
+#
+# USAGE: release-fcgid.sh VERSION [SIGNING-USER]
+#
+#   The version number is specified as MAJOR.MINOR.PATCH (and will be used in
+#   the output tarball name). The script will then look for a tag named
+#   "MAJOR.MINOR.PATCH" and export it into a subdirectory (of the current
+#   directory). Next, it will run the appropriate commands to prepare and
+#   construct the tarball. The subdirectory will be cleaned up upon exit.
+#
+#   The "signing user" is the name of the key that you'll be signing the
+#   release with.
+#
+
+HASH_AND_SIGN="`echo $0 | sed 's/release-fcgid.sh$/hash-sign.sh/'`"
+
+project=mod_fcgid
+
+# This forces all exported releases to be on the same timezone
+# when SVN props are used inside files.
+TZ=UTC
+export TZ
+
+SVNHOST=svn.apache.org
+
+if test "$#" != 1 && test "$#" != 2; then
+  echo "USAGE: $0 VERSION [SIGNING-USER]" >&2
+  echo "  see the comments in this script for more info." >&2
+  exit 1
+fi
+
+version="$1"
+user="$2"
+
+major="`echo ${version} | sed 's/\..*$//'`"
+minor="`echo ${version} | sed 's/^[0-9]*\.\([0-9]*\)\..*$/\1/'`"
+patch="`echo ${version} | sed 's/^.*\.//'`"
+
+tagname="${version}"
+
+dirname="`echo ${project} | sed 's/-[0-9]*\.[0-9]*$//'`"
+dirname="${dirname}-${version}"
+
+split="---------------------------------------------------------------------"
+
+echo $split
+echo ""
+
+echo "  Version: ${version}"
+echo " Tag name: ${tagname}"
+echo "Directory: ${dirname}"
+echo ""
+
+if test -d ${dirname}; then
+  echo "ERROR: for safety, you must manually remove ${dirname}." >&2
+  exit 1
+fi
+
+
+# make sure that the perms are good for the tarball
+umask 022
+
+echo $split
+echo ""
+echo "Starting SVN export of ${project} to ${dirname} ..."
+echo ""
+
+svn export https://${SVNHOST}/repos/asf/httpd/mod_fcgid/tags/${tagname} ${dirname} > /dev/null || exit 1
+
+echo $split
+echo ""
+
+echo "Copying CHANGES file"
+echo ""
+
+cp ${dirname}/CHANGES-FCGID CHANGES-FCGID
+
+echo $split
+echo ""
+echo "Building the tarball, .gz, and .bz2 files ..."
+echo ""
+
+tar cf ${dirname}.tar ${dirname}
+gzip -9 --to-stdout ${dirname}.tar > ${dirname}.tar.gz
+bzip2 -9 ${dirname}.tar
+
+rm -r ${dirname}
+
+echo $split
+echo ""
+echo "Re-exporting in CRLF format and creating zip file ..."
+echo ""
+
+svn export --native-eol CRLF https://${SVNHOST}/repos/asf/httpd/mod_fcgid/tags/${tagname} ${dirname} > /dev/null || exit 1
+
+zip -r ${project}-${version}-crlf.zip ${dirname} >/dev/null || exit 1
+
+rm -r ${dirname}
+
+if test -n ${user}; then
+  user_arg="-u ${user}"
+else
+  user_arg=""
+fi
+
+${HASH_AND_SIGN} ${user_arg} ${dirname}.tar.gz ${dirname}.tar.bz2 ${project}-${version}-crlf.zip

Propchange: httpd/site/trunk/tools/release-fcgid.sh
------------------------------------------------------------------------------
    svn:executable = *