Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 63490 invoked from network); 24 Jan 2010 23:35:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jan 2010 23:35:24 -0000 Received: (qmail 57561 invoked by uid 500); 24 Jan 2010 23:35:23 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 57476 invoked by uid 500); 24 Jan 2010 23:35:23 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 57467 invoked by uid 99); 24 Jan 2010 23:35:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Jan 2010 23:35:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Jan 2010 23:35:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CC66E23889B9; Sun, 24 Jan 2010 23:34:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r902677 - /apr/site/trunk/dist/tools/release.sh Date: Sun, 24 Jan 2010 23:34:59 -0000 To: commits@apr.apache.org From: fuankg@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100124233459.CC66E23889B9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fuankg Date: Sun Jan 24 23:34:59 2010 New Revision: 902677 URL: http://svn.apache.org/viewvc?rev=902677&view=rev Log: Modified checksum file generation to match same format/logic as we now use with httpd. Modified: apr/site/trunk/dist/tools/release.sh Modified: apr/site/trunk/dist/tools/release.sh URL: http://svn.apache.org/viewvc/apr/site/trunk/dist/tools/release.sh?rev=902677&r1=902676&r2=902677&view=diff ============================================================================== --- apr/site/trunk/dist/tools/release.sh (original) +++ apr/site/trunk/dist/tools/release.sh Sun Jan 24 23:34:59 2010 @@ -143,39 +143,114 @@ 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`" + +set -- ${dirname}.tar.gz ${dirname}.tar.bz2 ${dirname}.zip +# if found we use openssl for generating the checksums +# and convert the results into machine-readable format. +if test -x "${openssl}"; then + for file; 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; 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; 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; 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; 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; 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 "Cleaning up and signing the files ..." echo "" rm -rf ${dirname} rm -rf ${dirname}-win32 -ARCH_FORMATS="tar.gz tar.bz2 zip" - -if test -x "`which pgp 2> /dev/null`"; then - if test -n "$SIGNING_USER"; then - user="-u $SIGNING_USER" +# if found we use pgp for signing the files +if test -x "${pgp}"; then + if test -n "${SIGNING_USER}"; then + args="-u ${SIGNING_USER}" fi - - for x in ${ARCH_FORMATS} - do - pgp -sba ${dirname}.${x} ${user} + for file; do + if test -f "${file}"; then + echo "pgp: creating asc signature file for ${file} ..." + ${pgp} -sba ${file} ${args} + fi done - - if test -x "`which md5sum 2> /dev/null`"; then - for x in ${ARCH_FORMATS} - do - md5sum ${dirname}.${x} > ${dirname}.tar.gz.md5 - done +# no pgp found - check for gpg +elif test -x "${gpg}"; then + if test -n "${SIGNING_USER}"; then + args="--default-key ${SIGNING_USER}" fi -elif test -x "`which gpg 2> /dev/null`"; then - if test -n "$SIGNING_USER"; then - user="--default-key $SIGNING_USER" - fi - - for x in ${ARCH_FORMATS} - do - gpg --armor ${user} --detach-sign ${dirname}.${x} - gpg --print-md md5 ${dirname}.${x} > ${dirname}.${x}.md5 + for file; 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!"