asdf-community / asdf-aria2

aria2 plugin for the asdf version manager
https://github.com/asdf-vm/asdf
Apache License 2.0
7 stars 4 forks source link

macOS install of 1.36.0 is broken #16

Open SgtPooki opened 2 years ago

SgtPooki commented 2 years ago

This plugin requests a release tar for $OSTYPE = darwin* that doesn't exist for 1.36.0, see https://github.com/asdf-community/asdf-aria2/blame/master/bin/install#L37.

https://github.com/aria2/aria2/releases/download/release-${version}/aria2-${version}-osx-darwin.tar.bz2

translates to

https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-osx-darwin.tar.bz2

which returns a 404. The only releases for 1.36.0 are:

OSTYPE=linux asdf install aria2 1.36.0 cd ~/.asdf/installs/aria2/1.36.0 ./configure --prefix="$(pwd)" make install

Making install in po make[1]: Entering directory '/Users/sgtpooki/.asdf/installs/aria2/1.36.0/po' if test "aria2" = "gettext-tools"; then \ /opt/homebrew/bin/gmkdir -p /Users/sgtpooki/.asdf/installs/aria2/1.36.0/share/gettext/po; \ for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot Makevars.template; do \ /opt/homebrew/bin/ginstall -c -m 644 ./$file \ /Users/sgtpooki/.asdf/installs/aria2/1.36.0/share/gettext/po/$file; \ done; \ for file in Makevars; do \ rm -f /Users/sgtpooki/.asdf/installs/aria2/1.36.0/share/gettext/po/$file; \ done; \ else \ : ; \ fi make[1]: Leaving directory '/Users/sgtpooki/.asdf/installs/aria2/1.36.0/po' Making install in lib make[1]: Entering directory '/Users/sgtpooki/.asdf/installs/aria2/1.36.0/lib' make[2]: Entering directory '/Users/sgtpooki/.asdf/installs/aria2/1.36.0/lib'

...

CXXLD libaria2.la /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libaria2.a(MetalinkParserState.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: .libs/libaria2.a(MetalinkParserState.o) has no symbols CXXLD aria2c ld: warning: ignoring file /opt/homebrew/Cellar/c-ares/1.18.1/lib/libcares.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_ares_destroy", referenced from: aria2::AsyncNameResolver::~AsyncNameResolver() in libaria2.a(AsyncNameResolver.o) aria2::AsyncNameResolver::reset() in libaria2.a(AsyncNameResolver.o) "_ares_fds", referenced from: aria2::AsyncNameResolver::getFds(fd_set, fd_set) const in libaria2.a(AsyncNameResolver.o) "_ares_gethostbyname", referenced from: aria2::AsyncNameResolver::resolve(std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) in libaria2.a(AsyncNameResolver.o) "_ares_getsock", referenced from: aria2::AsyncNameResolver::getsock(int) const in libaria2.a(AsyncNameResolver.o) "_ares_init", referenced from: aria2::AsyncNameResolver::AsyncNameResolver(int, ares_addr_node) in libaria2.a(AsyncNameResolver.o) aria2::AsyncNameResolver::reset() in libaria2.a(AsyncNameResolver.o) "_ares_library_cleanup", referenced from: aria2::Platform::~Platform() in libaria2.a(Platform.o) aria2::Platform::tearDown() in libaria2.a(Platform.o) aria2::Platform::~Platform() in libaria2.a(Platform.o) "_ares_library_init", referenced from: aria2::Platform::Platform() in libaria2.a(Platform.o) aria2::Platform::setUp() in libaria2.a(Platform.o) aria2::Platform::Platform() in libaria2.a(Platform.o) "_ares_process", referenced from: aria2::AsyncNameResolver::process(fd_set, fd_set) in libaria2.a(AsyncNameResolver.o) "_ares_process_fd", referenced from: aria2::AsyncNameResolver::process(int, int) in libaria2.a(AsyncNameResolver.o) "_ares_strerror", referenced from: aria2::Platform::Platform() in libaria2.a(Platform.o) aria2::Platform::setUp() in libaria2.a(Platform.o) aria2::Platform::Platform() in libaria2.a(Platform.o) aria2::callback(void, int, int, hostent) in libaria2.a(AsyncNameResolver.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [Makefile:2157: aria2c] Error 1 make[2]: Leaving directory '/Users/sgtpooki/.asdf/installs/aria2/1.36.0/src' make[1]: [Makefile:2679: install-recursive] Error 1 make[1]: Leaving directory '/Users/sgtpooki/.asdf/installs/aria2/1.36.0/src' make: *** [Makefile:558: install-recursive] Error 1


but obviously, this didn't work because it's made for Linux. I thought maybe they had combined builds for darwin and linux or something *shrug*. 

In the install script, I see that the releases are being gathered without regard for `$OSTYPE`, but the install script is filtering on `$OSTYPE`. That should be normalized.

Since you're downloading the `darwin.tar.bz2` files, you can get the list of available releases for darwin like so:

```bash

> curl --silent --location https://api.github.com/repos/aria2/aria2/releases > gh-releases-output.json

> jq -r '.[] | select(.assets | .[].name | contains("darwin.tar.bz2")) | .tag_name' <gh-releases-output.json
release-1.35.0
release-1.33.0
release-1.30.0
release-1.29.0
release-1.27.1
release-1.26.1
release-1.26.0
release-1.25.0
release-1.24.0
release-1.23.0
release-1.22.0
release-1.21.0
release-1.20.0
release-1.19.3
release-1.19.2
release-1.19.1

And you can get the specific semver version strings like so:


> jq -r '.[] | select(.assets | .[].name | contains("darwin.tar.bz2")) | .tag_name' <gh-releases-output.json | awk -F- '{print $2}'
1.35.0
1.33.0
1.30.0
1.29.0
1.27.1
1.26.1
1.26.0
1.25.0
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.3
1.19.2
1.19.1

And since we need to sort them in ascending order, which is the default for sort, we don't need anything complex:

> jq -r '.[] | select(.assets | .[].name | contains("darwin.tar.bz2")) | .tag_name' <gh-releases-output.json | awk -F- '{print $2}' | sort
1.19.1
1.19.2
1.19.3
1.20.0
1.21.0
1.22.0
1.23.0
1.24.0
1.25.0
1.26.0
1.26.1
1.27.1
1.29.0
1.30.0
1.33.0
1.35.0

Would you accept a PR that made these changes?

SgtPooki commented 2 years ago

or a more posix compliant version, without a dependency on jq:

> cat gh-releases-output.json |  grep '"name": "aria2-' | grep 'darwin.tar.bz2' | sed -e 's/.* "aria2-//;' | awk -F- '{print $1}' | LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n
1.19.1
1.19.2
1.19.3
1.20.0
1.21.0
1.22.0
1.23.0
1.24.0
1.25.0
1.26.0
1.26.1
1.27.1
1.29.0
1.30.0
1.33.0
1.35.0
Ernest0-Production commented 6 months ago

are there any plans to fix this problem?