[svn-commits] tilghman: trunk r263905 - in /trunk: ./ build_tools/ sounds/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 18 17:49:16 CDT 2010


Author: tilghman
Date: Tue May 18 17:49:13 2010
New Revision: 263905

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=263905
Log:
Add an sha1sum-workalike for platforms which don't have it (like Mac OS X)

Added:
    trunk/build_tools/sha1sum-sh   (with props)
Modified:
    trunk/configure
    trunk/configure.ac
    trunk/makeopts.in
    trunk/sounds/Makefile

Added: trunk/build_tools/sha1sum-sh
URL: http://svnview.digium.com/svn/asterisk/trunk/build_tools/sha1sum-sh?view=auto&rev=263905
==============================================================================
--- trunk/build_tools/sha1sum-sh (added)
+++ trunk/build_tools/sha1sum-sh Tue May 18 17:49:13 2010
@@ -1,0 +1,71 @@
+#!/bin/sh
+
+check=0
+status=0
+
+while [ x"$1" != x ]; do
+	case $1 in
+	-c)
+		check=1
+		shift
+		continue;;
+	--status)
+		status=1
+		shift
+		continue;;
+	-*)
+		if [ $status = 0 ]; then
+			echo "Unrecognized option $1" 1>&2
+		fi
+		exit 1
+		;;
+	*)
+		dst=$1
+		shift
+		continue;;
+	esac
+done
+
+if [ x"$dst" = x ]; then
+	if [ $status = 0 ]; then
+		echo "Usage: $0 [<options>] <filename>" 1>&2
+	fi
+	exit 1
+fi
+
+if [ $check = 1 ]; then
+	if [ -f $dst ]; then
+		sum1=`cut -d' ' -f1 $dst`
+		file=`cut -d' ' -f3 $dst`
+		sum2=`openssl sha1 $file | cut -d' ' -f2`
+		if [ x"$sum1" = x"$sum2" ]; then
+			if [ $status = 0 ]; then
+				echo "$dst: OK"
+			fi
+			exit 0
+		else
+			if [ $status = 0 ]; then
+				echo "$dst: FAILED"
+			fi
+			exit 1
+		fi
+	else
+		echo "$0: $dst: No such file or directory" 1>&2
+		exit 1
+	fi
+else
+	if [ x"$status" = x1 ]; then
+		echo "$0: the --status option is meaningful only when verifying checksums" 1>&2
+		exit 1
+	fi
+
+	if [ -f $dst ]; then
+		sum=`openssl sha1 $dst | cut -d' ' -f2`
+		echo "$dst  $sum"
+		exit 0
+	else
+		echo "$0: $dst: No such file or directory" 1>&2
+		exit 1
+	fi
+fi
+

Propchange: trunk/build_tools/sha1sum-sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/build_tools/sha1sum-sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/build_tools/sha1sum-sh
------------------------------------------------------------------------------
    svn:keywords = 'Date Author Id Revision Yoyo'

Propchange: trunk/build_tools/sha1sum-sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/trunk/configure.ac?view=diff&rev=263905&r1=263904&r2=263905
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue May 18 17:49:13 2010
@@ -178,6 +178,8 @@
 
 AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
 AC_CHECK_TOOLS([AR], [ar gar], :)
