Commit graph

49 commits

Author SHA1 Message Date
Sylvestre Ledru c5728a61b4
fix some clippy warnings (#4229)
* fix some clippy warnings

* Fix the last two
2022-12-14 15:42:07 +01:00
Daniel Hofstetter 3d498432fa build.rs: remove two comments 2022-12-13 15:05:05 +01:00
Terts Diepraam 84b7ecd32d coreutils: update to clap 4 2022-10-13 17:51:01 +02:00
Terts Diepraam adf4bab03c tests: do not generate module structure in build.rs
Generating the tests to run in build.rs created problems for tooling. For example, cargo fmt, was ignoring the test_*.rs files and needed to be passed these files manually to be formatted. Now we simply use the feature mechanism to decide which tests to run.
2022-10-05 13:30:22 +02:00
Jack Grigg fccab8a691 hashsum: Refactor uu_app to isolate non-"GNU Coreutils" options
Several binaries have been added to `hashsum` that have never been part
of GNU Coreutils:

- `sha3*sum` (uutils/coreutils#869)
- `shake*sum` (uutils/coreutils#987)
- `b3sum` (uutils/coreutils#3108 and uutils/coreutils#3164)

In particular, the `--bits` option, and the `--no-names` option added in
uutils/coreutils#3361, are not valid for any GNU Coreutils `*sum` binary
(as of Coreutils 9.0).

This commit refactors the argument parsing so that `--bits` and
`--no-names` become invalid options for the binaries intended to match
the GNU Coreutils API, instead of being ignored options. It also
refactors the custom binary name handling to distinguish between
binaries intended to match the GNU Coreutils API, and binaries that
don't have that constraint.

Part of uutils/coreutils#2930.
2022-06-10 10:07:00 +02:00
Terts Diepraam a10f234854 uudoc: require a feature to build
This is used to not build uudoc by default. See https://github.com/uutils/coreutils/issues/3411
2022-04-25 08:13:28 +02:00
Terts Diepraam 20212be4c8 fix clippy errors related to clap upgrade from 3.0.10 to 3.1.6 2022-03-17 22:46:56 +01:00
Pat Laster 2cd84c2b70 Added b2sum and b3sum utility entries 2022-02-19 11:41:51 -06:00
Sylvestre Ledru de07df5992
Merge pull request #2963 from danieleades/refactor/code-quality
Refactor/code quality
2022-01-30 18:26:16 +01:00
Daniel Eades 784f2e2ea1 use semicolons if nothing returned 2022-01-30 15:08:26 +01:00
Zachary Dremann f9f7e7d490 Avoid unneeded Strings in building phf map 2022-01-30 08:49:34 -05:00
Zachary Dremann bb41f4ffe5 Use a PHF map for util_map()
Rather than building a HashMap at compile time, use the phf (and phf_codegen) crate to build the map
at compile time in build.rs
2022-01-30 06:58:33 -05:00
Terts Diepraam 8872485922 Merge branch 'main' into clap-3 2022-01-17 13:25:51 +01:00
Terts Diepraam 448b84806f
fix Rust 1.58 clippy lints (#2874) 2022-01-16 15:57:33 +01:00
Terts Diepraam c93298f32c coreutils: clap 3 2022-01-11 19:16:48 +01:00
Jeffrey Finkelstein f2bf1a7ff7 fixes suggested by nightly version of clippy 2021-12-26 15:45:33 -05:00
Jan Scheer 7c5395a27a
build.rs: silence clippy warnings 2021-10-18 23:47:09 +02:00
Jan Scheer 7abc6a665e
id: add conditional compilation for selinux 2021-07-13 00:22:10 +02:00
Michael Debertol a9e79c72c7 uutils: enable shell completions
This adds a hidden `completion` subcommand to coreutils. When invoked with
`coreutils completion <utility> <shell>` a completion file will be printed
to stdout. When running `make install` those files will be created for all
utilities and copied to the appropriate locations.
`make install` will install completions for zsh, fish and bash; however,
clap also supports generating completions for powershell and elvish.

With this patch all utilities are required to have a publich uu_app function
that returns a clap::App in addition to the uumain function.
2021-06-25 21:23:45 +02:00
Tuomas Tynkkynen 7b9814c778 test: Implement [ expr ] syntax
When invoked via '[' name, last argument must be ']' or we bail out with
syntax error. Then the trailing ']' is simply disregarded and processing
happens like usual.
2021-06-19 18:49:21 +03:00
ReggaeMuffin 2eb32d845e
chores: run cargo +1.40.0 fmt
Apparently fmt from 1.40.0 is a bit more strict in some places

Let me know if this is worthwhile merging :)
2021-04-02 10:56:49 +01:00
Alex Lyon 110d6844ad
Use an iterator over OsString for uumain()
Additionally, restructure `uname` so that we don't need to find the
iterator's length.
2020-06-16 03:28:02 -05:00
Roy Ivy III 413b63bf5f maint/build ~ (build.rs) support new tests directory organization 2020-06-02 12:16:16 -05:00
Roy Ivy III f82de13847 docs ~ spell-check repairs and addition of exceptions 2020-05-30 01:36:02 -05:00
Roy Ivy III 1fe7cc5595 build/fix ~ (build.rs) fix 'feature => sub-crate/util' translation logic + improved output formatting 2020-05-29 22:59:46 -05:00
Roy Ivy III 0cb5fbd6b5 change ~ remove transition-only and unneeded code for independent sub-crates 2020-05-29 22:59:46 -05:00
Roy Ivy III f051f62445 change ~ add work-around for crate name collisions
- imported crate name collisions bypass implemented

## [why]

There may be some core or external crates required/used by this project that collide with
uutil names. For example, the `test` util collides with the rust core crate 'test' which
is used behind the scenes for testing. Without the renaming scheme used here, cryptic and
fatal compiler errors occur when compiling the integration tests.
2020-05-29 22:59:46 -05:00
Roy Ivy III db2e950918 change ~ make all sub-crates independent 2020-05-29 22:59:40 -05:00
Roy Ivy III 080cbb55c3 refactor/polish ~ fix cargo clippy complaints (string_lit_as_bytes) 2020-04-11 18:50:10 -05:00
Roy Ivy III b7a3c4d8a8 maint/build ~ refactor feature strategy (allows simple cargo build on all platforms) and easier cross-targeted builds 2020-02-09 09:48:55 -06:00
Roy Ivy III 5af8503a5e cargo fmt 2020-01-28 00:05:06 -06:00
Roy Ivy III 95809ae98e Add 'windows_legacy' feature to allow build for older windows versions 2020-01-27 21:33:47 -06:00
Alex Lyon 63f1537838 Add windows feature and make unix imply generic 2019-05-01 21:14:25 -07:00
Alex Lyon 880a4973c1 Format everything using rustfmt 2018-03-12 01:20:58 -07:00
Alex Lyon 15aaa8215e uucore: read from sys:uname on Redox 2018-03-05 17:31:33 -08:00
Daan Hoogland cd1f0690d7 create redox feature as subset of generic 2017-01-15 13:48:33 +01:00
knight42 a0ff0f623a Temporary fix for errors in testing
The errors were caused by the missing env $OUT_DIR which should be set by
cargo.

[Related issue](https://github.com/rust-lang/cargo/issues/3368).
2016-12-08 12:36:07 +08:00
Lei Zhang 546f2855d5 Create a new feature for Fuchsia-enabled utilities. 2016-11-24 18:15:50 -05:00
Alex Lyon 362cabe1a6 hashsum: implement SHAKE-128 and SHAKE-256 2016-08-30 17:33:18 -07:00
Knight 7a152248aa CI: add nightly features 2016-07-29 21:06:52 +08:00
Mike Swanson c946202094 hashsum: add support for SHA-3 functions
Only the fixed output-size functions are supported, SHAKE128 and
SHAKE256 are not included for now.
2016-04-16 06:17:15 -07:00
Nathan Ross e32efaa5a1 allow feature-gated integration tests for unimplemented functionality 2016-02-15 23:48:37 -05:00
Joseph Crail b90d253584 Refactor and simplify build for utilities.
For coreutils, there are two build artifacts:

  1. multicall executable (each utility is a separate static library)
  2. individual utilities (still separate library with main wrapper)

To avoid namespace collision, each utility crate is defined as
"uu_{CMD}". The end user only sees the original utility name. This
simplifies build.rs.

Also, the thin wrapper for the main() function is no longer contained in
the crate. It has been separated into a dedicated file. This was
necessary to work around Cargo's need for the crate name attribute to
match the name in the respective Cargo.toml.
2015-12-07 21:56:45 -05:00
Joseph Crail a8bb7f4417 build: create group features for target systems
This allows a user to create builds with or without the Unix-specific
utilities. Right now the Makefile handles this, but this is needed to
migrate away from make.

To build Unix-specific utilities (default):

cargo build
(or)
cargo build --features unix --no-default-features

To build without the Unix-specific utilities:

cargo build --features generic --no-default-features
2015-11-29 17:27:54 -05:00
Joseph Crail 012414c49f test: fix namespace and broken test
I separated test's main() into a separate file to override Cargo's
requirement for matching crate names. I had to update the build command
to use a special extern reference for test.

Fixes issues caused by #728.
2015-11-27 15:35:20 -05:00
Michael Gehring b1405588ce Fix multicall true 2015-11-27 11:14:25 +01:00
Joseph Crail d4e0ea41a3 Fix namespace collision for test.
To avoid linking issues with Rust's libtest, the crate for the test
utility was changed to 'uutest'. However, the user doesn't need to see
this so a few hoops were jumped through to make this transparent.

I also updated the make rules to build the individual features first and
then uutils. This makes 'make && make test' look more organized.
2015-11-27 01:54:18 -05:00
Michael Gehring ef5e865089 Add true/false back to multicall binary 2015-11-25 08:47:33 +01:00
Michael Gehring 9d8abbcb06 Basic Cargo build
Builds the uutils multicall binary containing all utils (except stdbuf)
by default. To only build a subset
    `cargo --no-default-features --features <utils>`
can be used.

Whats missing is building the standalone binaries and a mechanism to
automatically disable the build of unix only utils on windows.
2015-08-28 21:12:30 +02:00