Github messages for voidlinux
 help / color / mirror / Atom feed
From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] update-check: download each url once
Date: Thu, 09 May 2019 10:11:47 +0200	[thread overview]
Message-ID: <20190509081147.hOFGtcyFhVhUV0NC7niBkS5KVVQ76wCml4Bu7_kxTPk@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-6395@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

There is an updated pull request by Chocimier against master on the void-packages repository

https://github.com/Chocimier/void-packages-org update-check-fetch-once
https://github.com/void-linux/void-packages/pull/6395

update-check: download each url once
Speed up for packages with multiple downloads from same location or having homepage and distfiles at gitlab or github.

A patch file from https://github.com/void-linux/void-packages/pull/6395.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-update-check-fetch-once-6395.patch --]
[-- Type: application/text/x-diff, Size: 1781 bytes --]

From ea8112b11c686b5d1b7beb46c86298ad323e0af3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Mon, 31 Dec 2018 12:34:10 +0100
Subject: [PATCH] update-check: download each url once

---
 common/xbps-src/shutils/update_check.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/xbps-src/shutils/update_check.sh b/common/xbps-src/shutils/update_check.sh
index ef88bd5f4a4..61caedd053a 100644
--- a/common/xbps-src/shutils/update_check.sh
+++ b/common/xbps-src/shutils/update_check.sh
@@ -4,7 +4,7 @@ update_check() {
     local i p url sfname lpname bbname githubname rx found_version consider
     local update_override=$XBPS_SRCPKGDIR/$XBPS_TARGET_PKG/update
     local original_pkgname=$pkgname
-    local urlpfx urlsfx
+    local urlpfx urlsfx fetchedurls
 
     if [ -r $update_override ]; then
         . $update_override
@@ -103,11 +103,19 @@ update_check() {
         rx=${pattern:-$rx}
         rx=${rx:-'(?<!-)\b\Q'"$pkgname"'\E[-_]?((src|source)[-_])?\K([^-/_\s]*?\d[^-/_\s]*?)(?=(?:[-_.](?:src|source|orig))?\.(?:[jt]ar|shar|t[bglx]z|tbz2|zip))\b'}
 
+        if printf '%s' "$fetchedurls" | grep -qFx "$url"; then
+            if [ -n "$XBPS_UPDATE_CHECK_VERBOSE" ]; then
+                echo "already fetched $url" 1>&2
+            fi
+            continue
+        fi
+
         if [ -n "$XBPS_UPDATE_CHECK_VERBOSE" ]; then
             echo "fetching $url" 1>&2
         fi
         curl -H 'Accept: text/html,application/xhtml+xml,application/xml,text/plain,application/rss+xml' -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 -Lsk "$url" |
             grep -Po -i "$rx"
+        fetchedurls="$(printf '%s\n%s' "$fetchedurls" "$url")"
     done |
     tr _ . |
     sort -Vu |

  parent reply	other threads:[~2019-05-09  8:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-6395@inbox.vuxu.org>
2019-05-09  8:09 ` voidlinux-github
2019-05-09  8:09 ` voidlinux-github
2019-05-09  8:11 ` voidlinux-github [this message]
2019-05-09  8:11 ` voidlinux-github
2019-06-11 20:11 ` voidlinux-github
2019-06-11 20:11 ` voidlinux-github

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190509081147.hOFGtcyFhVhUV0NC7niBkS5KVVQ76wCml4Bu7_kxTPk@z \
    --to=voidlinux-github@inbox.vuxu.org \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).