summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Glaser <tg@mirbsd.org>2009-12-20 14:52:58 +0059
committerWaldemar Brodkorb <wbx@openadk.org>2009-12-20 17:37:01 +0100
commit77a222d5094d902128d355685501c7b30c8cccca (patch)
treeb7c1df43344d05c69cbaeb87cb29cf5b1128585a
parent82b3f66f50f608723a2d388bf933ec08a0fefda4 (diff)
Pimp up the progress bar
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
-rw-r--r--mk/split-cfg.mk2
-rw-r--r--package/depmaker6
-rw-r--r--package/pkgmaker8
-rw-r--r--scripts/split-cfg.sh31
4 files changed, 31 insertions, 16 deletions
diff --git a/mk/split-cfg.mk b/mk/split-cfg.mk
index 6b1091e89..9f4bff8e7 100644
--- a/mk/split-cfg.mk
+++ b/mk/split-cfg.mk
@@ -4,4 +4,4 @@
${TOPDIR}/.cfg/ADK_HAVE_DOT_CONFIG: ${TOPDIR}/.config \
${TOPDIR}/mk/split-cfg.mk ${TOPDIR}/scripts/split-cfg.sh
- ${BASH} ${TOPDIR}/scripts/split-cfg.sh '${TOPDIR}'
+ mksh ${TOPDIR}/scripts/split-cfg.sh '${TOPDIR}'
diff --git a/package/depmaker b/package/depmaker
index 43d4327eb..edbacc6f1 100644
--- a/package/depmaker
+++ b/package/depmaker
@@ -5,9 +5,13 @@ if gmake --help >/dev/null 2>&1; then
else
export GMAKE=make
fi
+(( x_cols = (COLUMNS > 10) ? COLUMNS - 2 : 80 ))
+typeset -L$x_cols pbar
for dn in */Makefile; do
dn=${dn%/*}
+ pbar="$dn ..."
+ print -nu2 "$pbar\r"
case $dn {
(@(?(e)g|uc|)libc|libpthread|uclibc++) ;;
(*)
@@ -27,3 +31,5 @@ for dn in */Makefile; do
done
print -r -- $x
done >Depends.mk
+pbar=done
+print -u2 "$pbar"
diff --git a/package/pkgmaker b/package/pkgmaker
index a8a54c631..879c5eff4 100644
--- a/package/pkgmaker
+++ b/package/pkgmaker
@@ -5,6 +5,8 @@ if gmake --help >/dev/null 2>&1; then
else
export GMAKE=make
fi
+(( x_cols = (COLUMNS > 10) ? COLUMNS - 2 : 80 ))
+typeset -L$x_cols pbar
# build a cache of “ipkg package name” → “package conf option” for
# use with dependency resolution
@@ -12,6 +14,8 @@ rm -rf pkglist.d
mkdir pkglist.d
for dn in */Makefile; do
dn=${dn%/*}
+ pbar="Pass 1: $dn ..."
+ print -nu2 "$pbar\r"
cd $dn
# ALL_PKGOPTS: all subpackage conf options
@@ -35,6 +39,8 @@ done
# build Config.in files and resolve dependencies
for dn in */Makefile; do
dn=${dn%/*}
+ pbar="Pass 2: $dn ..."
+ print -nu2 "$pbar\r"
cd $dn
# PKG_NAME: package name (directory, free-format)
@@ -169,3 +175,5 @@ EOF
) >Config.in
cd ..
done
+pbar=done
+print -u2 "$pbar"
diff --git a/scripts/split-cfg.sh b/scripts/split-cfg.sh
index 4331709a5..07cdd5838 100644
--- a/scripts/split-cfg.sh
+++ b/scripts/split-cfg.sh
@@ -4,21 +4,21 @@
# ses the slow-down.
TOPDIR=$1
-
-[[ -n $BASH_VERSION ]] && shopt -s extglob
+(( x_cols = (COLUMNS > 10) ? COLUMNS - 2 : 80 ))
+typeset -L$x_cols pbar
grep -v '^BUSYBOX\|^# BUSYBOX' $TOPDIR/.config > $TOPDIR/.config.split
mkdir -p $TOPDIR/.cfg
cd $TOPDIR/.cfg
-oldfiles=$(echo *)
+oldfiles=$(print -r -- *)
newfiles=:
-echo -n 'autosplitting main config...'
+print -nu2 'autosplitting main config...'
while read line; do
oline=$line
- [[ -n $line ]] && if [[ $line = @(# [A-Z])* ]]; then
+ [[ -n $line ]] && if [[ $line = @(\# [A-Z])* ]]; then
line=${line#? }
if [[ $line = *@( is not set) ]]; then
line=${line% is not set}
@@ -28,12 +28,12 @@ while read line; do
fi
elif [[ $line = @([A-Z])*@(=)* ]]; then
line=${line%%=*}
- elif [[ $line = @(#)* ]]; then
+ elif [[ $line = \#* ]]; then
# valid comment
line=
else
# invalid non-comment
- echo "Warning: line '$oline' invalid!" >&2
+ print -u2 "\nWarning: line '$oline' invalid!"
line=
fi
# if the line is a valid yes/no/whatever, write it
@@ -44,9 +44,9 @@ while read line; do
else
fline=
fi
- [[ $oline = $fline ]] || echo "$oline" >$line
+ [[ $oline = $fline ]] || print -r -- "$oline" >$line
if [[ $newfiles = *:$line:* ]]; then
- echo "Error: duplicate Config.in option '$line'!" >&2
+ print -u2 "\nError: duplicate Config.in option '$line'!"
exit 1
fi
newfiles=$newfiles$line:
@@ -54,11 +54,11 @@ while read line; do
done <$TOPDIR/.config.split
# now handle the case of removals
-echo -n ' removals...'
+print -nu2 ' removals...'
for oldfile in $oldfiles; do
[[ $newfiles = *:$oldfile:* ]] || rm -f $oldfile
done
-printf '\r%60s\r' ''
+print -nu2 '\r'
# now scan for dependencies of packages; the information
# should probably be in build_mipsel because it's generated
@@ -69,18 +69,19 @@ printf '\r%60s\r' ''
cd $TOPDIR/.cfg
rm -f $TOPDIR/package/*/info.mk
for option in *; do
- echo -n "$option ..."
- x=$(( ${#option} + 4 ))
+ pbar="$option ..."
+ print -nu2 "$pbar\r"
ao=:
fgrep -l $option $TOPDIR/package/*/{Makefile,Config.*} 2>&- | \
while read line; do
- echo ${line%/*}/info.mk
+ print -r -- ${line%/*}/info.mk
done | while read fname; do
[[ $ao = *:$fname:* ]] && continue
ao=$ao$fname:
echo "\${_IPKGS_COOKIE}: \${TOPDIR}/.cfg/$option" >>$fname
done
- printf '\r%'$x's\r' ''
done
+pbar=done
+print -u2 "$pbar"
exit 0