* initial build progress indicator for target and emerge

git-svn-id: https://svn.exactcode.de/t2/trunk@73488 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
This commit is contained in:
René Rebe 2025-01-28 18:53:20 +00:00
parent c55a38c2d3
commit 278a3f1f74
4 changed files with 29 additions and 33 deletions

View File

@ -1,14 +1,9 @@
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# T2 SDE: misc/output/terminal
# Copyright (C) 2004 - 2023 The T2 SDE Project
# --- T2-COPYRIGHT-BEGIN ---
# t2/misc/output/terminal
# Copyright (C) 2004 - 2025 The T2 SDE Project
# Copyright (C) 1998 - 2003 ROCK Linux Project
#
# This Copyright note is generated by scripts/Create-CopyPatch,
# more information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
# --- T2-COPYRIGHT-NOTE-END ---
# SPDX-License-Identifier: GPL-2.0
# --- T2-COPYRIGHT-END ---
. scripts/core-functions.in
@ -73,13 +68,13 @@ echo_pkg_deny_terminal() {
# We start building a package.
#
# Usage: echo_pkg_start <stagelevel> <repository> <package-name> <ver>
# Usage: echo_pkg_start <stagelevel> <repository> <package-name> <ver> <esttime> <progress>
#
# E.g. echo_pkg_start $stagelevel $repository $pkg $ver $extraver $esttime
# E.g. echo_pkg_start $stagelevel $repository $pkg $ver $extraver $esttime $progress
#
echo_pkg_start_terminal() {
buildstart="`date '+%s'`"
date "+%n${term_color_header}%T Building $1-$2/$3 ($4)$(fmt_time $6)${term_color_normal}"
date "+%n${term_color_header}%T ${7:+$7 }Building $1-$2/$3 ($4)$(fmt_time $6)${term_color_normal}"
}
# We finished building a package.

View File

@ -27,6 +27,7 @@ debug=0
chroot=0
root=""
id=''
progress=
stagelevel=9
this_is_the_2nd_run=0
@ -66,6 +67,7 @@ while [ "$1" ]; do
-chroot) options="$options $1" chroot=1 ;;
-chr-sub) options="$options $1" chroot=0 ;;
-cfg) options="$options $1 $2" config="$2" ; shift ;;
-progress) options="$options $1 $2" progress="$2" ; shift ;;
-root) options="$options $1 $2" root="$2" ; shift ;;
-prefix) options="$options $1 $2" prefix="$2" prefix_auto=0 ; shift ;;
-id) options="$options $1 $2" id="$2" ; shift ;;
@ -402,7 +404,7 @@ init_vars_and_hooks
parse_desc $pkg
echo_pkg_start $stagelevel $repository $xpkg $ver "$extraver" "$(pkgbuildtime $pkg)"
echo_pkg_start $stagelevel $repository $xpkg $ver "$extraver" "$(pkgbuildtime $pkg)" "$progress"
if [ "$SDECFG_PARANOIA_CHECK" = 1 ]; then
x="`scripts/Check-PkgFormat $pkg`"
@ -973,7 +975,7 @@ EOT
if [ "$SDECFG_VERBOSE" = 1 -o "$verbose" = 1 ]; then
tee $root/var/adm/logs/$stagelevel-$xpkg.out |
# possible without awk?
gawk "/$/ {print; printf \"\x1b[1;35m^$stagelevel-$xpkg\x1b[0m\r\"; fflush();}"
gawk "/$/ {print; printf \"\x1b[1;35m^${progress:+-$progress}-$xpkg\x1b[0m\r\"; fflush();}"
else
cat > $root/var/adm/logs/$stagelevel-$xpkg.out
fi

View File

@ -1,16 +1,11 @@
#!/usr/bin/env bash
#
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# T2 SDE: scripts/Build-Target
# Copyright (C) 2004 - 2024 The T2 SDE Project
# --- T2-COPYRIGHT-BEGIN ---
# t2/scripts/Build-Target
# Copyright (C) 2004 - 2025 The T2 SDE Project
# Copyright (C) 1998 - 2003 ROCK Linux Project
#
# This Copyright note is generated by scripts/Create-CopyPatch,
# more information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
# --- T2-COPYRIGHT-NOTE-END ---
# SPDX-License-Identifier: GPL-2.0
# --- T2-COPYRIGHT-END ---
#
# Run this command from the T2 SDE base directory as scripts/Build-Target
# after running the scripts/Config and the now optional
@ -81,8 +76,8 @@ pkgloop() {
else
nobrokendeps=""
fi
if [ -z "$build_only_this_job" ]; then
if [ -z "$build_only_this_job" ]; then
if [ "`ls ${build_root}/var/adm/logs/*.err 2> /dev/null`" ]; then
echo_header "Removing old error logs ..."
for y in 0 1 2 3 4 5 6 7 8 9; do
@ -104,14 +99,17 @@ pkgloop() {
done
fi
pkgs=$(grep "^X" config/$config/packages | wc -l)
pkgi=0
while
next="`scripts/Create-PkgQueue \
-cfg "$config" -single $nobrokendeps`"
next="`scripts/Create-PkgQueue -cfg "$config" -single $nobrokendeps`"
set +x
[ "$next" ]
do
((pkgi++))
pkgloop_package $next
done
else
rm -f "${build_root}"/var/adm/logs/${build_only_this_job}.log"
rm -f "${build_root}"/var/adm/logs/${build_only_this_job}.err"
@ -198,8 +196,7 @@ pkgloop_package() {
stagelevel="$1" pkg_depnr="$2" pkg_stages="$3" pkg_pri="$4" pkg_tree="$5"
pkg_name="$6" pkg_ver="$7" pkg_prefix="$8" pkg_extra="$9"
[ "$build_only_this_job" -a \
"$stagelevel-$pkg_name" != "$build_only_this_job" ] && return
[ "$build_only_this_job" -a "$stagelevel-$pkg_name" != "$build_only_this_job" ] && return
[ $(expr "$pkg_stages" : ".*$stagelevel.*") -eq 0 ] && return
pkg_laststage=$(echo "$pkg_stages" | sed "s,-,,g; s,.*\(.\),\1,")
@ -215,7 +212,7 @@ pkgloop_package() {
scripts/Download -cfg $config $downloadopt $pkg_name
fi
cmd_buildpkg="scripts/Build-Pkg -$stagelevel -cfg $config $verbose"
cmd_buildpkg="scripts/Build-Pkg -$stagelevel -cfg $config $verbose -progress $pkgi/$pkgs"
cmd_buildpkg="$cmd_buildpkg $noclearsrc $xtrace $cmd_root $cmd_prefix $pkg_name"
# Execute action handler

View File

@ -360,10 +360,12 @@ fi
[ $dryrun = 1 ] && exit
[ $backup = 1 ] && options="$options -update"
i=0
pkgs=$(echo "$deplist" | wc -w)
for pkg in $deplist; do
if scripts/Download -cfg $config $dloptions $pkg; then
if [ $downloadonly != 1 ] &&
! scripts/Build-Pkg $options $pkg; then
! scripts/Build-Pkg $options -progress $((++i))/$pkgs $pkg; then
if [ $SDECFG_CONTINUE_ON_ERROR_AFTER -gt 8 ]; then
echo "Aborting further builds due to config setting CONTINUE_ON_ERROR_AFTER."
exit 1