You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2021/09/03 09:17:58 UTC

svn commit: r1892847 - in /httpd/dev-tools/v2: README common-lib.sh make-tars.sh

Author: icing
Date: Fri Sep  3 09:17:57 2021
New Revision: 1892847

URL: http://svn.apache.org/viewvc?rev=1892847&view=rev
Log:
 * more things in common-lib.sh
 * cleanup, separating httpd specific stuff, small fixes


Modified:
    httpd/dev-tools/v2/README
    httpd/dev-tools/v2/common-lib.sh
    httpd/dev-tools/v2/make-tars.sh

Modified: httpd/dev-tools/v2/README
URL: http://svn.apache.org/viewvc/httpd/dev-tools/v2/README?rev=1892847&r1=1892846&r2=1892847&view=diff
==============================================================================
--- httpd/dev-tools/v2/README (original)
+++ httpd/dev-tools/v2/README Fri Sep  3 09:17:57 2021
@@ -1,6 +1,6 @@
 version2 of release scripts
 
-WARNIGN: work in progress!
+WARNING: work in progress!
 
 Usage:
 0. A good, stable local checkout:

Modified: httpd/dev-tools/v2/common-lib.sh
URL: http://svn.apache.org/viewvc/httpd/dev-tools/v2/common-lib.sh?rev=1892847&r1=1892846&r2=1892847&view=diff
==============================================================================
--- httpd/dev-tools/v2/common-lib.sh (original)
+++ httpd/dev-tools/v2/common-lib.sh Fri Sep  3 09:17:57 2021
@@ -171,5 +171,133 @@ check_autotools() {
   fi
 
   echo "check: libtool version $lt_pversion (ok)"
+}
 
