tazpkg diff modules/upgrade @ rev 842

tazpkg: internal command 'call ...' to call tazpkg functions from modules (to share functions between tazpkg and its modules)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Sep 02 03:31:47 2015 +0300 (2015-09-02)
parents a02e36d44d06
children d6cbd0c5f273
line diff
     1.1 --- a/modules/upgrade	Fri Aug 28 16:10:34 2015 +0300
     1.2 +++ b/modules/upgrade	Wed Sep 02 03:31:47 2015 +0300
     1.3 @@ -17,36 +17,6 @@
     1.4  . @@MODULES@@/getenv
     1.5  
     1.6  
     1.7 -
     1.8 -
     1.9 -# Functions
    1.10 -# ---------
    1.11 -
    1.12 -# Get repositories priority using $PKGS_DB/priority.
    1.13 -# In this file undigest repos are called by their names and main mirror
    1.14 -# by 'main'. Sort order: priority
    1.15 -
    1.16 -look_for_priority() {
    1.17 -	[ -s "$PKGS_DB/priority" ] && priority=$(cat "$PKGS_DB/priority")
    1.18 -
    1.19 -	for rep in main $(ls "$PKGS_DB/undigest" 2>/dev/null); do
    1.20 -		if [ ! -s "$PKGS_DB/priority" ] || ! grep -q "^$rep$" "$PKGS_DB/priority"; then
    1.21 -			priority=$(echo -e "$priority\n$rep")
    1.22 -		fi
    1.23 -	done
    1.24 -
    1.25 -	priority=$(echo "$priority" | sed '/^$/d' | \
    1.26 -		while read line; do
    1.27 -		case $line in
    1.28 -			(main) echo "$PKGS_DB";;
    1.29 -			(*)    echo "$PKGS_DB/undigest/$line";;
    1.30 -		esac
    1.31 -	done)
    1.32 -}
    1.33 -
    1.34 -
    1.35 -
    1.36 -
    1.37  time="$(date +%s)"
    1.38  
    1.39  # Recharge packages databases (if necessary) (respects already exported "root" value)
    1.40 @@ -56,9 +26,8 @@
    1.41  blocked_counter=$(mktemp)
    1.42  tmp_up_list=$(mktemp)
    1.43  
    1.44 -look_for_priority
    1.45  repo_number=1
    1.46 -for repo in $priority; do
    1.47 +for repo in $(tazpkg call look_for_priority); do
    1.48  	if [ "$repo" == "$PKGS_DB" ]; then
    1.49  		repo_name='Main'
    1.50  	else