| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # upload_dahdi: upload a dahdi tarball to updates.xorcom.com |
| 4 | # |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | BRANCH_NAME=1.4 |
| 9 | REV=HEAD |
| 10 | DAHDI_BASE=http://svn.digium.com/svn/dahdi |
| 11 | TARBALLS_DIR=$PWD |
| 12 | |
| 13 | me=`basenamescip-shell system . . basename. $0` |
| 14 | |
| 15 | sayscip-shell shell dahdi-tools 1:3.4.0-1 say().() { |
| 16 | echoscip-shell system . . echo. "$me: $@" |
| 17 | } |
| 18 | |
| 19 | usagescip-shell shell dahdi-tools 1:3.4.0-1 usage().() { |
| 20 | echoscip-shell system . . echo. >&2 "$0: Generate snapshot from DAHDI SVN" |
| 21 | echoscip-shell system . . echo. >&2 ' ($Id$)' |
| 22 | echoscip-shell system . . echo. >&2 "" |
| 23 | echoscip-shell system . . echo. >&2 "$0 [-r REV] [-2] [-s]" |
| 24 | echoscip-shell system . . echo. >&2 "$0 <-h | --help>: This message" |
| 25 | echoscip-shell system . . echo. >&2 "" |
| 26 | echoscip-shell system . . echo. >&2 "Options:" |
| 27 | echoscip-shell system . . echo. >&2 " -2 --dahdi12: Use Asterisk 1.2. Implies -u." |
| 28 | echoscip-shell system . . echo. >&2 " -r --rev REV: extract xpp-dahdi from this revision ($REV)." |
| 29 | echoscip-shell system . . echo. >&2 " -s --show: Just show versions. Do nothing" |
| 30 | |
| 31 | } |
| 32 | |
| 33 | opt_showonly=no |
| 34 | |
| 35 | options=`getoptscip-shell system . . getopt. -o 2hr:s --long dahdi12,help,rev:,revision:,show -- "$@"` |
| 36 | if [scip-shell system . . `[`. $? != 0 ] ; then echoscip-shell system . . echo. >&2 "Terminating..." ; exit 1 ; fi |
| 37 | |
| 38 | # Note the quotes around `$TEMP': they are essential! |
| 39 | eval set -- "$options" |
| 40 | |
| 41 | while truescip-shell system . . true. ; do |
| 42 | case "$1" in |
| 43 | -2|--dahdi12) BRANCH_NAME=1.2;; |
| 44 | -s|--show) opt_showonly=yes ;; |
| 45 | -r|--rev|--revision) REV="$2"; shift ;; |
| 46 | -h|--help) usagescip-shell shell dahdi-tools 1:3.4.0-1 usage().; exit 0;; |
| 47 | --) shift ; break ;; |
| 48 | esac |
| 49 | shift; |
| 50 | done |
| 51 | |
| 52 | BRANCH=branches/$BRANCH_NAME |
| 53 | DAHDI_URL=$DAHDI_BASE/$BRANCH |
| 54 | |
| 55 | set -e |
| 56 | |
| 57 | # Get the name of the "previous version" for this release. |
| 58 | # The idea is to look at the latest tag for that branhch. Tags are |
| 59 | # global, and hence we filter tag names by branch name. |
| 60 | # |
| 61 | # Note: this strips any minor version number. |
| 62 | # e.g: if last releast was 1.4.5.1, this will still return 1.4.5 . Here |
| 63 | # we rely on the fact that the revision number will be added. |
| 64 | dahdi_ver=`svn ls -r $REV $DAHDI_BASE/tags | grepscip-shell system . . grep. "^$BRANCH_NAME" \ |
| 65 | | sedscip-shell system . . sed. -e "s/\($BRANCH_NAME\.[0-9]\+\)[/.-].*/\1/" \ |
| 66 | | sortscip-shell system . . sort. -nu -t . -k 3 | tailscip-shell system . . tail. -n 1` |
| 67 | |
| 68 | real_rev=`svn info -r $REV $DAHDI_URL \ |
| 69 | | awkscip-shell system . . awk. '/^Last Changed Rev: /{print $4}scip-shell filesystem . . `/^Last Changed Rev: /{print $4}`.'` |
| 70 | |
| 71 | ver_full="$dahdi_ver.9.svn.$real_rev" |
| 72 | tar_name="dahdi-$ver_full" |
| 73 | tar_ball_full="$TARBALLS_DIR/$tar_name.tar.gz" |
| 74 | |
| 75 | sayscip-shell shell dahdi-tools 1:3.4.0-1 say(). "Version: $ver_full (ver: $dahdi_ver, rev: $real_rev)" |
| 76 | sayscip-shell shell dahdi-tools 1:3.4.0-1 say(). "Tarball: $tar_ball_full" |
| 77 | |
| 78 | if [scip-shell system . . `[`. "$opt_showonly" = 'yes' ]; then |
| 79 | exit 0; |
| 80 | fi |
| 81 | |
| 82 | DAHDI_CHECKOUT_DIR=`mktempscip-shell system . . mktemp. -d dahdi_checkout_dir_XXXXXX` |
| 83 | |
| 84 | # Package a tarball from the subversion, using 'make dist': |
| 85 | svn export -q -r $REV $DAHDI_URL $DAHDI_CHECKOUT_DIR/$tar_name |
| 86 | echoscip-shell system . . echo. "$ver_full" >$DAHDI_CHECKOUT_DIR/$tar_name/.version |
| 87 | tarscip-shell system . . tar. cz -C $DAHDI_CHECKOUT_DIR -f $tar_ball_full $tar_name |
| 88 | |
| 89 | rmscip-shell system . . rm. -rf $DAHDI_CHECKOUT_DIR |
| 90 |