From f3d39ca01ba8b6a2c9ada7751abdd7bb5ad8a1c0 Mon Sep 17 00:00:00 2001 From: v-chojas <25211973+v-chojas@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:40:26 -0700 Subject: [PATCH] 18.3.1.1 (#95) --- Aliases/msodbcsql18@18.2 | 2 +- Aliases/msodbcsql18@18.3 | 1 + Formula/msodbcsql18.rb | 10 ++--- Formula/msodbcsql18@18.3.1.1.rb | 79 +++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 6 deletions(-) create mode 120000 Aliases/msodbcsql18@18.3 create mode 100755 Formula/msodbcsql18@18.3.1.1.rb diff --git a/Aliases/msodbcsql18@18.2 b/Aliases/msodbcsql18@18.2 index 52f5492..c219413 120000 --- a/Aliases/msodbcsql18@18.2 +++ b/Aliases/msodbcsql18@18.2 @@ -1 +1 @@ -../Formula/msodbcsql18.rb \ No newline at end of file +../Formula/msodbcsql18@18.2.2.1.rb \ No newline at end of file diff --git a/Aliases/msodbcsql18@18.3 b/Aliases/msodbcsql18@18.3 new file mode 120000 index 0000000..52f5492 --- /dev/null +++ b/Aliases/msodbcsql18@18.3 @@ -0,0 +1 @@ +../Formula/msodbcsql18.rb \ No newline at end of file diff --git a/Formula/msodbcsql18.rb b/Formula/msodbcsql18.rb index 78918e6..007389c 100755 --- a/Formula/msodbcsql18.rb +++ b/Formula/msodbcsql18.rb @@ -1,11 +1,11 @@ class Msodbcsql18 < Formula desc "ODBC Driver for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" - url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/0/9/7/0976a30f-1710-4754-9445-bead058dd0c8/msodbcsql18-18.2.2.1-arm64.tar.gz" : - "https://download.microsoft.com/download/0/9/7/0976a30f-1710-4754-9445-bead058dd0c8/msodbcsql18-18.2.2.1-amd64.tar.gz" - version "18.2.2.1" - sha256 Hardware::CPU.arch == :arm64 ? "7f5601b68a714721ac083b5235f3871262195f4ee5952e67686e27a3c90fa339" : - "43155effe8f403135866763b61e0cdebf405f0b3664bfb66ead963edb8d49a21" + url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/d/4/7/d47963dd-a254-4d67-a92a-d3d5466df7e4/msodbcsql18-18.3.1.1-arm64.tar.gz" : + "https://download.microsoft.com/download/d/4/7/d47963dd-a254-4d67-a92a-d3d5466df7e4/msodbcsql18-18.3.1.1-amd64.tar.gz" + version "18.3.1.1" + sha256 Hardware::CPU.arch == :arm64 ? "01e1d2df29f2a3ea9ccb064fce33462e92c9d72f10b6a759b2a6410670794b66" : + "f23542182eebb521032f7a025efe46909fc1f315f1f5c0974005d400a643ad90" option "without-registration", "Don't register the driver in odbcinst.ini" diff --git a/Formula/msodbcsql18@18.3.1.1.rb b/Formula/msodbcsql18@18.3.1.1.rb new file mode 100755 index 0000000..d42bd89 --- /dev/null +++ b/Formula/msodbcsql18@18.3.1.1.rb @@ -0,0 +1,79 @@ +class Msodbcsql18AT18311 < Formula + desc "ODBC Driver for Microsoft(R) SQL Server(R)" + homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" + url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/d/4/7/d47963dd-a254-4d67-a92a-d3d5466df7e4/msodbcsql18-18.3.1.1-arm64.tar.gz" : + "https://download.microsoft.com/download/d/4/7/d47963dd-a254-4d67-a92a-d3d5466df7e4/msodbcsql18-18.3.1.1-amd64.tar.gz" + version "18.3.1.1" + sha256 Hardware::CPU.arch == :arm64 ? "01e1d2df29f2a3ea9ccb064fce33462e92c9d72f10b6a759b2a6410670794b66" : + "f23542182eebb521032f7a025efe46909fc1f315f1f5c0974005d400a643ad90" + + option "without-registration", "Don't register the driver in odbcinst.ini" + + keg_only :versioned_formula + depends_on "unixodbc" + depends_on "openssl" + + def check_eula_acceptance? + if ENV["HOMEBREW_ACCEPT_EULA"] != "y" && ENV["HOMEBREW_ACCEPT_EULA"] != "Y" + puts "The license terms for this product can be downloaded from" + puts "https://aka.ms/odbc18eula and found in" + puts "#{prefix}/share/doc/msodbcsql18/LICENSE.txt . By entering 'YES'," + puts "you indicate that you accept the license terms." + puts "" + loop do + puts "Do you accept the license terms? (Enter YES or NO)" + accept_eula = STDIN.gets.chomp + if accept_eula + if accept_eula.casecmp("YES").zero? + break + elsif accept_eula.casecmp("NO").zero? + puts "Installation terminated: License terms not accepted." + return false + else + puts "Please enter YES or NO" + end + else + puts "Installation terminated: Could not prompt for license acceptance." + puts "If you are performing an unattended installation, you may set" + puts "HOMEBREW_ACCEPT_EULA to Y to indicate your acceptance of the license terms." + return false + end + end + end + true + end + + def install + return false unless check_eula_acceptance? + + chmod 0444, "lib/libmsodbcsql.18.dylib" + chmod 0444, "share/msodbcsql18/resources/en_US/msodbcsqlr18.rll" + chmod 0644, "include/msodbcsql18/msodbcsql.h" + chmod 0644, "odbcinst.ini" + chmod 0644, "share/doc/msodbcsql18/LICENSE.txt" + chmod 0644, "share/doc/msodbcsql18/RELEASE_NOTES" + + cp_r ".", prefix.to_s + + if build.with? "registration" + system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 18 for SQL Server\"" + system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" + end + end + + def caveats; <<~EOS + If you installed this formula with the registration option (default), you'll + need to manually remove [ODBC Driver 18 for SQL Server] section from + odbcinst.ini after the formula is uninstalled. This can be done by executing + the following command: + odbcinst -u -d -n "ODBC Driver 18 for SQL Server" + EOS + end + + test do + if build.with? "registration" + out = shell_output("#{Formula["unixodbc"].opt_bin}/odbcinst -q -d") + assert_match "ODBC Driver 18 for SQL Server", out + end + end +end