summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-02-14 00:36:38 +0000
committerdavidovski <david@davidovski.xyz>2022-02-14 00:36:38 +0000
commit5e31b33fbe30f7b1775b89fc23abd6c96675cf99 (patch)
tree701251552c86a037226c180af332d56a180a3791 /src
parent9f529b0e85c7b38e97d8ebb0371f7a6859f882f4 (diff)
updated xisync to work faster
Diffstat (limited to 'src')
-rw-r--r--src/xiget.sh12
-rwxr-xr-xsrc/xisync.sh28
2 files changed, 24 insertions, 16 deletions
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
}