+create_dist_checksums() {
+  if ! openssl version >/dev/null; then
+    fail "unable to find 'openssl' in path"
+  fi
+  for file in "$@"; do
+    echo " - create checksums for ${file}"
+    openssl md5 ${file} | sed -e 's#^MD5(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.md5
+    openssl sha1 ${file} | sed -e 's#^SHA1(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha1
+    openssl sha256 ${file} | sed -e 's#^SHA256(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha256
+    openssl sha512 ${file} | sed -e 's#^SHA512(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha512
+  done
+}
+
+sign_dist_files() {
+  signing_user="$1"; shift
+
+  # check for executables
+  gpg2="`which gpg2 2> /dev/null | head -1`"
+  gpg="`which gpg 2> /dev/null | head -1`"
+  pgp="`which pgp 2> /dev/null | head -1`"
+
+  # there are 3 possible ways to sign, check in preference
+  if test -x "${gpg2}"; then
+    if test -z "${signing_user}"; then
+      args="--default-key"
+    else
+      args="-u ${signing_user}"
+    fi
+    for file in "$@"; do
+      echo " - gpg2: creating asc signature file for ${file} ..."
+      ${gpg2} --armor ${args} --detach-sign ${file}
+    done
+  elif test -x "${gpg}"; then
+    args=""
+    if test -n "${signing_user}"; then
+      args="-u ${signing_useruser}"
+    fi
+    for file in "$@"; do
+      echo " - gpg: creating asc signature file for ${file} ..."
+      ${gpg} --armor ${args} --detach-sign ${file}
+    done
+  elif test -x "${pgp}"; then
+    args=""
+    if test -n "${signing_user}"; then
+      args="-u ${signing_user}"
+    fi
+    for file in "$@"; do
+      echo " - pgp: creating asc signature file for ${file} ..."
+      ${pgp} -sba ${file} ${args}
+    done
+  else
+    fail "neither PGP nor GnuPG found! Not signing release!"
+  fi
+}
+
+export_httpd_srclib() {
+  apr_tag="$1"
+  apu_tag="$2"
+  export_dir="$3"
+  test -d "$export_dir" || fail "not a directory: $export_dir"
+
+  if test -z "$apr_tag" -o -z "$apu_tag"; then
+    if ! curl --version >/dev/null 2>&1;then
+      fail "curl must be available to retrieve the latest apr versions."
+    fi
+
+    if test "`echo 'test-1.2.3' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'`" != "1.2.3";then
+      fail "your system must support 'grep -o' to retrieve the latest apr versions."
+    fi
+  fi
+
+  SVNHOST=svn.apache.org
+  download_url="https://apr.apache.org/download.cgi"
+  echo "Determining latest APR and APU versions from $download_url..."
+
+  if test -z "$apr_tag"; then
+    apr_tag=`curl -s $download_url | grep 'APR [0-9].*is the best available version' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'`
+    if test -z "$apr_tag"; then
+      fail "failed to determine latest APR version from $download_url"
+    else
+      echo "  APR: $apr_tag"
+    fi
+  fi
+
+  if test -z "$apu_tag"; then
+    apu_tag=`curl -s $download_url | grep 'APR-util [0-9].*is the best available version' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'`
+    if test -z "$apu_tag"; then
+      fail "failed to determine latest APR version from $download_url"
+    else
+      echo "  APU: $apu_tag"
+    fi
+  fi
+
+  echo "Exporting apr-${apr_tag} to ${export_dir}/srclib ..."
+  svn export https://${SVNHOST}/repos/asf/apr/apr/tags/${apr_tag} "${export_dir}"/srclib/apr > /dev/null || exit 1
+  echo "Exporting apr-util-${apu_tag} to ${export_dir}/srclib ..."
+  svn export https://${SVNHOST}/repos/asf/apr/apr-util/tags/${apu_tag} "${export_dir}"/srclib/apr-util > /dev/null || exit 1
+}
+
+buildconf_httpd_export() {
+  export_dir="$1"
+  test -d "$export_dir" || fail "not a directory: $export_dir"
+  pushd "${export_dir}" > /dev/null
+    find . -name autom4te*.cache | xargs rm -rf
+    ./buildconf || fail
+    find . -name autom4te*.cache | xargs rm -rf
+  popd > /dev/null
+}
+
+fixup_httpd_export() {
+  export_dir="$1"
+  test -d "$export_dir" || fail "not a directory: $export_dir"
+
+  find "${export_dir}" -name STATUS | xargs rm -rf
+  if test -f "${export_dir}/modules/ssl/ssl_expr_parse.y"; then
+      touch "${export_dir}"/modules/ssl/ssl_expr_parse.c
+      touch "${export_dir}"/modules/ssl/ssl_expr_parse.h
+      touch "${export_dir}"/modules/ssl/ssl_expr_scan.c
+  elif test -f "${export_dir}/server/util_expr_parse.y"; then
+      touch "${export_dir}"/server/util_expr_parse.c
+      touch "${export_dir}"/server/util_expr_parse.h
+      touch "${export_dir}"/server/util_expr_scan.c
+  else
+      warn "found no expression parser to fix in export!"
+  fi
+  find "${export_dir}"/docs/manual -name \*.xml -o -name \*.xml.\* | xargs rm -rf
+  find "${export_dir}"/docs/manual -name \*.xsl -o -name \*.xsl.\* | xargs rm -rf
 }
\ No newline at end of file

Modified: httpd/dev-tools/v2/make-tars.sh
URL: http://svn.apache.org/viewvc/httpd/dev-tools/v2/make-tars.sh?rev=1892847&r1=1892846&r2=1892847&view=diff
==============================================================================
--- httpd/dev-tools/v2/make-tars.sh (original)
+++ httpd/dev-tools/v2/make-tars.sh Fri Sep  3 09:17:57 2021
@@ -22,16 +22,19 @@ set -e
 usage () {
     cat <<EOF 1>&2
 usage: $0 [version [signing-user]]
-  create the release tars from a SVN candidate. With
-    version        in format 'm.n.p(-suffix)?' the semantic version is major, minor and patch number.
-    signing-user   the gpg2/gpg/pgp identity used for signing the tarballs
+  create the release tars from a SVN candidate. The candidate is exported
+  to the local dist directory from 'tags/candidate-$version', prepped
+  (buildconf, depending srclib, etc.) and then made into tarballs with
+  checksums and signatures.
+  Options:
+    version        as 'm.n.p(-suffix)?', the version to use.
+    signing-user   the gpg2/gpg/pgp identity used for signing
 EOF
   exit 1
 }
 
 source `dirname $0`/common-lib.sh
 
