From 2768fd22b10936a7f973fcf0e75482778950ecda Mon Sep 17 00:00:00 2001 From: Yuriy Poltorak Date: Fri, 27 Jun 2025 11:31:28 +0300 Subject: [PATCH] feat: support `.deb` packages (#2807) Co-authored-by: sxyazi --- .github/workflows/draft.yml | 24 ++++++++++------- Cargo.lock | 34 ++++++++++++------------- Cargo.toml | 4 +-- scripts/build.sh | 16 +++++++++--- snap/snapcraft.yaml | 2 +- yazi-config/Cargo.toml | 1 - yazi-core/Cargo.toml | 1 - yazi-packing/Cargo.toml | 25 ++++++++++++++++++ yazi-packing/src/lib.rs | 0 yazi-shared/Cargo.toml | 2 -- yazi-widgets/src/input/commands/type.rs | 7 ----- 11 files changed, 73 insertions(+), 43 deletions(-) create mode 100644 yazi-packing/Cargo.toml create mode 100644 yazi-packing/src/lib.rs diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index 0cea3b43..968e8b3b 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -57,8 +57,10 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: yazi-${{ matrix.target }}.zip - path: yazi-${{ matrix.target }}.zip + name: ${{ matrix.target }} + path: | + yazi-${{ matrix.target }}.zip + yazi-${{ matrix.target }}.deb build-windows: strategy: @@ -100,7 +102,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: yazi-${{ matrix.target }}.zip + name: ${{ matrix.target }} path: yazi-${{ matrix.target }}.zip build-musl: @@ -128,8 +130,10 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: yazi-${{ matrix.target }}.zip - path: yazi-${{ matrix.target }}.zip + name: ${{ matrix.target }} + path: | + yazi-${{ matrix.target }}.zip + yazi-${{ matrix.target }}.deb build-snap: strategy: @@ -160,7 +164,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: yazi-${{ matrix.arch }}.snap + name: snap-${{ matrix.arch }} path: yazi-${{ matrix.arch }}.snap snap: @@ -169,7 +173,7 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: yazi-*.snap + pattern: snap-* merge-multiple: true - name: Setup snapcraft @@ -180,14 +184,14 @@ jobs: env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} run: | - parallel 'snapcraft push -v --release latest/candidate {}' ::: yazi-*.snap + parallel 'snapcraft push -v --release latest/candidate {}' ::: yazi-*.snap || true - name: Push snap to edge channel if: ${{ !startsWith(github.ref, 'refs/tags/') }} env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} run: | - parallel 'snapcraft push -v --release latest/edge {}' ::: yazi-*.snap + parallel 'snapcraft push -v --release latest/edge {}' ::: yazi-*.snap || true draft: if: startsWith(github.ref, 'refs/tags/') @@ -206,6 +210,7 @@ jobs: draft: true files: | yazi-*.zip + yazi-*.deb yazi-*.snap generate_release_notes: true @@ -241,6 +246,7 @@ jobs: prerelease: true files: | yazi-*.zip + yazi-*.deb yazi-*.snap name: Nightly Build body: ${{ env.NIGHTLY_BODY }} diff --git a/Cargo.lock b/Cargo.lock index 8bb8f191..fcd2cf1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "avif-serialize" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98922d6a4cfbcb08820c69d8eeccc05bb1f29bfa06b4f5b1dbfe9a868bd7608e" +checksum = "19135c0c7a60bfee564dbe44ab5ce0557c6bf3884e5291a50be76a15640c4fbd" dependencies = [ "arrayvec", ] @@ -304,9 +304,9 @@ checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b" [[package]] name = "bumpalo" -version = "3.18.1" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "by_address" @@ -617,9 +617,9 @@ dependencies = [ [[package]] name = "crunchy" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "darling" @@ -1165,9 +1165,9 @@ checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" [[package]] name = "indexmap" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", @@ -1324,9 +1324,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +checksum = "1580801010e535496706ba011c15f8532df6b42297d2e471fec38ceadd8c0638" dependencies = [ "bitflags 2.9.1", "libc", @@ -1387,9 +1387,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198" +checksum = "0281c2e25e62316a5c9d98f2d2e9e95a37841afdaf4383c177dbb5c1dfab0568" dependencies = [ "hashbrown", ] @@ -3529,7 +3529,6 @@ dependencies = [ "regex", "serde", "toml", - "toml_edit", "tracing", "yazi-codegen", "yazi-fs", @@ -3545,7 +3544,6 @@ dependencies = [ "anyhow", "bitflags 2.9.1", "crossterm 0.29.0", - "dirs", "futures", "indexmap", "libc", @@ -3678,6 +3676,10 @@ dependencies = [ name = "yazi-macro" version = "25.6.11" +[[package]] +name = "yazi-packing" +version = "25.5.28" + [[package]] name = "yazi-plugin" version = "25.6.11" @@ -3744,7 +3746,7 @@ dependencies = [ "async-priority-channel", "futures", "libc", - "lru 0.14.0", + "lru 0.15.0", "parking_lot", "scopeguard", "tokio", @@ -3773,10 +3775,8 @@ dependencies = [ "ordered-float 5.0.0", "parking_lot", "percent-encoding", - "ratatui", "serde", "tokio", - "tracing", "uzers", "windows-sys 0.60.2", "yazi-macro", diff --git a/Cargo.toml b/Cargo.toml index 01e19a7d..d45671c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,9 +31,9 @@ dirs = "6.0.0" foldhash = "0.1.5" futures = "0.3.31" globset = "0.4.16" -indexmap = { version = "2.9.0", features = [ "serde" ] } +indexmap = { version = "2.10.0", features = [ "serde" ] } libc = "0.2.174" -lru = "0.14.0" +lru = "0.15.0" mlua = { version = "0.10.5", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] } objc = "0.2.7" ordered-float = { version = "5.0.0", features = [ "serde" ] } diff --git a/scripts/build.sh b/scripts/build.sh index 4a8609fe..250a7c65 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,14 +4,24 @@ set -euo pipefail export ARTIFACT_NAME="yazi-$1" export YAZI_GEN_COMPLETIONS=1 -# Build for the target +# Build the target git config --global --add safe.directory "*" cargo build --release --locked --target "$1" +# Use a consistent target directory +rm -rf target/release +mv "target/$1/release" target/release + +# Package deb +if [[ "$ARTIFACT_NAME" == *-linux-* ]] && { [[ "$ARTIFACT_NAME" == *-aarch64-* ]] || [[ "$ARTIFACT_NAME" == *-x86_64-* ]]; }; then + cargo install cargo-deb + cargo deb -p yazi-packing --no-build -o "$ARTIFACT_NAME.deb" +fi + # Create the artifact mkdir -p "$ARTIFACT_NAME/completions" -cp "target/$1/release/ya" "$ARTIFACT_NAME" -cp "target/$1/release/yazi" "$ARTIFACT_NAME" +cp "target/release/ya" "$ARTIFACT_NAME" +cp "target/release/yazi" "$ARTIFACT_NAME" cp yazi-cli/completions/* "$ARTIFACT_NAME/completions" cp yazi-boot/completions/* "$ARTIFACT_NAME/completions" cp README.md LICENSE "$ARTIFACT_NAME" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 087c2dac..416183e7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -30,7 +30,7 @@ parts: - chafa - fd-find - ffmpeg - - fzf + # - fzf - libglu1-mesa - libglut3.12 - poppler-utils diff --git a/yazi-config/Cargo.toml b/yazi-config/Cargo.toml index 2facaea8..23181ef0 100644 --- a/yazi-config/Cargo.toml +++ b/yazi-config/Cargo.toml @@ -26,7 +26,6 @@ ratatui = { workspace = true } regex = { workspace = true } serde = { workspace = true } toml = { workspace = true } -toml_edit = "0.22.27" tracing = { workspace = true } [target.'cfg(target_os = "macos")'.dependencies] diff --git a/yazi-core/Cargo.toml b/yazi-core/Cargo.toml index f6ec12eb..367c4646 100644 --- a/yazi-core/Cargo.toml +++ b/yazi-core/Cargo.toml @@ -27,7 +27,6 @@ yazi-widgets = { path = "../yazi-widgets", version = "25.6.11" } anyhow = { workspace = true } bitflags = { workspace = true } crossterm = { workspace = true } -dirs = { workspace = true } futures = { workspace = true } indexmap = { workspace = true } notify = { version = "8.0.0", default-features = false, features = [ "macos_fsevent" ] } diff --git a/yazi-packing/Cargo.toml b/yazi-packing/Cargo.toml new file mode 100644 index 00000000..6f2a275e --- /dev/null +++ b/yazi-packing/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "yazi-packing" +version = "25.5.28" +edition = "2024" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi packing" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" + + [package.metadata.deb] + name = "yazi" + license-file = [ "../LICENSE", "0" ] + depends = "file, ffmpeg, 7zip, jq, poppler-utils, fd-find, ripgrep, fzf, zoxide, imagemagick, xsel|xclip|wl-clipboard" + recommends = "bash-completion" + extended-description-file = "README.md" + section = "utility" + priority = "optional" + assets = [ + [ "target/release/ya", "usr/bin/", "755" ], + [ "target/release/yazi", "usr/bin/", "755" ], + [ "../README.md", "usr/share/doc/yazi/README", "644" ], + [ "../yazi-cli/completions/ya.bash", "usr/share/bash-completion/completions/ya", "644" ], + [ "../yazi-boot/completions/yazi.bash", "usr/share/bash-completion/completions/yazi", "644" ], + ] diff --git a/yazi-packing/src/lib.rs b/yazi-packing/src/lib.rs new file mode 100644 index 00000000..e69de29b diff --git a/yazi-shared/Cargo.toml b/yazi-shared/Cargo.toml index 2acf7a3f..caa62914 100644 --- a/yazi-shared/Cargo.toml +++ b/yazi-shared/Cargo.toml @@ -21,10 +21,8 @@ memchr = "2.7.5" ordered-float = { workspace = true } parking_lot = { workspace = true } percent-encoding = "2.3.1" -ratatui = { workspace = true } serde = { workspace = true } tokio = { workspace = true } -tracing = { workspace = true } [target."cfg(unix)".dependencies] libc = { workspace = true } diff --git a/yazi-widgets/src/input/commands/type.rs b/yazi-widgets/src/input/commands/type.rs index 492122db..f3c9caa5 100644 --- a/yazi-widgets/src/input/commands/type.rs +++ b/yazi-widgets/src/input/commands/type.rs @@ -1,15 +1,8 @@ use yazi_config::keymap::Key; use yazi_macro::render; -use yazi_shared::event::CmdCow; use crate::input::{Input, InputMode}; -struct Opt; - -impl From for Opt { - fn from(_: CmdCow) -> Self { Self } -} - impl Input { pub fn r#type(&mut self, key: &Key) -> bool { let Some(c) = key.plain() else { return false };