@@ -19,18 +19,50 @@ class << self
1919 SYNC = 'var/lib/pacman/sync'
2020 LOCAL = 'var/lib/pacman/local'
2121
22- PKG_NAME , PKG_PRE =
23- case ARGV [ 0 ] . downcase
24- when 'ucrt64'
22+ PKG_DIR , PKG_PRE =
23+ case ARGV [ 0 ] . downcase [ /[^-]+/ ]
24+ when 'ucrt64' , 'ucrt64-3.0'
2525 [ 'ucrt64' , 'mingw-w64-ucrt-x86_64-' ]
26- when 'mingw64'
26+ when 'mingw64' , 'mingw64-3.0'
2727 [ 'mingw64' , 'mingw-w64-x86_64-' ]
28- when 'mingw32'
28+ when 'mingw32' , 'mingw32-3.0'
2929 [ 'mingw32' , 'mingw-w64-i686-' ]
3030 else
3131 STDOUT . syswrite "Invalid package type, must be ucrt64, mingw64, or mingw32\n "
3232 exit 1
3333 end
34+
35+ PKG_NAME = ARGV [ 0 ] . downcase
36+
37+ def add_ri2_key
38+ # appveyor ri2 package signing key
39+ key = 'F98B8484BE8BF1C5'
40+ exec_check "pacman-key --init" , "bash.exe -c \" pacman-key --init\" "
41+ exec_check "Get RI2 Key" , "bash.exe -c \" pacman-key --recv-keys #{ key } \" "
42+ exec_check "Sign RI2 Key" , "bash.exe -c \" pacman-key --lsign-key #{ key } \" "
43+ end
44+
45+ def openssl_upgrade
46+ add_ri2_key
47+
48+ pkg_name = "openssl-3.0.5-1-any.pkg.tar.zst"
49+ pkg = "https://github.com/oneclick/rubyinstaller2-packages/releases/download/ci.ri2/#{ PKG_PRE } #{ pkg_name } "
50+ pkg_sig = "#{ pkg } .sig"
51+ old_dlls = %w[ libcrypto-1_1-x64.dll libssl-1_1-x64.dll ]
52+ dll_root = "#{ MSYS2_ROOT } /#{ PKG_DIR } /bin"
53+
54+ # save previous dll files so we can copy back into folder
55+ old_dlls . each { |fn | FileUtils . cp "#{ dll_root } /#{ fn } " , "." }
56+
57+ download pkg , "./#{ PKG_PRE } #{ pkg_name } "
58+ download pkg_sig , "./#{ PKG_PRE } #{ pkg_name } .sig"
59+
60+ # install package
61+ exec_check "Install OpenSSL Upgrade" , "pacman.exe -Udd --noconfirm --noprogressbar #{ PKG_PRE } #{ pkg_name } "
62+
63+ # copy previous dlls back into MSYS2 folder
64+ old_dlls . each { |fn | FileUtils . cp fn , "#{ dll_root } /#{ fn } " }
65+ end
3466
3567 def install_gcc
3668 args = '--noconfirm --noprogressbar --needed'
@@ -46,6 +78,10 @@ def install_gcc
4678 exec_check "Updating the following #{ PKG_PRE [ 0 ..-2 ] } packages:#{ RST } \n " \
4779 "#{ YEL } #{ ( base_gcc + base_ruby ) . join ' ' } " ,
4880 "#{ PACMAN } -S #{ args } #{ pkgs } "
81+
82+ if PKG_NAME . end_with? '-3.0'
83+ openssl_upgrade
84+ end
4985 end
5086
5187 # copies needed files from C:/msys64 to TEMP
@@ -56,8 +92,8 @@ def copy_to_temp
5692 end
5793
5894 Dir . chdir "#{ MSYS2_ROOT } /#{ SYNC } " do
59- FileUtils . cp "#{ PKG_NAME } .db" , "#{ TAR_DIR } /#{ SYNC } "
60- FileUtils . cp "#{ PKG_NAME } .db.sig" , "#{ TAR_DIR } /#{ SYNC } "
95+ FileUtils . cp "#{ PKG_DIR } .db" , "#{ TAR_DIR } /#{ SYNC } "
96+ FileUtils . cp "#{ PKG_DIR } .db.sig" , "#{ TAR_DIR } /#{ SYNC } "
6197 end
6298
6399 ary = Dir . glob "#{ PKG_PRE } *" , base : "#{ MSYS2_ROOT } /#{ LOCAL } "
@@ -68,12 +104,12 @@ def copy_to_temp
68104 ary . each { |dir | FileUtils . copy_entry dir , "#{ local } /#{ dir } " }
69105 end
70106
71- FileUtils . copy_entry "#{ MSYS2_ROOT } /#{ PKG_NAME } " , "#{ TAR_DIR } /#{ PKG_NAME } "
107+ FileUtils . copy_entry "#{ MSYS2_ROOT } /#{ PKG_DIR } " , "#{ TAR_DIR } /#{ PKG_DIR } "
72108 end
73109
74110 # removes files contained in 'share' folder to reduce 7z file size
75111 def clean_package
76- share = "#{ TAR_DIR } /#{ PKG_NAME } /share"
112+ share = "#{ TAR_DIR } /#{ PKG_DIR } /share"
77113
78114 Dir . chdir "#{ share } /doc" do
79115 ary = Dir . glob "*"
@@ -98,9 +134,9 @@ def clean_package
98134 str = f . read
99135 f . truncate 0
100136 f . rewind
101- str . gsub! ( /^#{ PKG_NAME } \/ share\/ doc\/ \S +\s */m , '' )
102- str . gsub! ( /^#{ PKG_NAME } \/ share\/ info\/ \S +\s */m , '' )
103- str . gsub! ( /^#{ PKG_NAME } \/ share\/ man\/ \S +\s */m , '' )
137+ str . gsub! ( /^#{ PKG_DIR } \/ share\/ doc\/ \S +\s */m , '' )
138+ str . gsub! ( /^#{ PKG_DIR } \/ share\/ info\/ \S +\s */m , '' )
139+ str . gsub! ( /^#{ PKG_DIR } \/ share\/ man\/ \S +\s */m , '' )
104140 f . write "#{ str . strip } \n \n "
105141 }
106142 end
@@ -124,10 +160,10 @@ def run
124160 "Installed #{ PKG_PRE [ 0 ..-2 ] } Packages"
125161
126162 if current_pkgs == updated_pkgs
127- STDOUT . syswrite "\n ** No update to #{ PKG_NAME } gcc tools needed **\n \n "
163+ STDOUT . syswrite "\n ** No update to #{ PKG_DIR } gcc tools needed **\n \n "
128164 exit 0
129165 else
130- STDOUT . syswrite "\n #{ GRN } ** Creating and Uploading #{ PKG_NAME } gcc tools 7z **#{ RST } \n \n "
166+ STDOUT . syswrite "\n #{ GRN } ** Creating and Uploading #{ PKG_DIR } gcc tools 7z **#{ RST } \n \n "
131167 end
132168
133169 copy_to_temp
0 commit comments