-
 detect_checkout
 detect_version $1
 signing_user=$2
@@ -48,185 +51,71 @@ creating release tars:
   LOCAL: $DIST_DIR
 EOF
 
-if ! svn ls "$SVN_BASE/$SVN_DEST" >/dev/null 2>&1; then
+EXP_DIRNAME="${PROJECT}-${VERSION}"
+EXP_PATH="${DIST_DIR}/${EXP_DIRNAME}"
+
+svn ls "$SVN_BASE/$SVN_DEST" >/dev/null 2>&1 ||
   fail "release candidate does not exist in SVN: $SVN_DEST"
-fi
 
-# we run buildconf on the export, check that we have usable autotools
-check_autotools
+test -d "$DIST_DIR" || mkdir -p "$DIST_DIR"
 
-if ! test -d "$DIST_DIR"; then
-  mkdir -p "$DIST_DIR"
-fi
+echo "purging any previous leftovers related to $EXP_PATH"
+rm -rf "${EXP_PATH}"
+rm -f "${DIST_DIR}/${EXP_DIRNAME}"*.tar.*
 
-EXP_DIRNAME="${PROJECT}-${VERSION}"
-EXP_PATH="${DIST_DIR}/${EXP_DIRNAME}"
 echo "exporting $SVN_DEST to $EXP_PATH"
-rm -rf "${EXP_PATH}"
 svn export "$SVN_BASE/$SVN_DEST" "${EXP_PATH}" > /dev/null
 
+build_checksums=1    # create checksum files for tarballs
+
 case "$PROJECT" in
   httpd)
-    run_buildconf=1
-    apr_in_srclib=1      # add apr source to srclib
-    separate_deps=1      # release dependencies as separate tar
-    apr_tag=""           # define to override using latest
-    apu_tag=""           # define to override using latest
+    apr_tag=""           # empty means latest version is looked up
+    apu_tag=""           # empty means latest version is looked up
+    SVN_DIST_URL="https://dist.apache.org/repos/dist/release/httpd"
+    SVN_DIST_KEYS=KEYS
     case "${v_major}.${v_minor}" in
       2.4)
+        # overrride vars for this version
         ;;
       2.5)
-        ;;
-      *)
-        warn "'$PROJECT' dependencies undefined for ${v_major}.${v_minor}"
+        # overrride vars for this version
         ;;
     esac
+    echo "Preparing httpd export for being built..."
+
+    check_autotools
+    export_httpd_srclib "$apr_tag" "$apu_tag" "${EXP_PATH}"
+    buildconf_httpd_export "${EXP_PATH}"
+    fixup_httpd_export "${EXP_PATH}"
+
+    echo "Separating out srclib tarballs"
+    rm -rf "${EXP_PATH}-deps"
+    mkdir -p "${EXP_PATH}-deps"/${EXP_DIRNAME}/srclib
+    mv "${EXP_PATH}/srclib/apr" "${EXP_PATH}-deps/${EXP_DIRNAME}/srclib"
+    mv "${EXP_PATH}/srclib/apr-util" "${EXP_PATH}-deps/${EXP_DIRNAME}/srclib"
+    tar -C "${EXP_PATH}-deps" -cf ${EXP_PATH}-deps.tar "${EXP_DIRNAME}"
+    gzip -9 --to-stdout "${EXP_PATH}-deps.tar" > "${EXP_PATH}-deps.tar.gz"
+    bzip2 -9 "${EXP_PATH}-deps.tar"
     ;;
+
   *)
     warn "'$PROJECT' is an unknown project."
     ;;
 esac
 
