Skip to content

Commit

Permalink
deps: Libflate to flate2 (#8618)
Browse files Browse the repository at this point in the history
* Replace libflate with flate2

* Add .changes file

* Cargo fmt
  • Loading branch information
naman-crabnebula authored Jan 16, 2024
1 parent 06890c7 commit 4926648
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/libflate-to-flate2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": patch:deps
---

Replace `libflate` with `flate2` , this will help to provide additional functionalities and features.
2 changes: 1 addition & 1 deletion tooling/bundler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ]
[dependencies]
tauri-utils = { version = "1.5.2", path = "../../core/tauri-utils", features = [ "resources" ] }
image = "0.24.7"
libflate = "2.0"
flate2 = "1.0"
anyhow = "1.0"
thiserror = "1.0"
serde_json = "1.0"
Expand Down
7 changes: 4 additions & 3 deletions tooling/bundler/src/bundle/linux/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use anyhow::Context;
use handlebars::Handlebars;
use heck::AsKebabCase;
use image::{self, codecs::png::PngDecoder, ImageDecoder};
use libflate::gzip;
use log::info;
use serde::Serialize;
use tar::HeaderMode;
Expand All @@ -44,6 +43,8 @@ use std::{
path::{Path, PathBuf},
};

use flate2::{write::GzEncoder, Compression};

#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct DebIcon {
pub width: u32,
Expand Down Expand Up @@ -391,9 +392,9 @@ fn tar_and_gzip_dir<P: AsRef<Path>>(src_dir: P) -> crate::Result<PathBuf> {
let src_dir = src_dir.as_ref();
let dest_path = src_dir.with_extension("tar.gz");
let dest_file = common::create_file(&dest_path)?;
let gzip_encoder = gzip::Encoder::new(dest_file)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
let gzip_encoder = create_tar_from_dir(src_dir, gzip_encoder)?;
let mut dest_file = gzip_encoder.finish().into_result()?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path)
}
Expand Down
6 changes: 4 additions & 2 deletions tooling/bundler/src/bundle/updater_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use std::{
path::{Path, PathBuf},
};

use flate2::{write::GzEncoder, Compression};

Check warning on line 26 in tooling/bundler/src/bundle/updater_bundle.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

unused imports: `Compression`, `write::GzEncoder`

Check warning on line 26 in tooling/bundler/src/bundle/updater_bundle.rs

View workflow job for this annotation

GitHub Actions / run-integration-tests (windows-latest)

unused imports: `Compression`, `write::GzEncoder`

Check warning on line 26 in tooling/bundler/src/bundle/updater_bundle.rs

View workflow job for this annotation

GitHub Actions / run-integration-tests (windows-latest)

unused imports: `Compression`, `write::GzEncoder`

use anyhow::Context;
use log::info;
use zip::write::FileOptions;
Expand Down Expand Up @@ -235,11 +237,11 @@ pub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {
#[cfg(not(target_os = "windows"))]
fn create_tar(src_dir: &Path, dest_path: &Path) -> crate::Result<PathBuf> {
let dest_file = common::create_file(dest_path)?;
let gzip_encoder = libflate::gzip::Encoder::new(dest_file)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());

let gzip_encoder = create_tar_from_src(src_dir, gzip_encoder)?;

let mut dest_file = gzip_encoder.finish().into_result()?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path.to_owned())
}
Expand Down

0 comments on commit 4926648

Please sign in to comment.