Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (53584b23ef97d1cad7aaebb496df4402a0e3d6e4)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (53584b23ef97d1cad7aaebb496df4402a0e3d6e4)
  • Date: Thu, 7 Feb 2019 00:12:51 +0000

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

var/lib/sorcery/modules/url_handlers/url_http | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 53584b23ef97d1cad7aaebb496df4402a0e3d6e4
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

url_http: Implement a faster url_http_expand with find + awk

Simpler, one shot per URL implementation.

diff --git a/var/lib/sorcery/modules/url_handlers/url_http
b/var/lib/sorcery/modules/url_handlers/url_http
index 0f6ead4..5450b0b 100755
--- a/var/lib/sorcery/modules/url_handlers/url_http
+++ b/var/lib/sorcery/modules/url_handlers/url_http
@@ -151,11 +151,10 @@ url_ftp_netselect() {
## @stdout the expanded form of those urls
#-------------------------------------------------------------------------
url_http_expand() {
- local A=$'\a'
local URL rep tgt my_hostname each
# put the requested url first
- echo "$@"
- for URL in $@ ; do
+ echo "$*"
+ for URL in "$@"; do
my_hostname=$(url_hostname ${URL})
# a mirror is listed in the mirror listings as either
# ftp://foo.somemirror.org/stuff
@@ -164,12 +163,17 @@ url_http_expand() {
# note neither ends in a '/' but one has a '/' at the end of the
# hostname, the other has an end of line. The \(/\|\$\) stuff matches
# either
- for each in $(grep -lr "://$my_hostname\(/\|\$\)" --exclude-dir=config
$MIRRORS); do
- rep=$(grep "://$my_hostname\(/\|\$\)" $each|awk '{print $NF; exit 0;
}')
- for tgt in $(awk '{print $NF}' $each|grep -v '^Custom$'); do
- echo ${URL}|sed "s$A${rep}$A${tgt}$A"
- done
- done |grep -v $my_hostname
+ find "$MIRRORS" -name config -prune -type f -exec \
+ awk -vurl="$URL" -vhost="://$my_hostname(/|\$)" '
+ FNR == 1 {
+ if (matched) for (i in mirrors) {
+ t = url; sub(host, i, t); print t
+ }
+ split("", mirrors); matched = 0
+ }
+ $NF ~ host { matched++; next }
+ { mirrors[$NF] }
+ ' {} +
done
}




  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (53584b23ef97d1cad7aaebb496df4402a0e3d6e4), Ismael Luceno, 02/06/2019

Archive powered by MHonArc 2.6.24.

Top of Page