Skip to content

Commit

Permalink
[merge] from unstable into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
OneCDOnly committed May 4, 2024
2 parents 955ddef + 5f59eab commit a19dcfd
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 42 deletions.
Binary file modified objects.tar.gz
Binary file not shown.
Binary file modified sherpa-manager.tar.gz
Binary file not shown.
11 changes: 0 additions & 11 deletions support/build-objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ echo $public_function_name':Init()
{ '$_placeholder_flag_'='$state_default'
'$_placeholder_log_changes_flag_'='$state_logmods' ;}

'$public_function_name'.IsNt()
{ [[ $'$_placeholder_flag_' != '\'true\'' ]] ;}
'$public_function_name'.IsSet()
{ [[ $'$_placeholder_flag_' = '\'true\'' ]] ;}
Expand All @@ -57,14 +54,6 @@ echo $public_function_name':Init()
'$_placeholder_flag_'=true
[[ $'$_placeholder_log_changes_flag_' = '\'true\'' ]] && DebugVar '$_placeholder_flag_' ;}
'$public_function_name':UnSet()
{ [[ $'$_placeholder_flag_' != '\'true\'' ]] && return
'$_placeholder_flag_'=false
[[ $'$_placeholder_log_changes_flag_' = '\'true\'' ]] && DebugVar '$_placeholder_flag_' ;}
'$public_function_name':NoLogMods()
{ '$_placeholder_log_changes_flag_'=false ;}
'$public_function_name':Init' >> "$target"

return 0
Expand Down
126 changes: 95 additions & 31 deletions support/sherpa-manager.source
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ LoadEnv()
readonly CACHE_PATH=$THIS_PACKAGE_PATH/cache
readonly ACTION_TIMES_PATH=$CACHE_PATH/action.times
readonly BG_PROCS_PATH=$CACHE_PATH/proc
readonly DEPENDENT_QPKGS_LIST_PATHFILE=$CACHE_PATH/dependents
readonly DISPLAY_INHIBIT_PATHFILE=$CACHE_PATH/display.inhibit
readonly INDEPENDENT_QPKGS_LIST_PATHFILE=$CACHE_PATH/independents
readonly IPK_CACHE_PATH=$CACHE_PATH/IPKs
readonly IPK_DL_PATH=$IPK_CACHE_PATH/downloads
readonly IPK_DOWNGRADE_PATH=$IPK_CACHE_PATH/downgrade
Expand Down Expand Up @@ -1267,7 +1269,7 @@ ProcActions()

rm -f "$SESS_ACTION_RESULTS_PATHFILE" 2> /dev/null

# -> package preparation phase begins here <-
# -> Package preparation phase <-

ProcAction status all QPKG status statused

Expand All @@ -1289,12 +1291,12 @@ ProcActions()
ProcAction reassign all QPKG reassign reassigned
ProcAction download all QPKG download downloaded

# If download of any QPKG failed, don't execute any futher actions.
# If download of any QPKG failed, don't execute further actions.

if QPKGs-ACdownload-er.IsNone && QPKGs-ACdownload-se.IsNone; then
# -> package removal phase begins here <-
if QPKGs-ACdownload-er.IsNone && QPKGs-ACdownload-se.IsNone && QPKGs-ACdownload-sa.IsNone; then
# -> Package removal phase <-