+AC_CHECK_TOOLS([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
+AC_CHECK_TOOLS([OPENSSL], [openssl], :)
 
 GNU_LD=0
 if test "x$with_gnu_ld" = "xyes" ; then

Modified: trunk/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/trunk/makeopts.in?view=diff&rev=263905&r1=263904&r2=263905
==============================================================================
--- trunk/makeopts.in (original)
+++ trunk/makeopts.in Tue May 18 17:49:13 2010
@@ -29,6 +29,8 @@
 KPATHSEA=@KPATHSEA@
 XMLSTARLET=@XMLSTARLET@
 MD5=@MD5@
+SHA1SUM=@SHA1SUM@
+OPENSSL=@OPENSSL@
 
 BUILD_PLATFORM=@BUILD_PLATFORM@
 BUILD_CPU=@BUILD_CPU@

Modified: trunk/sounds/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/sounds/Makefile?view=diff&rev=263905&r1=263904&r2=263905
==============================================================================
--- trunk/sounds/Makefile (original)
+++ trunk/sounds/Makefile Tue May 18 17:49:13 2010
@@ -64,8 +64,8 @@
 MOH:=$(MM:MOH-%=asterisk-moh-%-$(MOH_VERSION).tar.gz)
 MOH_TAGS:=$(MM:MOH-%=$(MOH_DIR)/.asterisk-moh-%-$(MOH_VERSION))
 # If "fetch" is used, --continue is not a valid option.
-ifneq ($(findstring wget,$(WGET)),)
-WGET_ARGS:=--continue $(WGET_EXTRA_ARGS)
+ifneq ($(findstring wget,$(DOWNLOAD)),)
+DOWNLOAD+=--continue $(WGET_EXTRA_ARGS)
 endif
 
 EMPTY:=
@@ -78,8 +78,9 @@
 	$(CMD_PREFIX)PACKAGE=$$(subst $$($(1))/.asterisk,asterisk,$$@).tar.gz; $(BS)
 	if test ! -f $$$${PACKAGE}; then $(BS)
 	  if test ! -f $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE}; then $(BS)
-	    (cd $$(SOUNDS_CACHE_DIR); ($$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$$${PACKAGE} $$(SOUNDS_URL)/$$$${PACKAGE}.sha1 $(BS)
-	       && sha1sum -c --status $$$${PACKAGE}.sha1) || $(BS)
+	    (cd $$(SOUNDS_CACHE_DIR); ($$(DOWNLOAD) $$(SOUNDS_URL)/$$$${PACKAGE} && $(BS)
+		   $$(DOWNLOAD) $$(SOUNDS_URL)/$$$${PACKAGE}.sha1 $(BS)
+	       && $$(SHA1SUM) -c --status $$$${PACKAGE}.sha1) || $(BS)
 	     (echo "Bad checksum: $$$${PACKAGE}" 1>&2; exit 1)); $(BS)
 	  fi; $(BS)
 	  cp -p $$(SOUNDS_CACHE_DIR)/$$$${PACKAGE} .; $(BS)
@@ -94,8 +95,9 @@
 asterisk-$(1)-%.tar.gz: have_download
 	$(CMD_PREFIX)if test ! -f $$@ && test ! -f $$(SOUNDS_DIR)/.$$(subst .tar.gz,,$/$@); then $(BS)
 	  if test ! -f $$(SOUNDS_CACHE_DIR)/$$@; then $(BS)
-	    (cd $$(SOUNDS_CACHE_DIR); ($$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$@ $$(SOUNDS_URL)/$$@.sha1 $(BS)
-	       && sha1sum -c --status $$@.sha1) || $(BS)
+	    (cd $$(SOUNDS_CACHE_DIR); ($$(DOWNLOAD) $$(SOUNDS_URL)/$$@ && $(BS)
+		   $$(DOWNLOAD) $$(SOUNDS_URL)/$$@.sha1 $(BS)
+	       && $$(SHA1SUM) -c --status $$@.sha1) || $(BS)
 	     (echo "Bad checksum: $$@" 1>&2; exit 1)); $(BS)
 	  fi; $(BS)
 	  cp -p $$(SOUNDS_CACHE_DIR)/$$@ .; $(BS)
@@ -108,7 +110,7 @@
 $$($(1))/.asterisk-$(2)$(if $(3),-$(3),)-%: have_download
 	$(CMD_PREFIX)PACKAGE=$$(subst $$($(1))/.asterisk,asterisk,$$@).tar.gz; $(BS)
 	if test ! -f $$$${PACKAGE}; then $(BS)
-	  ($$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$$${PACKAGE} || exit 1); $(BS)
+	  ($$(DOWNLOAD) $$(SOUNDS_URL)/$$$${PACKAGE} || exit 1); $(BS)
 	fi; $(BS)
 $(if $($(4)_VERSION),\
 $(EMPTY)	rm -f $$(subst -$$($(4)_VERSION),,$$@)-* && $(BS)
@@ -119,7 +121,7 @@
 define sound_download_rule
 asterisk-$(1)-%.tar.gz: have_download
 	$(CMD_PREFIX)if test ! -f $$@ && test ! -f $$(SOUNDS_DIR)/.$$(subst .tar.gz,,$$@); then $(BS)
-	  $$(DOWNLOAD) $$(WGET_ARGS) $$(SOUNDS_URL)/$$@; $(BS)
+	  $$(DOWNLOAD) $$(SOUNDS_URL)/$$@; $(BS)
 	fi
 endef
 




More information about the svn-commits mailing list