Bug 241238

Summary: [NEW PORT] audio/spotify-tui: Spotify for the terminal written in Rust
Product: Ports & Packages Reporter: Lewis Cook <lcook>
Component: Individual Port(s)Assignee: Steve Wills <swills>
Status: Closed FIXED    
Severity: Affects Only Me CC: swills
Priority: --- Keywords: buildisok, feature
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/Rigellute/spotify-tui
Description Flags
port diff
port diff
spotify-tui port diff
poudriere build log
spotify-tui port diff none

Description Lewis Cook freebsd_committer freebsd_triage 2019-10-14 08:26:32 UTC
Created attachment 208293 [details]
port diff

Simple Spotify client written in rust for the terminal,
using the Spotify API providing a way to find music by
name, play tracks, etc.

QA: Successfully built in poudriere.
Comment 1 Steve Wills freebsd_committer 2019-10-16 20:40:52 UTC
I built and installed this and signed up, did all the setup, but on the step where it prompts me to "Enter the URL you were redirected to:", I enter it, then I get a timeout:

thread 'main' panicked at 'send request failed: Error(Io(Custom { kind: TimedOut, error: "timed out" }), "https://accounts.spotify.com/api/token")', src/libcore/result.rs:1084:5

Any ideas what's going wrong here?
Comment 2 Lewis Cook freebsd_committer freebsd_triage 2019-10-17 02:44:59 UTC
(In reply to Steve Wills from comment #1)

During the initial submission, everything compiled successfully and worked without issues. I've reason to believe there's been an upstream change to one of it's dependencies that's broken it's behaviour, causing this timeout of sorts.

What leaves me confused is if you try pulling Spotify-tui from cargo: cargo install spotify-tui, I no longer face this timeout, subsequently working as intended.

I've opened this as an issue on the repo: https://github.com/Rigellute/spotify-tui/issues/72 and provided a stacktrace. There seems to be an immediate issue with rspotify: (last function call before it throws the timeout) 

10: 0x13ad842 - rspotify::spotify::util::get_token::h33b74d9688b2ca7d

Can you try pulling in and running spotify-tui directly from cargo?
Comment 3 Lewis Cook freebsd_committer freebsd_triage 2019-10-17 02:51:14 UTC
As a side note: originally compiled on v0.5.0, tried again now and no longer works. I've also tried the latest release v0.6.2 and same results.  Downloading from cargo seems to get around this but doesn't fix the remaining issue.
Comment 4 Lewis Cook freebsd_committer freebsd_triage 2019-10-17 03:39:37 UTC
Could this potentially be a discrepancy between the ports build system and the standalone cargo package manager? What stumps me is that it builds from ports, but timesout on runtime. While on the contrary simply building from cargo, outside of the port, and there is no timeout as aforementioned. Wonder if I'm missing a cargo flag in the Makefile or something along the lines.
Comment 5 Lewis Cook freebsd_committer freebsd_triage 2019-10-17 12:50:38 UTC
Created attachment 208386 [details]
port diff

* Updated port to version v0.6.2, distinfo metadata and CARGO_CRATES.
* Added optional dependency for spotifyd that can be used in conjunction with spotify-tui for playback.

This does _not_ fix the underlying runtime timeout error. I'm certain it has to do with CARGO_BUILD_ARGS, as discussed previously: there's no timeout error when compiling from `cargo install spotify-tui` but _only_ when compiling the port.

I'm not as familiar with the rust toolchain nor cargo, so open to suggestions in what needs to be done and/or changed. My guess is there's a particular build flag being passed (or lack-of) to cargo that breaks functionality in the do-build stage. Cheers.
Comment 6 Lewis Cook freebsd_committer freebsd_triage 2019-11-30 14:19:09 UTC
Created attachment 209556 [details]
spotify-tui port diff

* Updated port DISTVERSION to latest (rm 0.10.0) including distinfo and CARGO_CRATES;
* Added python:3.6+,build and xorg to USES (needed to build xcb crate) and similarly USE_XORG for xcb;
* Added BINARY_ALIAS for python (needed during the build script of xcb crate);
* Added PORTDOCS to Makefile for documentation installation;
* Added pkg-message.in to files/ for installation message.

The remaining issue that was aforementioned in this thread has been fixed. You can now successfully authenticate with Spotify without error, and use the application as expected. Port builds in poudriere as normal and passed with portlint.
Comment 7 Lewis Cook freebsd_committer freebsd_triage 2019-11-30 14:33:33 UTC
Created attachment 209558 [details]
poudriere build log

* Attached poudriere build log for extra information if needed.
Comment 8 Lewis Cook freebsd_committer freebsd_triage 2019-12-01 12:45:55 UTC
Created attachment 209571 [details]
spotify-tui port diff

* Change Makefile in accordance to `portclippy` (thanks to 0mp@ for shedding light on this);
* Shorten PORTDOC installation to a one-liner.
Comment 9 commit-hook freebsd_committer 2019-12-02 19:30:30 UTC
A commit references this bug:

Author: swills
Date: Mon Dec  2 19:29:50 UTC 2019
New revision: 518866
URL: https://svnweb.freebsd.org/changeset/ports/518866

  audio/spotify-tui: create port

  Spotify terminal client written in rust. Play
  music directly from your terminal, find new
  artists, search for your favourite music and

  WWW: https://github.com/Rigellute/spotify-tui

  PR:		241238
  Submitted by:	Lewis Cook <vulcan@wired.sh>

Comment 10 Steve Wills freebsd_committer 2019-12-02 19:33:22 UTC
Committed, thanks!