Skip to content

Commit

Permalink
update-check: download each url once
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocimier committed May 9, 2019
1 parent 484e149 commit 732b66d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion common/xbps-src/shutils/update_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 |
Expand Down

0 comments on commit 732b66d

Please sign in to comment.