aquelemiguel / parrot

🦜 A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp.
MIT License
136 stars 44 forks source link

update rspotify crate to v0.12.0 #249

Closed SimonStjernholm closed 6 months ago

SimonStjernholm commented 6 months ago
- -
Issue not related to any
Dependencies none
Decisions I've updated the cargo.lock file with cargo update, since manual docker builds currently won't work with the main repository.
note: I don't know if this is the correct procedure
joao-conde commented 6 months ago

The point of Cargo.lock is to ensure the versions are the same so it should build for you anyways right? Can you post the error log of your build step?

SimonStjernholm commented 6 months ago

[+] Building 9.3s (14/19)                                                                                                                                                                                                                                                docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 733B                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye-slim                                                                                                                                                                                                            0.6s
 => [internal] load metadata for docker.io/library/rust:slim-bullseye                                                                                                                                                                                                              0.6s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 171B                                                                                                                                                                                                                                                  0.0s
 => [internal] load build context                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2.04kB                                                                                                                                                                                                                                                0.0s
 => [stage-1 1/4] FROM docker.io/library/debian:bullseye-slim@sha256:c6d9e246479d56687c1a579a7a0336956a5ce6f2bc26bd7925b0c7405e81dbff                                                                                                                                              0.0s
 => => resolve docker.io/library/debian:bullseye-slim@sha256:c6d9e246479d56687c1a579a7a0336956a5ce6f2bc26bd7925b0c7405e81dbff                                                                                                                                                      0.0s
 => [build  1/10] FROM docker.io/library/rust:slim-bullseye@sha256:652bec21f9d70978f84a200586f857c3367d8443396053a57242c1ddcc210ee7                                                                                                                                                0.0s
 => CACHED [build  2/10] RUN apt-get update && apt-get install -y     build-essential autoconf automake cmake libtool libssl-dev pkg-config                                                                                                                                        0.0s
 => CACHED [build  3/10] WORKDIR /parrot                                                                                                                                                                                                                                           0.0s
 => CACHED [build  4/10] RUN mkdir src                                                                                                                                                                                                                                             0.0s
 => CACHED [build  5/10] RUN echo "fn main() {}" > src/main.rs                                                                                                                                                                                                                     0.0s
 => CACHED [build  6/10] COPY Cargo.toml ./                                                                                                                                                                                                                                        0.0s
 => CACHED [build  7/10] COPY Cargo.lock ./                                                                                                                                                                                                                                        0.0s
 => ERROR [build  8/10] RUN cargo build --release --locked                                                                                                                                                                                                                         8.6s
------
 > [build  8/10] RUN cargo build --release --locked:
