[pacman-dev] [PATCH 3/7] makepkg: move debug symbol stripping to separate function

Dave Reisner d at falconindy.com
Sun Sep 23 11:53:56 EDT 2012


On Mon, Sep 24, 2012 at 12:44:31AM +1000, Allan McRae wrote:
> Move stripping of files to a spearate function that will be expanded
> for the handling of creating debug symbol packages.
> 
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  scripts/makepkg.sh.in | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 7b516ff..5283d73 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1421,6 +1421,11 @@ run_package() {
>  	run_function_safe "$pkgfunc"
>  }
>  
> +strip_file() {
> +	local binary=$1; shift
> +	strip $@ $binary

"$binary"

> +}
> +
>  tidy_install() {
>  	cd_safe "$pkgdir"
>  	msg "$(gettext "Tidying install...")"
> @@ -1475,16 +1480,19 @@ tidy_install() {
>  		# make sure library stripping variables are defined to prevent excess stripping
>  		[[ -z ${STRIP_SHARED+x} ]] && STRIP_SHARED="-S"
>  		[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
> -		local binary
> +		local binary strip_flags
>  		find . -type f -perm -u+w -print0 2>/dev/null | while read -d '' binary ; do
>  			case "$(file -bi "$binary")" in
>  				*application/x-sharedlib*)  # Libraries (.so)
> -					strip $STRIP_SHARED "$binary";;
> +					strip_flags=($STRIP_SHARED);;

This is a little strange since $STRIP_SHARED and friends are simple
variables. Why not just leave it as a simple string assignment?

>  				*application/x-archive*)    # Libraries (.a)
> -					strip $STRIP_STATIC "$binary";;
> +					strip_flags=($STRIP_STATIC);;
>  				*application/x-executable*) # Binaries
> -					strip $STRIP_BINARIES "$binary";;
> +					strip_flags=($STRIP_BINARIES);;
> +				*)
> +					continue ;;
>  			esac
> +			strip_file $binary ${strip_flags[@]}

"$binary"

>  		done
>  	fi
>  
> -- 
> 1.7.12.1
> 
> 


More information about the pacman-dev mailing list