-if test "$apr_in_srclib" = 1; then
-  if test -z "$apr_tag" -o -z "$apu_tag"; then
-    if ! curl --version >/dev/null 2>&1;then
-      fail "curl must be available to retrieve the latest apr versions."
-    fi
-
-    if test "`echo 'test-1.2.3' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'`" != "1.2.3";then
-      fail "your system must support 'grep -o' to retrieve the latest apr versions."
-    fi
-  fi
-
-  SVNHOST=svn.apache.org
-  download_url="https://apr.apache.org/download.cgi"
-  echo "Determining latest APR and APU versions from $download_url..."
-
-  if test -z "$apr_tag"; then
-    apr_tag=`curl -s $download_url | grep 'APR [0-9].*is the best available version' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'`
-    if test -z "$apr_tag"; then
-      fail "failed to determine latest APR version from $download_url"
-    else
-      echo "  APR: $apr_tag"
-    fi
-  fi
-
-  if test -z "$apu_tag"; then
-    apu_tag=`curl -s $download_url | grep 'APR-util [0-9].*is the best available version' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'`
-    if test -z "$apu_tag"; then
-      fail "failed to determine latest APR version from $download_url"
-    else
-      echo "  APU: $apu_tag"
-    fi
-  fi
-
-  echo "Starting SVN export of apr-${apr_tag} to ${EXP_PATH}/srclib ..."
-  svn export https://${SVNHOST}/repos/asf/apr/apr/tags/${apr_tag} "${EXP_PATH}"/srclib/apr > /dev/null || exit 1
-  echo "Starting SVN export of apr-util-${apu_tag} to ${EXP_PATH}/srclib ..."
-  svn export https://${SVNHOST}/repos/asf/apr/apr-util/tags/${apu_tag} "${EXP_PATH}"/srclib/apr-util > /dev/null || exit 1
-fi
-
-pushd "${DIST_DIR}" > /dev/null
-
-echo "Preparing export for being built..."
-find "${EXP_DIRNAME}" -name autom4te*.cache | xargs rm -rf
-find "${EXP_DIRNAME}" -name STATUS | xargs rm -rf
-if test "$run_buildconf" = 1; then
-  pushd "${EXP_DIRNAME}" > /dev/null
-  ./buildconf || fail
-  find . -name autom4te*.cache | xargs rm -rf
-  popd > /dev/null
-fi
 
-echo " - fixup the timestamps preventing remake of generated files."
-if test -f "${EXP_DIRNAME}/modules/ssl/ssl_expr_parse.y"; then
-    echo " - found ssl expression parser"
-    touch "${EXP_DIRNAME}"/modules/ssl/ssl_expr_parse.c
-    touch "${EXP_DIRNAME}"/modules/ssl/ssl_expr_parse.h
-    touch "${EXP_DIRNAME}"/modules/ssl/ssl_expr_scan.c
-elif test -f "${EXP_DIRNAME}/server/util_expr_parse.y"; then
-    echo " - found generic expression parser"
-    touch "${EXP_DIRNAME}"/server/util_expr_parse.c
-    touch "${EXP_DIRNAME}"/server/util_expr_parse.h
-    touch "${EXP_DIRNAME}"/server/util_expr_scan.c
-else
-    echo " - found no expression parser!"
+echo "building dist tarballs ..."
+tar  -C "${DIST_DIR}" -cf "${EXP_PATH}".tar "${EXP_DIRNAME}"
+gzip -9 --to-stdout "${EXP_PATH}".tar > "${EXP_PATH}".tar.gz
+bzip2 -9 "${EXP_PATH}".tar
+
+if test "$build_checksums" = 1; then
+  echo " - create dist checksums ..."
+  create_dist_checksums "${EXP_PATH}"*.tar.gz "${EXP_PATH}"*.tar.bz2
 fi
 
