Skip to content

Commit

Permalink
Merge pull request #106 from infosiftr/mirrors
Browse files Browse the repository at this point in the history
Switch to upstream mirror for scraping version numbers
  • Loading branch information
yosifkit authored Jun 21, 2024
2 parents 6f09c34 + dfd9a5f commit df37ca5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions 10/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 11/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 12/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 13/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 14/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ ENV GCC_MIRRORS \
https://bigsearcher.com/mirrors/gcc/releases \
http://www.netgull.com/gcc/releases \
https://ftpmirror.gnu.org/gcc \
# "sourceware.org" is the canonical upstream release host (the host of "gcc.gnu.org")
https://sourceware.org/pub/gcc/releases \
# only attempt the origin FTP as a mirror of last resort
ftp://ftp.gnu.org/gnu/gcc

Expand Down
7 changes: 3 additions & 4 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ debianStable="$(awk <<<"$debianStable" '$1 == "Codename:" { print $2; exit }')"
[ -n "$debianStable" ]
defaultDebianSuite="$debianStable"

#packagesUrl='https://ftpmirror.gnu.org/gcc/'
packagesUrl='https://mirrors.kernel.org/gnu/gcc/' # the actual HTML of the page changes based on which mirror we end up hitting, so let's hit a specific one for now... :'(
packagesUrl='https://sourceware.org/pub/gcc/releases/?C=M;O=D' # the actual HTML of the page changes based on which mirror we end up hitting, *and* sometimes specific mirrors are missing versions, so let's hit the original canonical host for version scraping
packages="$(wget -qO- "$packagesUrl")"

# our own "supported" window is 18 months from the most recent release because upstream doesn't have a good guideline, but appears to only release maintenance updates for 2-3 years after the initial release
Expand All @@ -50,8 +49,8 @@ eols=()
dateFormat='%Y-%m-%d'

for version in "${versions[@]}"; do
fullVersion="$(grep -E '<a href="(gcc-)?'"$version." <<<"$packages" | sed -r 's!.*<a href="(gcc-)?([^"/]+)/?".*!\2!' | sort -V | tail -1)"
lastModified="$(grep -Em1 '<a href="(gcc-)?'"$fullVersion"'/"' <<<"$packages" | awk -F ' +' '{ print $2 }')"
fullVersion="$(grep -P '<a href="(gcc-)?\Q'"$version."'\E' <<<"$packages" | sed -r 's!.*<a href="(gcc-)?([^"/]+)/?".*!\2!' | sort -V | tail -1)"
lastModified="$(grep -Pm1 '<a href="(gcc-)?\Q'"$fullVersion"'\E/"' <<<"$packages" | grep -oPm1 '(?<![0-9])[0-9]{4}-[0-9]{2}-[0-9]{2}(?![0-9])')"
lastModified="$(date -d "$lastModified" +"$dateFormat")"

lastModifiedTime="$(date +'%s' -d "$lastModified")"
Expand Down

0 comments on commit df37ca5

Please sign in to comment.