From 4f8ca71fdf61e8baee1e717c1a27a31e7b383fb7 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Tue, 24 Mar 2009 14:13:39 +0200 Subject: [PATCH] sde-config: enhanced hack_stages() to allow wildcards and offsets --- lib/sde-config/functions.in | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/sde-config/functions.in b/lib/sde-config/functions.in index 2848266..f0a21ff 100644 --- a/lib/sde-config/functions.in +++ b/lib/sde-config/functions.in @@ -2,7 +2,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/sde-config/functions.in -# Copyright (C) 2006 - 2008 The OpenSDE Project +# Copyright (C) 2006 - 2009 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # @@ -84,17 +84,19 @@ create_dot_in_lists() { hack_stages() { local stage="$1----------"; shift - local pkgs="$*" + local pkgs= any='[^ ]\+' - if [ $# -gt 1 ]; then - pkgs="${pkgs// /\|}" - elif [ $# -eq 1 ]; then - true - fi + case "$stage" in + [0-9]*) stage=$(printf "%.*s$stage" "${stage:0:1}" "----------") ;; + esac - if [ "$pkgs" ]; then - pkgfilter sed -e "s,^\(.\) [^ ]* \([^ ]*\) \([^ ]*\) \($pkgs\) ,\1 ${stage:0:10} \2 \3 \4 ," + if [ $# -gt 0 ]; then + pkgs=$(echo "$*" | sed -e 's, ,\\|,g' -e "s,\*,$any,g") + else + pkgs="$any" fi + + pkgfilter sed -e "s,^\(.\) $any \($any\) \($any\) \($pkgs\) ,\1 ${stage:0:10} \2 \3 \4 ," } # Functions for working with config/$config/packages