Skip to content

Commit 98830ea

Browse files
committed
inline dwarfs library to replace external dependency
1 parent 05b2ea7 commit 98830ea

12 files changed

Lines changed: 3644 additions & 113 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

squishy-cli/src/main.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ fn main() {
7777
fs::create_dir_all(write_path).unwrap();
7878
let output_path = write_path.join(file_name);
7979
match appimage.write_entry(&desktop, &output_path) {
80-
Ok(_) => log!(args.quiet, "Wrote {} to {}", desktop.path.display(), output_path.display()),
80+
Ok(_) => log!(
81+
args.quiet,
82+
"Wrote {} to {}",
83+
desktop.path.display(),
84+
output_path.display()
85+
),
8186
Err(e) => elog!(args.quiet, "Failed to write desktop: {}", e),
8287
}
8388
} else {
@@ -94,7 +99,12 @@ fn main() {
9499
fs::create_dir_all(write_path).unwrap();
95100
let output_path = write_path.join(file_name);
96101
match appimage.write_entry(&icon, &output_path) {
97-
Ok(_) => log!(args.quiet, "Wrote {} to {}", icon.path.display(), output_path.display()),
102+
Ok(_) => log!(
103+
args.quiet,
104+
"Wrote {} to {}",
105+
icon.path.display(),
106+
output_path.display()
107+
),
98108
Err(e) => elog!(args.quiet, "Failed to write icon: {}", e),
99109
}
100110
} else {
@@ -111,7 +121,12 @@ fn main() {
111121
fs::create_dir_all(write_path).unwrap();
112122
let output_path = write_path.join(file_name);
113123
match appimage.write_entry(&appstream, &output_path) {
114-
Ok(_) => log!(args.quiet, "Wrote {} to {}", appstream.path.display(), output_path.display()),
124+
Ok(_) => log!(
125+
args.quiet,
126+
"Wrote {} to {}",
127+
appstream.path.display(),
128+
output_path.display()
129+
),
115130
Err(e) => elog!(args.quiet, "Failed to write appstream: {}", e),
116131
}
117132
} else {

squishy/Cargo.toml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,27 @@ path = "src/lib.rs"
1616
default = []
1717
appimage = ["goblin", "rayon"]
1818
rayon = ["dep:rayon"]
19-
dwarfs = ["dep:dwarfs"]
19+
dwarfs = [
20+
"dep:bstr",
21+
"dep:lru",
22+
"dep:positioned-io",
23+
"dep:serde",
24+
"dep:sha2",
25+
"dep:xxhash-rust",
26+
"dep:zerocopy",
27+
"dep:zstd-safe",
28+
]
2029

2130
[dependencies]
2231
backhand = "0.24.0"
23-
dwarfs = { version = "0.2.1", optional = true }
32+
bstr = { version = "1.12.0", features = ["serde"], optional = true }
2433
goblin = { version = "0.10.4", default-features = false, features = ["elf32", "elf64", "endian_fd", "std"], optional = true }
34+
lru = { version = "0.14.0", optional = true }
35+
positioned-io = { version = "0.3.4", default-features = false, optional = true }
2536
rayon = { version = "1.11.0", optional = true }
37+
serde = { version = "1.0.219", features = ["derive"], optional = true }
38+
sha2 = { version = "0.10.9", optional = true }
2639
thiserror = "2.0.17"
40+
xxhash-rust = { version = "0.8.15", features = ["xxh3"], optional = true }
41+
zerocopy = { version = "0.8.25", features = ["derive", "std"], optional = true }
42+
zstd-safe = { version = "7.2.4", default-features = false, optional = true }

squishy/src/appimage.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,16 @@ impl<'a> AppImage<'a> {
243243
}))
244244
}
245245
#[cfg(feature = "dwarfs")]
246-
AppImageFS::DwarFS(dwarfs) => {
247-
Box::new(dwarfs.entries().map(|entry| AppImageEntry {
248-
path: entry.path.clone(),
249-
size: entry.size,
250-
kind: match &entry.kind {
251-
DwarFSEntryKind::File => AppImageEntryKind::File,
252-
DwarFSEntryKind::Directory => AppImageEntryKind::Directory,
253-
DwarFSEntryKind::Symlink(target) => {
254-
AppImageEntryKind::Symlink(target.clone())
255-
}
256-
_ => AppImageEntryKind::Unknown,
257-
},
258-
}))
259-
}
246+
AppImageFS::DwarFS(dwarfs) => Box::new(dwarfs.entries().map(|entry| AppImageEntry {
247+
path: entry.path.clone(),
248+
size: entry.size,
249+
kind: match &entry.kind {
250+
DwarFSEntryKind::File => AppImageEntryKind::File,
251+
DwarFSEntryKind::Directory => AppImageEntryKind::Directory,
252+
DwarFSEntryKind::Symlink(target) => AppImageEntryKind::Symlink(target.clone()),
253+
_ => AppImageEntryKind::Unknown,
254+
},
255+
})),
260256
}
261257
}
262258

0 commit comments

Comments
 (0)