mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	apply_patches: Use globbing instead of file/sort.
This accomplishes the same thing as a `find ... | sort` but with the added benefit of clarity and avoiding a call to a subshell. Additionally drop the -s option from call to patch as it is not POSIX.
This commit is contained in:
		
				
					committed by
					
						 George Joseph
						George Joseph
					
				
			
			
				
	
			
			
			
						parent
						
							f43849b65b
						
					
				
				
					commit
					86da1af5ae
				
			
							
								
								
									
										68
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										68
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -1218,7 +1218,6 @@ DOWNLOAD_TIMEOUT | |||||||
| DOWNLOAD_TO_STDOUT | DOWNLOAD_TO_STDOUT | ||||||
| DOWNLOAD | DOWNLOAD | ||||||
| FETCH | FETCH | ||||||
| SORT |  | ||||||
| REALPATH | REALPATH | ||||||
| NM | NM | ||||||
| PATCH | PATCH | ||||||
| @@ -1328,6 +1327,7 @@ infodir | |||||||
| docdir | docdir | ||||||
| oldincludedir | oldincludedir | ||||||
| includedir | includedir | ||||||
|  | runstatedir | ||||||
| localstatedir | localstatedir | ||||||
| sharedstatedir | sharedstatedir | ||||||
| sysconfdir | sysconfdir | ||||||
| @@ -1516,6 +1516,7 @@ datadir='${datarootdir}' | |||||||
| sysconfdir='${prefix}/etc' | sysconfdir='${prefix}/etc' | ||||||
| sharedstatedir='${prefix}/com' | sharedstatedir='${prefix}/com' | ||||||
| localstatedir='${prefix}/var' | localstatedir='${prefix}/var' | ||||||
|  | runstatedir='${localstatedir}/run' | ||||||
| includedir='${prefix}/include' | includedir='${prefix}/include' | ||||||
| oldincludedir='/usr/include' | oldincludedir='/usr/include' | ||||||
| docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' | docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' | ||||||
| @@ -1768,6 +1769,15 @@ do | |||||||
|   | -silent | --silent | --silen | --sile | --sil) |   | -silent | --silent | --silen | --sile | --sil) | ||||||
|     silent=yes ;; |     silent=yes ;; | ||||||
|  |  | ||||||
|  |   -runstatedir | --runstatedir | --runstatedi | --runstated \ | ||||||
|  |   | --runstate | --runstat | --runsta | --runst | --runs \ | ||||||
|  |   | --run | --ru | --r) | ||||||
|  |     ac_prev=runstatedir ;; | ||||||
|  |   -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | ||||||
|  |   | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | ||||||
|  |   | --run=* | --ru=* | --r=*) | ||||||
|  |     runstatedir=$ac_optarg ;; | ||||||
|  |  | ||||||
|   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) |   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) | ||||||
|     ac_prev=sbindir ;; |     ac_prev=sbindir ;; | ||||||
|   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ |   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | ||||||
| @@ -1905,7 +1915,7 @@ fi | |||||||
| for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \ | for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \ | ||||||
| 		datadir sysconfdir sharedstatedir localstatedir includedir \ | 		datadir sysconfdir sharedstatedir localstatedir includedir \ | ||||||
| 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ | 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ | ||||||
| 		libdir localedir mandir | 		libdir localedir mandir runstatedir | ||||||
| do | do | ||||||
|   eval ac_val=\$$ac_var |   eval ac_val=\$$ac_var | ||||||
|   # Remove trailing slashes. |   # Remove trailing slashes. | ||||||
| @@ -2058,6 +2068,7 @@ Fine tuning of the installation directories: | |||||||
|   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc] |   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc] | ||||||
|   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com] |   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com] | ||||||
|   --localstatedir=DIR     modifiable single-machine data [PREFIX/var] |   --localstatedir=DIR     modifiable single-machine data [PREFIX/var] | ||||||
|  |   --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run] | ||||||
|   --libdir=DIR            object code libraries [EPREFIX/lib] |   --libdir=DIR            object code libraries [EPREFIX/lib] | ||||||
|   --includedir=DIR        C header files [PREFIX/include] |   --includedir=DIR        C header files [PREFIX/include] | ||||||
|   --oldincludedir=DIR     C header files for non-gcc [/usr/include] |   --oldincludedir=DIR     C header files for non-gcc [/usr/include] | ||||||
| @@ -7698,47 +7709,6 @@ $as_echo "no" >&6; } | |||||||
| fi | fi | ||||||
|  |  | ||||||
|  |  | ||||||
| # Extract the first word of "sort", so it can be a program name with args. |  | ||||||
| set dummy sort; ac_word=$2 |  | ||||||
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 |  | ||||||
| $as_echo_n "checking for $ac_word... " >&6; } |  | ||||||
| if ${ac_cv_path_SORT+:} false; then : |  | ||||||
|   $as_echo_n "(cached) " >&6 |  | ||||||
| else |  | ||||||
|   case $SORT in |  | ||||||
|   [\\/]* | ?:[\\/]*) |  | ||||||
|   ac_cv_path_SORT="$SORT" # Let the user override the test with a path. |  | ||||||
|   ;; |  | ||||||
|   *) |  | ||||||
|   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |  | ||||||
| for as_dir in $PATH |  | ||||||
| do |  | ||||||
|   IFS=$as_save_IFS |  | ||||||
|   test -z "$as_dir" && as_dir=. |  | ||||||
|     for ac_exec_ext in '' $ac_executable_extensions; do |  | ||||||
|   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then |  | ||||||
|     ac_cv_path_SORT="$as_dir/$ac_word$ac_exec_ext" |  | ||||||
|     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |  | ||||||
|     break 2 |  | ||||||
|   fi |  | ||||||
| done |  | ||||||
|   done |  | ||||||
| IFS=$as_save_IFS |  | ||||||
|  |  | ||||||
|   test -z "$ac_cv_path_SORT" && ac_cv_path_SORT=":" |  | ||||||
|   ;; |  | ||||||
| esac |  | ||||||
| fi |  | ||||||
| SORT=$ac_cv_path_SORT |  | ||||||
| if test -n "$SORT"; then |  | ||||||
|   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SORT" >&5 |  | ||||||
| $as_echo "$SORT" >&6; } |  | ||||||
| else |  | ||||||
|   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |  | ||||||
| $as_echo "no" >&6; } |  | ||||||
| fi |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| DOWNLOAD=":" | DOWNLOAD=":" | ||||||
| @@ -15243,7 +15213,7 @@ else | |||||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, |     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||||
|     since some C++ compilers masquerading as C compilers |     since some C++ compilers masquerading as C compilers | ||||||
|     incorrectly reject 9223372036854775807.  */ |     incorrectly reject 9223372036854775807.  */ | ||||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 |   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | 		       && LARGE_OFF_T % 2147483647 == 1) | ||||||
| 		      ? 1 : -1]; | 		      ? 1 : -1]; | ||||||
| @@ -15289,7 +15259,7 @@ else | |||||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, |     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||||
|     since some C++ compilers masquerading as C compilers |     since some C++ compilers masquerading as C compilers | ||||||
|     incorrectly reject 9223372036854775807.  */ |     incorrectly reject 9223372036854775807.  */ | ||||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 |   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | 		       && LARGE_OFF_T % 2147483647 == 1) | ||||||
| 		      ? 1 : -1]; | 		      ? 1 : -1]; | ||||||
| @@ -15313,7 +15283,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |||||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, |     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||||
|     since some C++ compilers masquerading as C compilers |     since some C++ compilers masquerading as C compilers | ||||||
|     incorrectly reject 9223372036854775807.  */ |     incorrectly reject 9223372036854775807.  */ | ||||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 |   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | 		       && LARGE_OFF_T % 2147483647 == 1) | ||||||
| 		      ? 1 : -1]; | 		      ? 1 : -1]; | ||||||
| @@ -15358,7 +15328,7 @@ else | |||||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, |     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||||
|     since some C++ compilers masquerading as C compilers |     since some C++ compilers masquerading as C compilers | ||||||
|     incorrectly reject 9223372036854775807.  */ |     incorrectly reject 9223372036854775807.  */ | ||||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 |   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | 		       && LARGE_OFF_T % 2147483647 == 1) | ||||||
| 		      ? 1 : -1]; | 		      ? 1 : -1]; | ||||||
| @@ -15382,7 +15352,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |||||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, |     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||||
|     since some C++ compilers masquerading as C compilers |     since some C++ compilers masquerading as C compilers | ||||||
|     incorrectly reject 9223372036854775807.  */ |     incorrectly reject 9223372036854775807.  */ | ||||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 |   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | 		       && LARGE_OFF_T % 2147483647 == 1) | ||||||
| 		      ? 1 : -1]; | 		      ? 1 : -1]; | ||||||
| @@ -16682,6 +16652,8 @@ main () | |||||||
|     if (*(data + i) != *(data3 + i)) |     if (*(data + i) != *(data3 + i)) | ||||||
|       return 14; |       return 14; | ||||||
|   close (fd); |   close (fd); | ||||||
|  |   free (data); | ||||||
|  |   free (data3); | ||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
| _ACEOF | _ACEOF | ||||||
|   | |||||||
| @@ -286,7 +286,6 @@ AC_PATH_PROG([PATCH], [patch], :) | |||||||
| AC_PATH_PROG([SED], [sed], :) | AC_PATH_PROG([SED], [sed], :) | ||||||
| AC_PATH_PROG([NM], [nm], :) | AC_PATH_PROG([NM], [nm], :) | ||||||
| AC_PATH_PROG([REALPATH], [realpath], :) | AC_PATH_PROG([REALPATH], [realpath], :) | ||||||
| AC_PATH_PROG([SORT], [sort], :) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| DOWNLOAD=":" | DOWNLOAD=":" | ||||||
|   | |||||||
| @@ -48,7 +48,6 @@ CAT=@CAT@ | |||||||
| CUT=@CUT@ | CUT=@CUT@ | ||||||
| REALPATH=@REALPATH@ | REALPATH=@REALPATH@ | ||||||
| DIRNAME=@DIRNAME@ | DIRNAME=@DIRNAME@ | ||||||
| SORT=@SORT@ |  | ||||||
|  |  | ||||||
| BUILD_PLATFORM=@BUILD_PLATFORM@ | BUILD_PLATFORM=@BUILD_PLATFORM@ | ||||||
| BUILD_CPU=@BUILD_CPU@ | BUILD_CPU=@BUILD_CPU@ | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								third-party/apply_patches
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								third-party/apply_patches
									
									
									
									
										vendored
									
									
								
							| @@ -6,8 +6,6 @@ if [ "$1" = "-q" ] ; then | |||||||
