From a3bb40402edce09dcc67bda1c19f73fda8838951 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 19 Jul 2024 17:25:46 -0500 Subject: [PATCH 1/5] Update diesel-async to 0.5.0, msrv bump --- Cargo.lock | 72 ++++++++++++++++++++++++++++++++++++++++++++++++------ Cargo.toml | 4 +-- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65567e8..e7b1451 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -753,6 +753,41 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.71", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.71", +] + [[package]] name = "dashmap" version = "6.0.1" @@ -816,9 +851,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.1.6" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" +checksum = "bf97ee7261bb708fa3402fa9c17a54b70e90e3cb98afb3dc8999d5512cb03f94" dependencies = [ "bitflags 2.6.0", "byteorder", @@ -831,9 +866,9 @@ dependencies = [ [[package]] name = "diesel-async" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acada1517534c92d3f382217b485db8a8638f111b0e3f2a2a8e26165050f77be" +checksum = "fcb799bb6f8ca6a794462125d7b8983b0c86e6c93a33a9c55934a4a5de4409d3" dependencies = [ "async-trait", "bb8", @@ -858,11 +893,12 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.1.4" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14701062d6bed917b5c7103bdffaee1e4609279e240488ad24e7bd979ca6866c" +checksum = "d6ff2be1e7312c858b2ef974f5c7089833ae57b5311b334b30923af58e5718d8" dependencies = [ "diesel_table_macro_syntax", + "dsl_auto_type", "proc-macro2", "quote", "syn 2.0.71", @@ -870,9 +906,9 @@ dependencies = [ [[package]] name = "diesel_table_macro_syntax" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" +checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ "syn 2.0.71", ] @@ -894,6 +930,20 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +[[package]] +name = "dsl_auto_type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" +dependencies = [ + "darling", + "either", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "either" version = "1.13.0" @@ -1396,6 +1446,12 @@ dependencies = [ "cc", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index 8ef25be..a34ca22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,8 +31,8 @@ color-eyre = "0.6.3" config = { version = "0.14.0", default-features = false, features = ["json", "ron", "toml", "yaml"] } console-subscriber = "0.3.0" dashmap = "6.0.1" -diesel = { version = "2.1.6", features = ["postgres_backend", "serde_json", "time", "uuid"] } -diesel-async = { version = "0.4.1", features = ["bb8", "postgres"] } +diesel = { version = "2.2.1", features = ["postgres_backend", "serde_json", "time", "uuid"] } +diesel-async = { version = "0.5.0", features = ["bb8", "postgres"] } diesel-derive-enum = { version = "2.1.0", features = ["postgres"] } futures-core = "0.3.30" hex = "0.4.3" From 47b3fb84b62fce6e4b20352ebc2f9ef1cfb8c3e0 Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 12 Nov 2024 13:46:30 -0600 Subject: [PATCH 2/5] Update rust version & MSRV to 1.82 --- .forgejo/workflows/check.yaml | 8 ++++---- .forgejo/workflows/publish.yaml | 14 +++++++------- Cargo.toml | 4 ++++ README.md | 2 +- flake.lock | 12 ++++++------ flake.nix | 6 +++--- nix/pkgs/imagemagick_pict-rs/default.nix | 4 ++-- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.forgejo/workflows/check.yaml b/.forgejo/workflows/check.yaml index ec520d4..cc4bc19 100644 --- a/.forgejo/workflows/check.yaml +++ b/.forgejo/workflows/check.yaml @@ -10,7 +10,7 @@ jobs: clippy: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -27,7 +27,7 @@ jobs: deny: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -43,7 +43,7 @@ jobs: tests: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -65,7 +65,7 @@ jobs: - aarch64-unknown-linux-musl runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 10ac4d3..f2d3f07 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -10,7 +10,7 @@ jobs: clippy: runs-on: base-image container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -27,7 +27,7 @@ jobs: # deny: # runs-on: docker # container: - # image: docker.io/asonix/actions-base-image:0.1.21 + # image: docker.io/asonix/actions-base-image:0.1.22 # steps: # - # name: Checkout pict-rs @@ -43,7 +43,7 @@ jobs: tests: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -62,7 +62,7 @@ jobs: - tests runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 strategy: fail-fast: false matrix: @@ -162,7 +162,7 @@ jobs: publish-docker: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 needs: [build] steps: - @@ -213,7 +213,7 @@ jobs: needs: [build] runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - uses: https://github.com/actions/download-artifact@v3 with: @@ -231,7 +231,7 @@ jobs: needs: [build] runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs diff --git a/Cargo.toml b/Cargo.toml index ea5101d..0edf207 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ license = "AGPL-3.0" readme = "README.md" repository = "https://git.asonix.dog/asonix/pict-rs" edition = "2021" +rust-version = "1.82" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] } [profile.release] strip = true diff --git a/README.md b/README.md index 4ffb07e..abadc59 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ More information is available in the [Ubuntu and Debian docs](./docs/ubuntu-and- ##### Compile from Source pict-rs can be compiled from source using a recent version of the rust compiler. I do development -and produce releases on 1.75 +and produce releases on 1.82 Like the Binary Download option, `imagemagick`, `ffmpeg`, and `exiftool` must be installed for pict-rs to run properly. diff --git a/flake.lock b/flake.lock index 8823d44..18a86a5 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718895438, - "narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d358657..080735b 100644 --- a/flake.nix +++ b/flake.nix @@ -15,12 +15,12 @@ in { packages = rec { - imagemagick7_pict-rs = pkgs.callPackage ./nix/pkgs/imagemagick_pict-rs {}; + imagemagick_pict-rs = pkgs.callPackage ./nix/pkgs/imagemagick_pict-rs {}; ffmpeg6_pict-rs = pkgs.callPackage ./nix/pkgs/ffmpeg_pict-rs {}; pict-rs = pkgs.callPackage ./pict-rs.nix { inherit (pkgs.darwin.apple_sdk.frameworks) Security; - inherit imagemagick7_pict-rs ffmpeg6_pict-rs; + inherit imagemagick_pict-rs ffmpeg6_pict-rs; }; default = pict-rs; @@ -54,7 +54,7 @@ diesel-cli exiftool garage - self.packages.${system}.imagemagick7_pict-rs + self.packages.${system}.imagemagick_pict-rs self.packages.${system}.ffmpeg6_pict-rs jq minio-client diff --git a/nix/pkgs/imagemagick_pict-rs/default.nix b/nix/pkgs/imagemagick_pict-rs/default.nix index 00674e8..902a63a 100644 --- a/nix/pkgs/imagemagick_pict-rs/default.nix +++ b/nix/pkgs/imagemagick_pict-rs/default.nix @@ -1,6 +1,6 @@ -{ imagemagick7 }: +{ imagemagick }: -imagemagick7.override { +imagemagick.override { bzip2Support = true; zlibSupport = true; libX11Support = false; From cb09720d851b90cc1647c96b9b7cabda56896d5b Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 12 Nov 2024 13:54:13 -0600 Subject: [PATCH 3/5] Clippy nit: borrowed value passed to json --- src/lib.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dc90e96..e6e88b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,7 +360,7 @@ async fn handle_upload( image.result.disarm(); } - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok", "files": files }))) @@ -462,7 +462,7 @@ async fn upload_backgrounded( image.result.disarm(); } - Ok(HttpResponse::Accepted().json(&serde_json::json!({ + Ok(HttpResponse::Accepted().json(serde_json::json!({ "msg": "ok", "uploads": files }))) @@ -496,7 +496,7 @@ async fn claim_upload( UploadResult::Success { alias, token } => { let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "files": [{ "file": alias.to_string(), @@ -506,7 +506,7 @@ async fn claim_upload( }))) } UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity() - .json(&serde_json::json!({ + .json(serde_json::json!({ "msg": message, "code": code, }))), @@ -601,7 +601,7 @@ async fn do_download_inline( let (alias, delete_token, details) = ingest_inline(stream, state, upload_query).await?; - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok", "files": [{ "file": alias.to_string(), @@ -628,7 +628,7 @@ async fn do_download_backgrounded( backgrounded.disarm(); - Ok(HttpResponse::Accepted().json(&serde_json::json!({ + Ok(HttpResponse::Accepted().json(serde_json::json!({ "msg": "ok", "uploads": [{ "upload_id": upload_id.to_string(), @@ -821,7 +821,7 @@ async fn process_details( let details = details.ok_or(UploadError::NoFiles)?; - Ok(HttpResponse::Ok().json(&details.into_api_details())) + Ok(HttpResponse::Ok().json(details.into_api_details())) } async fn not_found_hash(repo: &ArcRepo) -> Result, Error> { @@ -1076,7 +1076,7 @@ async fn details_query( let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&details.into_api_details())) + Ok(HttpResponse::Ok().json(details.into_api_details())) } /// Fetch file details @@ -1087,7 +1087,7 @@ async fn details( ) -> Result { let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&details.into_api_details())) + Ok(HttpResponse::Ok().json(details.into_api_details())) } /// Serve files based on alias query @@ -1550,7 +1550,7 @@ async fn purge( queue::cleanup_hash(&state.repo, hash).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "aliases": aliases.iter().map(|a| a.to_string()).collect::>() }))) @@ -1573,7 +1573,7 @@ async fn delete_alias( return Ok(HttpResponse::NotFound().finish()); } - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", }))) } @@ -1587,7 +1587,7 @@ async fn aliases( let aliases = state.repo.aliases_from_alias(&alias).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "aliases": aliases.iter().map(|a| a.to_string()).collect::>() }))) @@ -1606,7 +1606,7 @@ async fn identifier( .await? .ok_or(UploadError::MissingAlias)?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "identifier": identifier.as_ref(), }))) @@ -1942,7 +1942,7 @@ impl, T: serde::Serialize> ConfigSource { async fn export_handler(repo: web::Data) -> Result { repo.export().await?; - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok" }))) } From af96790945155feb0feccdcf53f0446de32c297c Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 12 Nov 2024 13:57:01 -0600 Subject: [PATCH 4/5] Clippy nit: borrowed value passed to span.record --- src/repo/postgres.rs | 2 +- src/repo/sled.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/repo/postgres.rs b/src/repo/postgres.rs index 89e952c..3014558 100644 --- a/src/repo/postgres.rs +++ b/src/repo/postgres.rs @@ -1666,7 +1666,7 @@ impl QueueRepo for PostgresRepo { .map_err(PostgresError::Diesel)?; if let Some((job_id, job_json)) = opt { - tracing::Span::current().record("job_id", &format!("{job_id}")); + tracing::Span::current().record("job_id", format!("{job_id}")); guard.disarm(); tracing::debug!("{job_json}"); diff --git a/src/repo/sled.rs b/src/repo/sled.rs index 6f1a553..371c233 100644 --- a/src/repo/sled.rs +++ b/src/repo/sled.rs @@ -807,7 +807,7 @@ impl QueueRepo for SledRepo { .map_err(|_| RepoError::Canceled)??; if let Some((job_id, job_json)) = opt { - tracing::Span::current().record("job_id", &format!("{}", job_id.0)); + tracing::Span::current().record("job_id", format!("{}", job_id.0)); metrics_guard.disarm(); tracing::debug!("{job_json}"); From 7bc2818d140269a1c46b570e95ba7534a5d173fc Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 23 Nov 2024 14:42:34 -0600 Subject: [PATCH 5/5] switch to nixos-24.11 --- flake.lock | 8 ++++---- flake.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 18a86a5..35b5307 100644 --- a/flake.lock +++ b/flake.lock @@ -20,16 +20,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1731139594, - "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", + "lastModified": 1731755305, + "narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", + "rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 080735b..d5f40bb 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "pict-rs"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; flake-utils.url = "github:numtide/flake-utils"; };