Skip to content

Commit 5dde08a

Browse files
committed
md5sum: introduce standalone binary
1 parent 814d283 commit 5dde08a

File tree

15 files changed

+913
-5
lines changed

15 files changed

+913
-5
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ feat_common_core = [
8080
"basenc",
8181
"cat",
8282
"cksum",
83+
"md5sum",
8384
"comm",
8485
"cp",
8586
"csplit",
@@ -437,6 +438,7 @@ chmod = { optional = true, version = "0.5.0", package = "uu_chmod", path = "src/
437438
chown = { optional = true, version = "0.5.0", package = "uu_chown", path = "src/uu/chown" }
438439
chroot = { optional = true, version = "0.5.0", package = "uu_chroot", path = "src/uu/chroot" }
439440
cksum = { optional = true, version = "0.5.0", package = "uu_cksum", path = "src/uu/cksum" }
441+
md5sum = { optional = true, version = "0.5.0", package = "uu_md5sum", path = "src/uu/md5sum" }
440442
comm = { optional = true, version = "0.5.0", package = "uu_comm", path = "src/uu/comm" }
441443
cp = { optional = true, version = "0.5.0", package = "uu_cp", path = "src/uu/cp" }
442444
csplit = { optional = true, version = "0.5.0", package = "uu_csplit", path = "src/uu/csplit" }

GNUmakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ PROGS := \
8484
basename \
8585
cat \
8686
cksum \
87+
md5sum \
8788
comm \
8889
cp \
8990
csplit \
@@ -186,7 +187,6 @@ SELINUX_PROGS := \
186187

187188
HASHSUM_PROGS := \
188189
b2sum \
189-
md5sum \
190190
sha1sum \
191191
sha224sum \
192192
sha256sum \
@@ -223,6 +223,7 @@ TEST_PROGS := \
223223
chmod \
224224
chown \
225225
cksum \
226+
md5sum \
226227
comm \
227228
cp \
228229
csplit \

build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub fn main() {
7979
phf_map.entry(krate, format!("({krate}::uumain, {krate}::uu_app_custom)"));
8080

8181
let map_value = format!("({krate}::uumain, {krate}::uu_app_common)");
82-
phf_map.entry("md5sum", map_value.clone());
8382
phf_map.entry("sha1sum", map_value.clone());
8483
phf_map.entry("sha224sum", map_value.clone());
8584
phf_map.entry("sha256sum", map_value.clone());

src/uu/md5sum/Cargo.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[package]
2+
name = "uu_md5sum"
3+
description = "md5sum ~ (uutils) Print or check the BLAKE2b checksums"
4+
repository = "https://github.com/uutils/coreutils/tree/main/src/uu/md5sum"
5+
version.workspace = true
6+
authors.workspace = true
7+
license.workspace = true
8+
homepage.workspace = true
9+
keywords.workspace = true
10+
categories.workspace = true
11+
edition.workspace = true
12+
readme.workspace = true
13+
14+
[lints]
15+
workspace = true
16+
17+
[lib]
18+
path = "src/md5sum.rs"
19+
20+
[dependencies]
21+
clap = { workspace = true }
22+
uu_checksum_common = { workspace = true }
23+
uucore = { workspace = true, features = [
24+
"checksum",
25+
"encoding",
26+
"sum",
27+
"hardware",
28+
] }
29+
fluent = { workspace = true }
30+
31+
[dev-dependencies]
32+
divan = { workspace = true }
33+
tempfile = { workspace = true }
34+
uucore = { workspace = true, features = ["benchmark"] }
35+
36+
[[bin]]
37+
name = "md5sum"
38+
path = "src/main.rs"
39+
40+
# [[bench]]
41+
# name = "b2sum_bench"
42+
# harness = false

src/uu/md5sum/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../LICENSE

src/uu/md5sum/locales/en-US.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
md5sum-about = Print or check the MD5 checksums
2+
md5sum-usage = md5sum [OPTIONS] [FILE]...
3+
md5sum-after-help = With no FILE or when FILE is -, read standard input

src/uu/md5sum/locales/fr-FR.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
md5sum-about = Afficher le MD5 et la taille de chaque fichier
2+
md5sum-usage = md5sum [OPTION]... [FICHIER]...

src/uu/md5sum/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uucore::bin!(uu_md5sum);

src/uu/md5sum/src/md5sum.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This file is part of the uutils coreutils package.
2+
//
3+
// For the full copyright and license information, please view the LICENSE
4+
// file that was distributed with this source code.
5+
6+
// spell-checker:ignore (ToDO) algo
7+
8+
use clap::Command;
9+
10+
use uu_checksum_common::{standalone_checksum_app, standalone_main};
11+
12+
use uucore::checksum::AlgoKind;
13+
use uucore::error::UResult;
14+
use uucore::translate;
15+
16+
#[uucore::main]
17+
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
18+
standalone_main(AlgoKind::Md5, uu_app(), args)
19+
}
20+
21+
#[inline]
22+
pub fn uu_app() -> Command {
23+
standalone_checksum_app(translate!("md5sum-about"), translate!("md5sum-usage"))
24+
}

0 commit comments

Comments
 (0)