0.255     Updating crates.io index
3.114  Downloading crates ...
3.397   Downloaded async-stream-impl v0.3.3
3.412   Downloaded audiopus v0.3.0-rc.0
3.414   Downloaded adler v1.0.2
3.416   Downloaded log v0.4.17
3.423   Downloaded derivative v2.2.0
3.430   Downloaded crc32fast v1.3.2
3.436   Downloaded rspotify-http v0.11.6
3.437   Downloaded num-traits v0.1.43
3.446   Downloaded openssl-probe v0.1.5
3.462   Downloaded openssl-macros v0.1.0
3.464   Downloaded tinyvec_macros v0.1.0
3.464   Downloaded aead v0.4.3
3.465   Downloaded serde_urlencoded v0.7.1
3.466   Downloaded ppv-lite86 v0.2.16
3.467   Downloaded futures-task v0.3.21
3.468   Downloaded rustls-pemfile v1.0.0
3.470   Downloaded ordered-float v2.10.0
3.471   Downloaded discortp v0.4.0
3.471   Downloaded bitflags v1.3.2
3.473   Downloaded futures-sink v0.3.21
3.474   Downloaded scopeguard v1.1.0
3.474   Downloaded httpdate v1.0.2
3.478   Downloaded spin v0.5.2
3.479   Downloaded pin-utils v0.1.0
3.480   Downloaded nanorand v0.7.0
3.482   Downloaded futures-macro v0.3.21
3.483   Downloaded num-integer v0.1.45
3.484   Downloaded futures-core v0.3.21
3.485   Downloaded serenity-voice-model v0.1.1
3.489   Downloaded lazy_static v1.4.0
3.492   Downloaded enum_dispatch v0.3.8
3.494   Downloaded hyper-rustls v0.23.0
3.496   Downloaded parking_lot v0.12.1
3.498   Downloaded socket2 v0.4.4
3.500   Downloaded cc v1.0.73
3.502   Downloaded proc-macro2 v1.0.51
3.504   Downloaded rand v0.8.5
3.510   Downloaded http v0.2.8
3.515   Downloaded hashbrown v0.12.3
3.518   Downloaded mio v0.8.4
3.522   Downloaded futures-util v0.3.21
3.530   Downloaded regex v1.6.0
3.539   Downloaded idna v0.3.0
3.546   Downloaded hyper v0.14.20
3.552   Downloaded serenity v0.11.5
3.563   Downloaded audiopus_sys v0.2.2
3.585   Downloaded encoding_rs v0.8.31
3.600   Downloaded rustls v0.20.6
3.607   Downloaded serde_derive v1.0.152
3.609   Downloaded h2 v0.3.13
3.613   Downloaded serde-value v0.7.0
3.614   Downloaded subtle v2.4.1
3.615   Downloaded rustversion v1.0.8
3.616   Downloaded openssl v0.10.41
3.621   Downloaded thiserror v1.0.31
3.624   Downloaded tokio-socks v0.5.1
3.625   Downloaded tokio-rustls v0.23.4
3.626   Downloaded thiserror-impl v1.0.31
3.628   Downloaded time v0.3.11
3.632   Downloaded tracing-futures v0.2.5
3.633   Downloaded symphonia-core v0.5.1
3.635   Downloaded tungstenite v0.17.3
3.638   Downloaded tracing-core v0.1.28
3.640   Downloaded syn v1.0.109
3.647   Downloaded tokio-native-tls v0.3.0
3.649   Downloaded num-traits v0.2.15
3.652   Downloaded untrusted v0.7.1
3.653   Downloaded tokio-macros v1.8.0
3.654   Downloaded universal-hash v0.4.1
3.655   Downloaded want v0.3.0
3.656   Downloaded utf-8 v0.7.6
3.657   Downloaded unicase v2.6.0
3.658   Downloaded sha2 v0.10.2
3.660   Downloaded foreign-types-shared v0.1.1
3.661   Downloaded unicode-ident v1.0.2
3.662   Downloaded typenum v1.15.0
3.664   Downloaded zeroize v1.3.0
3.665   Downloaded slab v0.4.7
3.666   Downloaded rspotify-model v0.11.6
3.667   Downloaded tracing v0.1.35
3.670   Downloaded poly1305 v0.7.2
3.672   Downloaded uuid v0.8.2
3.674   Downloaded webpki v0.22.0
3.678   Downloaded unicode-normalization v0.1.21
3.681   Downloaded chrono v0.4.19
3.685   Downloaded webpki-roots v0.22.4
3.687   Downloaded tokio v1.20.1
3.711   Downloaded songbird v0.3.2
3.715   Downloaded flate2 v1.0.24
3.718   Downloaded ring v0.16.20
3.775   Downloaded rspotify v0.11.6
3.786   Downloaded aho-corasick v0.7.18
3.789   Downloaded tokio-util v0.7.3
3.792   Downloaded url v2.3.1
3.794   Downloaded tinyvec v1.6.0
3.796   Downloaded time v0.1.44
3.797   Downloaded crossbeam-utils v0.8.11
3.799   Downloaded base64 v0.13.0
3.801   Downloaded heck v0.4.0
3.802   Downloaded form_urlencoded v1.1.0
3.803   Downloaded async-stream v0.3.3
3.804   Downloaded fnv v1.0.7
3.805   Downloaded either v1.7.0
3.806   Downloaded dotenv v0.15.0
3.807   Downloaded xsalsa20poly1305 v0.8.0
3.808   Downloaded version_check v0.9.4
3.809   Downloaded unicode-bidi v0.3.8
3.810   Downloaded salsa20 v0.9.0
3.812   Downloaded digest v0.10.3
3.813   Downloaded tracing-attributes v0.1.22
3.815   Downloaded async-trait v0.1.56
3.817   Downloaded foreign-types v0.3.2
3.818   Downloaded once_cell v1.13.0
3.820   Downloaded pnet_macros_support v0.28.0
3.820   Downloaded futures-executor v0.3.21
3.821   Downloaded cmake v0.1.48
3.822   Downloaded typemap_rev v0.1.5
3.822   Downloaded try-lock v0.2.3
3.823   Downloaded tower-service v0.3.2
3.823   Downloaded rspotify-macros v0.11.6
3.823   Downloaded libc v0.2.126
3.843   Downloaded serde_json v1.0.82
3.849   Downloaded openssl-sys v0.9.75
3.852   Downloaded signal-hook-registry v1.4.0
3.853   Downloaded strum_macros v0.24.2
3.854   Downloaded strum v0.24.1
3.854   Downloaded spin v0.9.4
3.856   Downloaded serde_repr v0.1.8
3.857   Downloaded pkg-config v0.3.25
3.857   Downloaded pin-project-lite v0.2.9
3.861   Downloaded pin-project-internal v1.0.11
3.862   Downloaded parking_lot_core v0.9.3
3.863   Downloaded miniz_oxide v0.5.3
3.864   Downloaded httparse v1.7.1
3.866   Downloaded regex-syntax v0.6.27
3.870   Downloaded rand_chacha v0.3.1
3.871   Downloaded num_threads v0.1.6
3.872   Downloaded native-tls v0.2.10
3.873   Downloaded futures-channel v0.3.21
3.874   Downloaded enum_primitive v0.1.1
3.875   Downloaded bytemuck v1.11.0
3.877   Downloaded opaque-debug v0.3.0
3.877   Downloaded cfg-if v1.0.0
3.878   Downloaded reqwest v0.11.11
3.881   Downloaded memchr v2.5.0
3.883   Downloaded serde v1.0.152
3.885   Downloaded flume v0.10.14
3.887   Downloaded indexmap v1.9.1
3.889   Downloaded bytes v1.2.0
3.891   Downloaded ryu v1.0.10
3.894   Downloaded lock_api v0.4.7
3.895   Downloaded crypto-common v0.1.6
3.895   Downloaded mime_guess v2.0.4
3.896   Downloaded ipnet v2.5.0
3.897   Downloaded generic-array v0.14.5
3.899   Downloaded pnet_macros v0.28.0
3.901   Downloaded dashmap v5.3.4
3.903   Downloaded pin-project v1.0.11
3.910   Downloaded rustc-serialize v0.3.24
3.912   Downloaded futures v0.3.21
3.915   Downloaded http-body v0.4.5
3.915   Downloaded smallvec v1.9.0
3.916   Downloaded itoa v1.0.2
3.917   Downloaded pnet_base v0.28.0
3.918   Downloaded getrandom v0.2.7
3.919   Downloaded quote v1.0.20
3.920   Downloaded sct v0.7.0
3.922   Downloaded percent-encoding v2.2.0
3.923   Downloaded async-tungstenite v0.17.2
3.924   Downloaded arrayvec v0.7.2
3.926   Downloaded rand_core v0.6.3
3.927   Downloaded mime v0.3.16
3.928   Downloaded num_cpus v1.13.1
3.930   Downloaded streamcatcher v1.0.1
3.931   Downloaded sha-1 v0.10.0
3.932   Downloaded byteorder v1.4.3
3.933   Downloaded autocfg v1.1.0
3.934   Downloaded cpufeatures v0.2.2
3.935   Downloaded futures-io v0.3.21
3.936   Downloaded block-buffer v0.10.2
3.937   Downloaded maybe-async v0.2.6
3.938   Downloaded cipher v0.3.0
3.940   Downloaded hyper-tls v0.5.0
3.978    Compiling proc-macro2 v1.0.51
3.978    Compiling quote v1.0.20
3.978    Compiling unicode-ident v1.0.2
3.978    Compiling syn v1.0.109
3.979    Compiling autocfg v1.1.0
3.980    Compiling libc v0.2.126
3.980    Compiling cfg-if v1.0.0
3.980    Compiling cc v1.0.73
3.980    Compiling log v0.4.17
3.981    Compiling memchr v2.5.0
3.982    Compiling version_check v0.9.4
3.982    Compiling once_cell v1.13.0
3.982    Compiling pin-project-lite v0.2.9
3.982    Compiling futures-core v0.3.21
3.982    Compiling serde_derive v1.0.152
3.982    Compiling typenum v1.15.0
3.982    Compiling futures-sink v0.3.21
3.982    Compiling itoa v1.0.2
3.983    Compiling pkg-config v0.3.25
3.994    Compiling serde v1.0.152
3.997    Compiling bytes v1.2.0
3.999    Compiling futures-task v0.3.21
4.000    Compiling futures-channel v0.3.21
4.000    Compiling futures-util v0.3.21
4.019    Compiling pin-utils v0.1.0
4.019    Compiling futures-io v0.3.21
4.025    Compiling spin v0.5.2
4.042    Compiling untrusted v0.7.1
4.058    Compiling fnv v1.0.7
4.113    Compiling tracing-core v0.1.28
4.123    Compiling httparse v1.7.1
4.126    Compiling bitflags v1.3.2
4.147    Compiling hashbrown v0.12.3
4.164    Compiling rustls v0.20.6
4.166    Compiling tinyvec_macros v0.1.0
4.174    Compiling openssl v0.10.41
4.184    Compiling tinyvec v1.6.0
4.187    Compiling generic-array v0.14.5
4.190    Compiling unicase v2.6.0
4.197    Compiling slab v0.4.7
4.199    Compiling tokio v1.20.1
4.205    Compiling num-traits v0.2.15
4.236    Compiling indexmap v1.9.1
4.242    Compiling percent-encoding v2.2.0
4.284    Compiling foreign-types-shared v0.1.1
4.291    Compiling native-tls v0.2.10
4.316    Compiling foreign-types v0.3.2
4.317    Compiling form_urlencoded v1.1.0
4.323    Compiling ryu v1.0.10
4.327    Compiling cpufeatures v0.2.2
4.332    Compiling unicode-bidi v0.3.8
4.344    Compiling try-lock v0.2.3
4.348    Compiling serde_json v1.0.82
4.369    Compiling lock_api v0.4.7
4.374    Compiling want v0.3.0
4.380    Compiling rustversion v1.0.8
4.401    Compiling http v0.2.8
4.409    Compiling httpdate v1.0.2
4.420    Compiling tower-service v0.3.2
4.438    Compiling openssl-probe v0.1.5
4.460    Compiling base64 v0.13.0
4.478    Compiling mime_guess v2.0.4
4.497    Compiling socket2 v0.4.4
4.501    Compiling signal-hook-registry v1.4.0
4.506    Compiling num_cpus v1.13.1
4.513    Compiling mio v0.8.4
4.514    Compiling getrandom v0.2.7
4.591    Compiling rand_core v0.6.3
4.620    Compiling encoding_rs v0.8.31
4.639    Compiling scopeguard v1.1.0
4.702    Compiling lazy_static v1.4.0
4.708    Compiling mime v0.3.16
4.726    Compiling ppv-lite86 v0.2.16
4.734    Compiling parking_lot_core v0.9.3
4.735    Compiling async-trait v0.1.56
4.739    Compiling either v1.7.0
4.784    Compiling ring v0.16.20
4.789    Compiling openssl-sys v0.9.75
4.831    Compiling unicode-normalization v0.1.21
4.896    Compiling rustls-pemfile v1.0.0
4.906    Compiling cmake v0.1.48
4.941    Compiling num-integer v0.1.45
4.967    Compiling rand_chacha v0.3.1
4.974    Compiling http-body v0.4.5
4.998    Compiling ipnet v2.5.0
5.097    Compiling smallvec v1.9.0
5.120    Compiling crc32fast v1.3.2
5.150    Compiling aho-corasick v0.7.18
5.172    Compiling idna v0.3.0
5.178    Compiling rand v0.8.5
5.181    Compiling regex-syntax v0.6.27
5.191    Compiling subtle v2.4.1
5.196    Compiling audiopus_sys v0.2.2
5.207    Compiling crypto-common v0.1.6
5.219    Compiling block-buffer v0.10.2
5.225    Compiling adler v1.0.2
5.252    Compiling heck v0.4.0
5.257    Compiling utf-8 v0.7.6
5.273    Compiling crossbeam-utils v0.8.11
5.276    Compiling byteorder v1.4.3
5.280    Compiling miniz_oxide v0.5.3
5.280    Compiling universal-hash v0.4.1
5.297    Compiling digest v0.10.3
5.329    Compiling cipher v0.3.0
5.360    Compiling ordered-float v2.10.0
5.364    Compiling num-traits v0.1.43
5.405    Compiling time v0.1.44
5.417    Compiling sha-1 v0.10.0
5.422    Compiling num_threads v0.1.6
5.430    Compiling pnet_base v0.28.0
5.433    Compiling opaque-debug v0.3.0
5.453    Compiling zeroize v1.3.0
5.512    Compiling rustc-serialize v0.3.24
5.515    Compiling serenity v0.11.5
5.522    Compiling salsa20 v0.9.0
5.524    Compiling pnet_macros_support v0.28.0
5.527    Compiling poly1305 v0.7.2
5.540    Compiling enum_primitive v0.1.1
5.546    Compiling parking_lot v0.12.1
5.574    Compiling flate2 v1.0.24
5.584    Compiling aead v0.4.3
5.664    Compiling spin v0.9.4
5.674    Compiling nanorand v0.7.0
5.688    Compiling bytemuck v1.11.0
5.703 error[E0310]: the parameter type `T` may not live long enough
5.703     --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-serialize-0.3.24/src/serialize.rs:1155:5
5.703      |
5.703 1155 |     fn decode<D: Decoder>(d: &mut D) -> Result<Cow<'static, T>, D::Error> {
5.704      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5.704      |     |
5.704      |     the parameter type `T` must be valid for the static lifetime...
5.704      |     ...so that the type `T` will meet its required lifetime bounds...
5.704      |
5.704 note: ...that is required by this bound
5.704     --> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/borrow.rs:180:30
5.704 help: consider adding an explicit lifetime bound
5.704      |
5.704 1151 | impl<'a, T: ?Sized + 'static> Decodable for Cow<'a, T>
5.705      |                    +++++++++
5.705
5.715    Compiling typemap_rev v0.1.5
5.718    Compiling arrayvec v0.7.2
5.744    Compiling songbird v0.3.2
5.774    Compiling xsalsa20poly1305 v0.8.0
5.778    Compiling sha2 v0.10.2
5.782    Compiling uuid v0.8.2
5.848    Compiling symphonia-core v0.5.1
5.869    Compiling rspotify-macros v0.11.6
5.873    Compiling dotenv v0.15.0
6.145 For more information about this error, try `rustc --explain E0310`.
6.148 error: could not compile `rustc-serialize` (lib) due to 1 previous error
6.149 warning: build failed, waiting for other jobs to finish...
------
Dockerfile:15
--------------------
  13 |     COPY Cargo.toml ./
  14 |     COPY Cargo.lock ./
  15 | >>> RUN cargo build --release --locked
  16 |
  17 |     COPY . .
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo build --release --locked" did not complete successfully: exit code: 101```
SimonStjernholm commented 6 months ago

