iroddis / asdf-mysql

A MySQL Plugin for asdf
GNU General Public License v2.0
19 stars 8 forks source link

Fix download and installation on Mac #5

Closed jmromer closed 4 years ago

jmromer commented 4 years ago

Target installation archives do not appear to be named with a '-macos10' suffix.

Before

% asdf install mysql 5.7.32
+ set -e
++ echo 5.7.32
++ cut -d. -f1
+ MAJOR=5
++ echo 5.7.32
++ cut -d. -f2
+ MINOR=7
++ mktemp -d
+ tmp_download_dir=/var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.Yeke6SthVO
+ case "$(uname -s)" in
++ uname -s
+ FILE=mysql-5.7.32
+ rsync -zarv '--include=*/' '--include=*.gz' '--include=*.xz' '--exclude=*' rsync://rsync.mirrorservice.org/ftp.mysql.com/Downloads/MySQL-5.7/mysql-5.7.32 /var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.Yeke6SthVO/.
-----------------------------------------------------------------------------
Welcome to the University of Kent's UK Mirror Service.

More information can be found at our web site: https://www.mirrorservice.org/
Please send comments or questions to help@mirrorservice.org.
-----------------------------------------------------------------------------

receiving file list ... done

sent 39 bytes  received 17 bytes  22.40 bytes/sec
total size is 0  speedup is 0.00

After

% asdf install mysql 5.7.32

+ set -e
++ echo 5.7.32
++ cut -d. -f1
+ MAJOR=5
++ echo 5.7.32
++ cut -d. -f2
+ MINOR=7
++ mktemp -d
+ tmp_download_dir=/var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.sybfRnsQFr
+ case "$(uname -s)" in
++ uname -s
+ FILE=mysql-5.7.32.zip
+ rsync -zarv '--include=*/' '--include=*.gz' '--include=*.xz' '--include=*.zip' '--exclude=*' rsync://rsync.mirrorservice.org/ftp.mysql.com/Downloads/MySQL-5.7/mysql-5.7.32.zip /var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.sybfRnsQFr/.
-----------------------------------------------------------------------------
Welcome to the University of Kent's UK Mirror Service.

More information can be found at our web site: https://www.mirrorservice.org/
Please send comments or questions to help@mirrorservice.org.
-----------------------------------------------------------------------------

receiving file list ... done
mysql-5.7.32.zip

sent 84 bytes  received 75389756 bytes  1187241.57 bytes/sec
total size is 75358211  speedup is 1.00
+ cd /var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.sybfRnsQFr
++ head -1
++ ls -S '*.xz' '*.gz'
ls: cannot access '*.xz': No such file or directory
ls: cannot access '*.gz': No such file or directory
+ CFILE=
+ case "$( echo $CFILE | awk -F. '{ print $NF }')" in
++ echo
++ awk -F. '{ print $NF }'
++ ls -l
++ grep '^d'
++ awk '{ print $NF }'
+ DIR=
+ rsync -ar /var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.sybfRnsQFr/. /Users/jmromer/.asdf/installs/mysql/5.7.32/.
+ rm -rf /var/folders/7c/nwp4zv3574n24s27qgxfxkrm0000gn/T/tmp.sybfRnsQFr
+ echo Successfully installed MySQL 5.7.32
Successfully installed MySQL 5.7.32
iroddis commented 4 years ago

Hey @jmromer , this looks interesting. I don't have a mac box to test on anymore. If you want to reopen this PR, or have any other fixes for macs, please let me know.

jmromer commented 3 years ago

I'll take a look! From what I'm seeing, installation doesn't work for any version but the latest one because (1) the download URLs are generated incorrectly (they're ZIPs and don't have "-macos" in the filename), and (2) once downloaded, the unpacked files don't include an executable.

Assuming I managed to fix (1) correctly, the installation script may need a compilation step. But I'm not sure that assumption holds — I'm curious if there's a better source to poll for available version numbers and to download precompiled binaries. I ran out of time though. Time permitting, I'll see what I can see.