Skip to content

Commit 34ce82f

Browse files
authored
Merge branch 'main' into numfmt-2
2 parents 840c848 + 209bb97 commit 34ce82f

11 files changed

Lines changed: 2746 additions & 2594 deletions

File tree

.github/workflows/make.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,40 @@ jobs:
266266
# 2. the makefile doesn't try to install libstdbuf even though stdbuf is skipped
267267
DESTDIR=/tmp/ make SKIP_UTILS="stdbuf" install
268268
269+
# keep this job minimal to avoid have many duplicated build with CICD
270+
build_makefile-other:
271+
name: Build/Makefile
272+
runs-on: ${{ matrix.job.os }}
273+
env:
274+
CARGO_INCREMENTAL: 0
275+
strategy:
276+
fail-fast: false
277+
matrix:
278+
job:
279+
- { os: windows-latest , features: feat_os_windows }
280+
steps:
281+
- uses: actions/checkout@v6
282+
with:
283+
persist-credentials: false
284+
- uses: Swatinem/rust-cache@v2
285+
- name: Run sccache-cache
286+
id: sccache-setup
287+
uses: mozilla-actions/sccache-action@v0.0.9
288+
continue-on-error: true
289+
- name: Export sccache
290+
if: steps.sccache-setup.outcome == 'success'
291+
run: |
292+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
293+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
294+
- name: "`make build`"
295+
shell: bash
296+
run: |
297+
set -x
298+
# Check that we exclude unix programs to avoid build failure
299+
make PREFIX=/tmp/usr MULTICALL=y COMPLETIONS=n MANPAGES=n LOCALES=n \
300+
SKIP_UTILS="arch b2sum base32 base64 basename basenc cat cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold head hostname join link ln ls md5sum mkdir mktemp more mv nl nproc numfmt od paste pr printenv printf ptx pwd readlink realpath rm rmdir seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split sum sync tac tail tee test touch tr truncate tsort uname unexpand uniq unlink vdir wc whoami yes"
301+
target/debug/coreutils.exe true
302+
269303
test_busybox:
270304
name: Tests/BusyBox test suite
271305
runs-on: ${{ matrix.job.os }}

GNUmakefile

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,44 +62,31 @@ TOYBOX_ROOT := $(BASEDIR)/tmp
6262
TOYBOX_VER := 0.8.12
6363
TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER)
6464

65-
#------------------------------------------------------------------------
66-
# Detect the host system.
67-
# On Windows uname -s might return MINGW_NT-* or CYGWIN_NT-*.
68-
# Otherwise let it default to the kernel name returned by uname -s
69-
# (Linux, Darwin, FreeBSD, …).
70-
#------------------------------------------------------------------------
71-
OS ?= $(shell uname -s)
65+
# Detect the target system
66+
# See https://doc.rust-lang.org/beta/rustc/platform-support.html
67+
# todo: support building wasm
68+
OS := $(or $(CARGO_BUILD_TARGET),$(shell rustc --print host-tuple))
7269

7370
# Windows does not allow symlink by default.
7471
# Allow to override LN for AppArmor.
75-
ifneq (,$(findstring _NT,$(OS)))
72+
ifneq (,$(findstring windows,$(OS)))
7673
LN ?= ln -f
7774
endif
7875
LN ?= ln -sf
7976

80-
# Possible programs
81-
PROGS := \
82-
$(shell sed -n '/feat_Tier1 = \[/,/\]/p' Cargo.toml | sed '1d;2d' |tr -d '],"\n')\
83-
$(shell sed -n '/feat_common_core = \[/,/\]/p' Cargo.toml | sed '1d' |tr -d '],"\n')
84-
85-
UNIX_PROGS := \
86-
$(shell sed -n '/feat_require_unix_core = \[/,/\]/p' Cargo.toml | sed '1d' |tr -d '],"\n') \
87-
hostid \
88-
pinky \
89-
stdbuf \
90-
uptime \
91-
users \
92-
who
93-
9477
SELINUX_PROGS := \
9578
chcon \
9679
runcon
9780

9881
$(info Detected OS = $(OS))
9982

100-
ifeq (,$(findstring MINGW,$(OS)))
101-
PROGS += $(UNIX_PROGS)
83+
ifeq (,$(findstring windows,$(OS)))
84+
FEATURE_EXTRACT_UTILS := feat_os_unix
85+
else
86+
FEATURE_EXTRACT_UTILS := feat_Tier1
10287
endif
88+
PROGS := $(shell cargo tree --depth 1 --features $(FEATURE_EXTRACT_UTILS) --format "{p}" --prefix none | sed -E -n 's/^uu_([^ ]+).*/\1/p')
89+
10390
ifeq ($(SELINUX_ENABLED),1)
10491
PROGS += $(SELINUX_PROGS)
10592
endif
@@ -114,7 +101,7 @@ endif
114101
# Programs with usable tests
115102

116103
TESTS := \
117-
$(sort $(filter $(UTILS),$(PROGS) $(UNIX_PROGS) $(SELINUX_PROGS)))
104+
$(sort $(filter $(UTILS),$(PROGS) $(SELINUX_PROGS)))
118105

119106
TEST_NO_FAIL_FAST :=
120107
TEST_SPEC_FEATURE :=
@@ -288,7 +275,7 @@ install: build install-manpages install-completions install-locales
288275
mkdir -p $(INSTALLDIR_BIN)
289276
ifneq (,$(and $(findstring stdbuf,$(UTILS)),$(findstring feat_external_libstdbuf,$(CARGOFLAGS))))
290277
mkdir -p $(DESTDIR)$(LIBSTDBUF_DIR)
291-
ifneq (,$(findstring CYGWIN,$(OS)))
278+
ifneq (,$(findstring cygwin,$(OS)))
292279
$(INSTALL) -m 755 $(BUILDDIR)/deps/stdbuf.dll $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.dll
293280
else
294281
$(INSTALL) -m 755 $(BUILDDIR)/deps/libstdbuf.* $(DESTDIR)$(LIBSTDBUF_DIR)/
@@ -308,7 +295,7 @@ else
308295
endif
309296

310297
uninstall:
311-
ifeq (,$(findstring MINGW,$(OS)))
298+
ifeq (,$(findstring windows,$(OS)))
312299
rm -f $(DESTDIR)$(LIBSTDBUF_DIR)/libstdbuf.*
313300
-rm -d $(DESTDIR)$(LIBSTDBUF_DIR) 2>/dev/null || true
314301
endif

src/uu/cut/src/cut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ fn cut_fields_newline_char_delim<R: Read, W: Write>(
260260
reader: R,
261261
out: &mut W,
262262
ranges: &[Range],
263-
only_delimited: bool,
264263
newline_char: u8,
265264
out_delim: &[u8],
265+
only_delimited: bool,
266266
) -> UResult<()> {
267267
let mut reader = BufReader::new(reader);
268268
let mut line = Vec::new();
@@ -398,9 +398,9 @@ fn cut_fields<R: Read, W: Write>(
398398
reader,
399399
out,
400400
ranges,
401-
field_opts.only_delimited,
402401
newline_char,
403402
out_delim,
403+
field_opts.only_delimited,
404404
)
405405
}
406406
Delimiter::Slice(delim) => {

0 commit comments

Comments
 (0)