Btw this happens when trying to build both with amd64 cpu (wsl/ubuntu) and arm cpu (ubuntu server).

SimonStjernholm commented 6 months ago

Okay the breaking part here is that the crate rspotify@v0.11.6 depends on rustc-serialize. The crate rustc-serialize is now archived/deprecated and when using the latest rust version 1.76.0 (Which Dockerfile uses as image) parrot can't be compiled since of some breaking code changes in this rust version. Compiling with rspotify@v0.11.7 works, since it doesn't rely on rustc-serialize and also solves spotify-playback (which I couldn't get to work beforehand).

The rust compiler even warns in previous versions, that rustc-serialize will break in future rust versions.

The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.

To solve this problem, you can try the following approaches:

- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - rustc-serialize@0.3.24
  - Repository: https://github.com/rust-lang/rustc-serialize
  - Detailed warning command: `cargo report future-incompatibilities --id 1 --package rustc-serialize@0.3.24`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

The package `rustc-serialize v0.3.24` currently triggers the following future incompatibility lints:
> warning: impl method assumes more implied bounds than the corresponding trait method
>     --> /home/stjernholm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-serialize-0.3.24/src/serialize.rs:1155:41
>      |
> 1155 |     fn decode<D: Decoder>(d: &mut D) -> Result<Cow<'static, T>, D::Error> {
>      |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `Result<Cow<'a, T>, <D as serialize::Decoder>::Error>`
>      |
>      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>      = note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
>      = note: `#[allow(implied_bounds_entailment)]` on by default
>
SimonStjernholm commented 6 months ago

rspotify can also be updated to 0.12.0. https://github.com/aquelemiguel/parrot/compare/main...SimonStjernholm:parrot:update/rspotify%400.12.0 Only breaking changes for rspotify@0.12.0 in parrot should be that a new market option parameter is added to the track and album fetcher. Can add this to this pull as well or submit another one if that's better.

joao-conde commented 6 months ago

Sounds ok, fix the clippy lints even though they are unrelated please and we merge it.

SimonStjernholm commented 6 months ago

Sounds ok, fix the clippy lints even though they are unrelated please and we merge it.

It should now be ready for a merge. :)

joao-conde commented 6 months ago

Thank you for contributing @SimonStjernholm