| fi | fi | ||||||
|  |  | ||||||
| PATCH=${PATCH:-patch} | PATCH=${PATCH:-patch} | ||||||
| FIND=${FIND:-find} |  | ||||||
| SORT=${SORT:-sort} |  | ||||||
|  |  | ||||||
| patchdir=${1:?You must supply a patches directory} | patchdir=${1:?You must supply a patches directory} | ||||||
| sourcedir=${2?:You must supply a source directory} | sourcedir=${2?:You must supply a source directory} | ||||||
| @@ -22,15 +20,18 @@ if [ ! -d "$sourcedir" ] ; then | |||||||
| 	exit 1 | 	exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| patches=$(${FIND} "$patchdir" -name "*.patch" | ${SORT}) | # Patterns used in filename expansion (globs) are sorted according to the | ||||||
| if [ x"$patches" = x"" ] ; then | # current locale, so there is no need to do it explicitly. | ||||||
| 	echo "No patches in $patchdir"  >&2 | for patchfile in "$patchdir"/*.patch ; do | ||||||
| 	exit 0 | 	# A glob that doesn't match is not replaced, so we handle that here. We | ||||||
| fi | 	# should only fail this test if there are no patch files. | ||||||
|  | 	[ -f "$patchfile" ] || { | ||||||
|  | 		echo "No patches in $patchdir" >&2 | ||||||
|  | 		exit 0 | ||||||
|  | 	} | ||||||
|  |  | ||||||
| for patchfile in ${patches} ; do | 	[ -z "$quiet" ] && echo "Applying patch $(basename "$patchfile")" | ||||||
| 	[ -z $quiet ] && echo "Applying patch $(basename $patchfile)" | 	${PATCH} -d "$sourcedir" -p1 -i "$patchfile" >/dev/null || exit 1 | ||||||
| 	${PATCH} -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1 |  | ||||||
| done | done | ||||||
|  |  | ||||||
| exit 0 | exit 0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user