Skip to content

Commit 379f757

Browse files
committed
dev(package): work around gnome mirrors with expired certs
what year is it, jfc
1 parent 95cf66c commit 379f757

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ext/nokogiri/extconf.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ def local_have_library(lib, func = nil, headers = nil)
211211
have_library(lib, func, headers) || have_library("lib#{lib}", func, headers)
212212
end
213213

214+
def gnome_source
215+
# As of 2022-02-20, some mirrors have expired SSL certificates. I'm able to retrieve from my home,
216+
# but whatever host is resolved on the github actions workers see an expired cert.
217+
#
218+
# See https://github.com/sparklemotion/nokogiri/runs/5266206403?check_suite_focus=true
219+
if ENV["NOKOGIRI_USE_CANONICAL_GNOME_SOURCE"]
220+
"https://download.gnome.org"
221+
else
222+
"https://mirror.csclub.uwaterloo.ca/gnome" # old reliable
223+
end
224+
end
225+
214226
LOCAL_PACKAGE_RESPONSE = Object.new
215227
def LOCAL_PACKAGE_RESPONSE.%(package)
216228
package ? "yes: #{package}" : "no"
@@ -512,6 +524,7 @@ def recipe.port_path
512524
513525
EOM
514526

527+
pp(recipe.files)
515528
chdir_for_build { recipe.cook }
516529
FileUtils.touch(checkpoint)
517530
end
@@ -772,7 +785,7 @@ def compile
772785
else
773786
minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
774787
recipe.files = [{
775-
url: "https://download.gnome.org/sources/libxml2/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
788+
url: "#{gnome_source}/sources/libxml2/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
776789
sha256: dependencies["libxml2"]["sha256"],
777790
}]
778791
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxml2", "*.patch")].sort
@@ -821,7 +834,7 @@ def compile
821834
else
822835
minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
823836
recipe.files = [{
824-
url: "https://download.gnome.org/sources/libxslt/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
837+
url: "#{gnome_source}/sources/libxslt/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
825838
sha256: dependencies["libxslt"]["sha256"],
826839
}]
827840
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxslt", "*.patch")].sort

0 commit comments

Comments
 (0)