for ((tier_index=${#PACKAGE_TIERS[@]}-1; tier_index>=0; tier_index--)); do # Process tiers in-reverse
for ((tier_index=${#PACKAGE_TIERS[@]}-1; tier_index>=0; tier_index--)); do # Process tiers in-reverse
tier=${PACKAGE_TIERS[$tier_index]}

case $tier in
Expand All @@ -1313,7 +1315,7 @@ ProcActions()
esac
done

# -> package installation phase begins here <-
# -> Package installation phase <-

for tier in "${PACKAGE_TIERS[@]}"; do
case $tier in
Expand All @@ -1337,6 +1339,7 @@ ProcActions()
ipks_install=true
ipks_upgrade=true
pips_install=true

break
fi
done
Expand Down Expand Up @@ -1378,7 +1381,7 @@ ProcActions()
ProcAction()
{

# Run a single action on an entire tier of packages, asynchronously where possible.
# Run a single action on an entire tier of packages, asynchronously where-possible.

# Input:
# $1 = $TARGET_ACTION e.g. `activate`, `reactivate` ...
Expand Down Expand Up @@ -1563,6 +1566,15 @@ ProcAction()
wait 2>/dev/null
CloseActionMsgPipe

# TODO: Process unactioned QPKGs here (if-any), and mark them as aborted.

# for package in $(QPKGs-AC${TARGET_ACTION}-to:Array); do
# if ! QPKGs-AC${TARGET_ACTION}-dn.Exist "$package"; then
# QPKGs-AC${TARGET_ACTION}-sa:Add "$package"
# QPKGs-AC${TARGET_ACTION}-dn:Add "$package"
# fi
# done

[[ ${useropt_terse:=true} = false && $useropt_verbose = false ]] && echo
;;
IPK|PIP)
Expand Down Expand Up @@ -1684,6 +1696,8 @@ PrepareArgs()
# Output:
# $args[] (global)

ShowAsProc args

local a=$(Lowercase "${ARGS_RAW//,/ }")
args=(${a/--/})
arg_problem=false
Expand Down Expand Up @@ -6588,8 +6602,8 @@ QPKGs.Missing:Show()
# $? = 0 if no packages are missing
# $? = 1 if one-or-more packages are missing

QPKGs.AClist.ISmissing.IsNt || return 0
QPKGs.ACreinstall.ISmissing.IsNt || return 0
! QPKGs.AClist.ISmissing.IsSet || return 0
! QPKGs.ACreinstall.ISmissing.IsSet || return 0

local a=''
local b=''
Expand Down Expand Up @@ -6641,8 +6655,8 @@ QPKGs.NewVers:Show()
# $? = 0 if all packages are up-to-date
# $? = 1 if one-or-more packages can be upgraded

QPKGs.AClist.ISupgradable.IsNt || return 0
QPKGs.ACupgrade.ISupgradable.IsNt || return 0
! QPKGs.AClist.ISupgradable.IsSet || return 0
! QPKGs.ACupgrade.ISupgradable.IsSet || return 0

local a=''
local b=''
Expand Down Expand Up @@ -6891,26 +6905,56 @@ QPKGs.States:List()

}

QPKGs.IndependentDependent:Build()
QPKGs.Tiers:Build()
{

FuncInit

# There are three tiers of package: `independent`, `auxiliary` and `dependent`.
# ... but only two tiers of QPKG: `independent` and `dependent`.

# `independent` QPKGs don't depend-on other QPKGs, but may be required for other QPKGs. They should be installed/activated before any `dependent` QPKGs.
# `dependent` QPKGs depend-on other QPKGs. They should be installed/activated after all `independent` QPKGs.

for qpkg_name in "${QPKG_NAME[@]}"; do
QpkgSetIndex
if [[ ${qpkgs_tiers_built:=false} = true ]]; then
DebugAsDone "don't build tiers: they're already built"

if QpkgIsDependent; then
QPKGs-GRdependent:Add "$qpkg_name"
else
QPKGs-GRindependent:Add "$qpkg_name"
fi
done
FuncExit; return
fi

return 0
local previous=''

if [[ ! -e $DEPENDENT_QPKGS_LIST_PATHFILE || ! -e $INDEPENDENT_QPKGS_LIST_PATHFILE ]]; then
ShowAsProc tiers
rm -f "$DEPENDENT_QPKGS_LIST_PATHFILE" "$INDEPENDENT_QPKGS_LIST_PATHFILE" 2> /dev/null

for qpkg_name in "${QPKG_NAME[@]}"; do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name

QpkgSetIndex

if QpkgIsDependent; then
echo "$qpkg_name" >> "$DEPENDENT_QPKGS_LIST_PATHFILE"
else
echo "$qpkg_name" >> "$INDEPENDENT_QPKGS_LIST_PATHFILE"
fi
done

qpkgs_tiers_built=true
fi

[[ -e $DEPENDENT_QPKGS_LIST_PATHFILE ]] && QPKGs-GRdependent:Add "$(<$DEPENDENT_QPKGS_LIST_PATHFILE)"
[[ -e $INDEPENDENT_QPKGS_LIST_PATHFILE ]] && QPKGs-GRindependent:Add "$(<$INDEPENDENT_QPKGS_LIST_PATHFILE)"

FuncExit

}

QPKGs.Tiers:Init()
{

rm -f "$DEPENDENT_QPKGS_LIST_PATHFILE" "$INDEPENDENT_QPKGS_LIST_PATHFILE" 2> /dev/null
qpkgs_tiers_built=false

}

Expand Down Expand Up @@ -7161,10 +7205,12 @@ QPKGs.IsCanBackup:Build()

FuncInit

local a=''
local previous=''
local qpkg_name=''

for a in $(QPKGs-GRall:Array); do
QpkgIsCanBackup "$a" && QPKGs-GRcanbackup:Add "$a"
for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
QpkgIsCanBackup "$qpkg_name" && QPKGs-GRcanbackup:Add "$qpkg_name"
done

FuncExit
Expand All @@ -7178,10 +7224,12 @@ QPKGs.IsCanRestartToUpdate:Build()

FuncInit

local a=''
local previous=''
local qpkg_name=''

for a in $(QPKGs-GRall:Array); do
QpkgIsCanRestartToUpdate "$a" && QPKGs-GRcanrestarttoupdate:Add "$a"
for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
QpkgIsCanRestartToUpdate "$qpkg_name" && QPKGs-GRcanrestarttoupdate:Add "$qpkg_name"
done

FuncExit
Expand All @@ -7195,10 +7243,12 @@ QPKGs.IsCanClean:Build()

FuncInit

local a=''
local previous=''
local qpkg_name=''

for a in $(QPKGs-GRall:Array); do
QpkgIsCanClean "$a" && QPKGs-GRcanclean:Add "$a"
for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
QpkgIsCanClean "$qpkg_name" && QPKGs-GRcanclean:Add "$qpkg_name"
done

FuncExit
Expand All @@ -7224,6 +7274,7 @@ Help.Abbreviations:Show()
local f=''
local -i m=0
local -i n=0
local previous=''
report_cols_max=3

LoadPackages
Expand All @@ -7240,6 +7291,7 @@ Help.Abbreviations:Show()
} > "$REPORT_OUTPUT_PATHFILE"

for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
((n++))
QpkgSetIndex
DisplayAsAbsReportItemLine > "$REPORTS_PATH/$n" &
Expand Down Expand Up @@ -7341,6 +7393,7 @@ ShowReportDependencies()
report_cols_max=8
local -i m=0
local -i n=0
local previous=''

DisableDebugToArchiveAndFile
DisplayProcReport dependency
Expand All @@ -7349,6 +7402,7 @@ ShowReportDependencies()
DisplayAsDepsReportTitleLine > "$REPORT_OUTPUT_PATHFILE"

for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
((n++))
QpkgSetIndex
DisplayAsDepsReportItemLine > "$REPORTS_PATH/$n" &
Expand Down Expand Up @@ -7396,6 +7450,7 @@ ShowReportFeatures()
report_cols_max=7
local -i m=0
local -i n=0
local previous=''

DisableDebugToArchiveAndFile
DisplayProcReport features
Expand All @@ -7404,6 +7459,7 @@ ShowReportFeatures()
DisplayAsFeaturesReportTitleLine > "$REPORT_OUTPUT_PATHFILE"

for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
((n++))
QpkgSetIndex
DisplayAsFeaturesReportItemLine > "$REPORTS_PATH/$n" &
Expand Down Expand Up @@ -7455,6 +7511,7 @@ ShowReportPackages()

FuncInit

local previous=''
report_cols_max=3

DisableDebugToArchiveAndFile
Expand All @@ -7467,6 +7524,7 @@ ShowReportPackages()
DisplayAsPacksReportTitleLine

for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
QpkgSetIndex
DisplayAsPacksReportItemLine "$qpkg_name"
done
Expand Down Expand Up @@ -7500,13 +7558,15 @@ ShowReportRepos()
report_cols_max=3
local -i m=0
local -i n=0
local previous=''

DisableDebugToArchiveAndFile
DisplayProcReport repository
ResetReportsPath &>/dev/null
DisplayAsReposReportTitleLine > "$REPORT_OUTPUT_PATHFILE"

for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
((n++))
QpkgSetIndex
DisplayAsReposReportItemLine > "$REPORTS_PATH/$n" &
Expand Down Expand Up @@ -7551,6 +7611,7 @@ ShowReportStatuses()
local -i m=0
report_cols_max=5
local -i n=0
local previous=''

DisableDebugToArchiveAndFile
DisplayProcReport status
Expand All @@ -7560,6 +7621,7 @@ ShowReportStatuses()
DisplayAsStatusReportTitleLine > "$REPORT_OUTPUT_PATHFILE"

for qpkg_name in $(QPKGs-GRall:Array); do
[[ $previous = "$qpkg_name" ]] && continue || previous=$qpkg_name
QPKGs-ACstatus-dn.Exist "$qpkg_name" || continue
((n++))
QpkgSetIndex
Expand Down Expand Up @@ -13061,6 +13123,8 @@ LoadPackages()
if $CURL_CMD --silent --fail "$PACKAGES_ARCHIVE_URL" > "$PACKAGES_ARCHIVE_PATHFILE"; then
$TAR_CMD --extract --gzip --no-same-owner --file="$PACKAGES_ARCHIVE_PATHFILE" --directory="$CACHE_PATH"
fi

QPKGs.Tiers:Init
fi
fi

Expand Down Expand Up @@ -13168,7 +13232,7 @@ LoadPackages()

DebugVar PACKAGES_VER
QPKGs-GRall:Add "${QPKG_NAME[*]}"
QPKGs.IndependentDependent:Build
QPKGs.Tiers:Build

FuncExit

Expand Down

0 comments on commit a19dcfd

Please sign in to comment.