From 5e31b33fbe30f7b1775b89fc23abd6c96675cf99 Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 14 Feb 2022 00:36:38 +0000 Subject: updated xisync to work faster --- src/xiget.sh | 12 ++++++++++++ src/xisync.sh | 28 ++++++++++++---------------- xipkg.conf | 12 +++++++++--- 3 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 src/xiget.sh diff --git a/src/xiget.sh b/src/xiget.sh new file mode 100644 index 0000000..815c47f --- /dev/null +++ b/src/xiget.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +export CONF_FILE="/etc/xipkg.conf" + +CURL_OPTS="-SsL" + +DEP_GRAPH=$(parseconf -v dir.deps) + +get_deps() { + local name=$1 + [ -f $DEP_GRAPH ] && sed -rn "s/^$name: (.*)/\1/p" $DEP_GRAPH || echo +} diff --git a/src/xisync.sh b/src/xisync.sh index 213f826..5349dd2 100755 --- a/src/xisync.sh +++ b/src/xisync.sh @@ -82,13 +82,6 @@ dep_graph () { local package=$(echo $line | cut -d: -f1) local new=$(echo $line | cut -d: -f2-) echo $new >> $DEP_GRAPH/$package - #local existing=$(get_deps $name) - - #sed -i "/^$package:.*$/d" $DEP_GRAPH - - #local all=$(echo "$new $existing" | tr ' ' '\n' | sort -u | tr '\n' ' ') - #echo "$package: $all" >> $DEP_GRAPH - #echo $line >> $DEP_GRAPH done < "$tmp_file" fi } @@ -117,8 +110,9 @@ popularity_contest () { index_deps () { local l=$1 - total=${#SOURCES[*]} - completed=0 + local total=${#SOURCES[*]} + local completed=0 + for src in ${SOURCES[*]}; do dep_graph $src completed=$((completed+1)) @@ -128,10 +122,10 @@ index_deps () { } index_repo () { - local repo=$1 - local l=$2 - total=$((${#SOURCES[*]})) - completed=0 + local repo=$1 l=$2 + local total=${#SOURCES[*]} + local completed=0 + for src in ${SOURCES[*]}; do list_source $repo $src completed=$((completed+1)) @@ -148,22 +142,24 @@ sync () { rm -r $DEP_GRAPH mkdir $DEP_GRAPH - i=1 # create padding spaces for each hbar for repo in ${REPOS[*]}; do hbar done + # download package lists and dep graphs at the same time index_deps 0 & + local i=1 for repo in ${REPOS[*]}; do index_repo $repo $i & i=$((i+1)) done - + # wait for all jobs to complete wait - hbar + # determine which version of which package should be regarded + hbar popularity_contest } diff --git a/xipkg.conf b/xipkg.conf index 086668b..08f3fd4 100644 --- a/xipkg.conf +++ b/xipkg.conf @@ -1,13 +1,15 @@ -# This is the default configuration for xipkg +# load the default config for xipkg # include /etc/xipkg.d/default.conf +# list of sources of where to find repos +# +# Keep this list short, with a few local mirrors +# ensure that you have a bit of redunancy in case of back up sources { localhost http://localhost:8089/repo/ davidovski https://xi.davidovski.xyz/repo/ - codeberg https://xi.codeberg.page/repo/ ftp https://xilinux.ftp.sh/repo/ - ro https://xi.ro.lt/repo/ } # The sources to download the keys from @@ -15,6 +17,10 @@ key_authority [ davidovski ] +# list of repos +# +# these repos will be search for packages +# anything in any other repos will not be checked repos [ xi system -- cgit v1.2.1