-echo " - removing Manual Source Files."
-find "${EXP_DIRNAME}"/docs/manual -name \*.xml -o -name \*.xml.\* | xargs rm -rf
-find "${EXP_DIRNAME}"/docs/manual -name \*.xsl -o -name \*.xsl.\* | xargs rm -rf
-
-echo "Building the tarball, .gz, and .bz2 files ..."
-rm -f "${EXP_DIRNAME}"*.tar.*
-
-if test "${separate_deps}" = 1; then
-    echo " - moving dependencies to their own tarballs"
-    DESP_PATH="${EXP_DIRNAME}-deps"
-    rm -rf "${DESP_PATH}"
-    mkdir -p "${DESP_PATH}"/${EXP_DIRNAME}/srclib
-    mv "${EXP_DIRNAME}/srclib/apr" "${DESP_PATH}/${EXP_DIRNAME}/srclib"
-    mv "${EXP_DIRNAME}/srclib/apr-util" "${DESP_PATH}/${EXP_DIRNAME}/srclib"
-    tar -C "${DESP_PATH}" -cf ${EXP_DIRNAME}-deps.tar "${EXP_DIRNAME}"
-    gzip -9 --to-stdout "${EXP_DIRNAME}-deps.tar" > "${EXP_DIRNAME}-deps.tar.gz"
-    bzip2 -9 "${EXP_DIRNAME}-deps.tar"
+if test -n "$SVN_DIST_KEYS"; then
+  echo " - signing dist files ..."
+  sign_dist_files "${signing_user}" "${EXP_PATH}"*.tar.gz "${EXP_PATH}"*.tar.bz2
 fi
-
-echo " - building ${PROJECT} tarballs"
-tar cf "${EXP_DIRNAME}".tar "${EXP_DIRNAME}"
-gzip -9 --to-stdout "${EXP_DIRNAME}".tar > "${EXP_DIRNAME}".tar.gz
-bzip2 -9 "${EXP_DIRNAME}".tar
-
-if ! openssl version >/dev/null; then
-  fail "unable to find 'openssl' in path"
-fi
-for file in "${EXP_DIRNAME}"*.tar.*; do
-  echo " - building checksum files for ${file}"
-  openssl md5 ${file} | sed -e 's#^MD5(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.md5
-  openssl sha1 ${file} | sed -e 's#^SHA1(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha1
-  openssl sha256 ${file} | sed -e 's#^SHA256(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha256
-  openssl sha512 ${file} | sed -e 's#^SHA512(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha512
-done
-
-echo "Cleaning up and signing the files ..."
-echo ""
-
-# check for executables
-gpg2="`which gpg2 2> /dev/null | head -1`"
-gpg="`which gpg 2> /dev/null | head -1`"
-pgp="`which pgp 2> /dev/null | head -1`"
-
-# there are 3 possible ways to sign, check in preference
-if test -x "${gpg2}"; then
-  if test -z "${signing_user}"; then
-    args="--default-key"
-  else
-    args="-u ${signing_user}"
-  fi
-  for file in "${EXP_DIRNAME}"*.tar.*; do
-    echo " - gpg2: creating asc signature file for ${file} ..."
-    ${gpg2} --armor ${args} --detach-sign ${file}
-  done
-elif test -x "${gpg}"; then
-  args=""
-  if test -n "${signing_user}"; then
-    args="-u ${signing_useruser}"
-  fi
-  for file in "${EXP_DIRNAME}"*.tar.*; do
-    echo " - gpg: creating asc signature file for ${file} ..."
-    ${gpg} --armor ${args} --detach-sign ${file}
-  done
-elif test -x "${pgp}"; then
-  args=""
-  if test -n "${signing_user}"; then
-    args="-u ${signing_user}"
-  fi
-  for file in "${EXP_DIRNAME}"*.tar.*; do
-    echo " - pgp: creating asc signature file for ${file} ..."
-    ${pgp} -sba ${file} ${args}
-  done
-else
-  warn "neither PGP nor GnuPG found! Not signing release!"
-fi
-
-popd > /dev/null
\ No newline at end of file