Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust coreutils branch #10057

Open
wants to merge 7 commits into
base: 3.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions LICENSES-AND-NOTICES/SPECS/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,7 @@
"rubygem-yajl-ruby",
"rubygem-zip-zip",
"runc",
"rust-coreutils",
"sdbus-cpp",
"sgx-backwards-compatibility",
"shim",
Expand Down
5 changes: 5 additions & 0 deletions SPECS-EXTENDED/rust-coreutils/cargo_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Signatures": {
"cargo_config.toml": "77e9219c27274120197571fd165cbe4121963b5ad3bc0b20b383c86ef0ce6c2b",
"rust-coreutils-0.0.26-vendored.tar.gz": "589d1979c0cedc7a5a9b7f3b260fea0e474dc06ad572fe069b74073642ea43a6",
"rust-coreutils-0.0.26.tar.gz": "2a0e8511f1e6adf7f1003ce4536b8a8bb1b2289364efe55edf96f2fc9e2f00a4"
}
}
150 changes: 150 additions & 0 deletions SPECS-EXTENDED/rust-coreutils/rust-coreutils.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
Summary: Basic system utilities; reimplemented in Rust
Name: rust-coreutils
Version: 0.0.26
Release: 2%{?dist}
License: MIT
Vendor: Microsoft Corporation
Distribution: Azure Linux
URL: https://github.com/uutils/coreutils
Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Below is a automatically created tarball with no download link.
Source1: rust-coreutils-0.0.26-vendored.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the vendored tarballs, please create a generate_source_tarball.sh script. They are used by the auto-upgrade pipelines to generate new tarballs during an upgrade and they also serve as pointers to how the tarball can be recreated.

Source2: cargo_config.toml


BuildRequires: cargo
BuildRequires: gcc
BuildRequires: glibc
Conflicts: coreutils

%description
This package provides the reimplementation of the GNU core utilities in Rust.

%prep
%setup -q -n coreutils-%{version}
tar --strip-components=1 -xzf %{SOURCE1}
Comment on lines +24 to +25
Copy link
Contributor

@PawelWMS PawelWMS Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: can we build the vendored tarball, so that we don't need --strip-components=1? We can also switch to %autosetup and end up with this:

Suggested change
%setup -q -n coreutils-%{version}
tar --strip-components=1 -xzf %{SOURCE1}
%autosetup -q -n coreutils-%{version} -a 1

See SPECS/blobfuse2/blobfuse2.spec for instance.

install -D %{SOURCE2} .cargo/config

%build
cargo build --release --offline

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}


utilities=(
"uniq" "nl" "echo" "shred" "od" "basename" "cat" "split" "md5sum" "shake256sum"
"tr" "dir" "comm" "pwd" "tee" "head" "ls" "sort" "b3sum" "b2sum"
"printf" "vdir" "test" "dd" "cut" "df" "shuf" "csplit" "ln"
"numfmt" "mv" "mktemp" "yes" "pr" "seq" "tail" "sha1sum" "sha224sum"
"touch" "tac" "basenc" "rmdir" "paste" "sha256sum" "sha3-256sum"
"dirname" "base32" "factor" "printenv" "sleep" "readlink" "sha3-224sum"
"du" "truncate" "more" "dircolors" "link" "date" "sum" "false"
"true" "wc" "mkdir" "expand" "hashsum" "sha3-384sum" "sha512sum"
"cksum" "base64" "unlink" "fold" "expr" "join" "rm" "sha3-512sum" "shake128sum"
"ptx" "realpath" "unexpand" "fmt" "env" "tsort" "cp" "sha384sum" "sha3sum"
)

pushd %{buildroot}%{_bindir}
for util in "${utilities[@]}"; do
ln -sf coreutils ${util}
done
popd


%files
%{_bindir}/coreutils
%{_bindir}/b2sum
%{_bindir}/b3sum
%{_bindir}/base32
%{_bindir}/base64
%{_bindir}/basename
%{_bindir}/basenc
%{_bindir}/cat
%{_bindir}/cksum
%{_bindir}/comm
%{_bindir}/cp
%{_bindir}/csplit
%{_bindir}/cut
%{_bindir}/date
%{_bindir}/dd
%{_bindir}/df
%{_bindir}/dir
%{_bindir}/dircolors
%{_bindir}/dirname
%{_bindir}/du
%{_bindir}/echo
%{_bindir}/env
%{_bindir}/expand
%{_bindir}/expr
%{_bindir}/factor
%{_bindir}/false
%{_bindir}/fmt
%{_bindir}/fold
%{_bindir}/hashsum
%{_bindir}/head
%{_bindir}/join
%{_bindir}/link
%{_bindir}/ln
%{_bindir}/ls
%{_bindir}/md5sum
%{_bindir}/mkdir
%{_bindir}/mktemp
%{_bindir}/more
%{_bindir}/mv
%{_bindir}/nl
%{_bindir}/numfmt
%{_bindir}/od
%{_bindir}/paste
%{_bindir}/pr
%{_bindir}/printenv
%{_bindir}/printf
%{_bindir}/ptx
%{_bindir}/pwd
%{_bindir}/readlink
%{_bindir}/realpath
%{_bindir}/rm
%{_bindir}/rmdir
%{_bindir}/seq
%{_bindir}/sha1sum
%{_bindir}/sha224sum
%{_bindir}/sha256sum
%{_bindir}/sha3-224sum
%{_bindir}/sha3-256sum
%{_bindir}/sha3-384sum
%{_bindir}/sha3-512sum
%{_bindir}/sha384sum
%{_bindir}/sha3sum
%{_bindir}/sha512sum
%{_bindir}/shake128sum
%{_bindir}/shake256sum
%{_bindir}/shred
%{_bindir}/shuf
%{_bindir}/sleep
%{_bindir}/sort
%{_bindir}/split
%{_bindir}/sum
%{_bindir}/tac
%{_bindir}/tail
%{_bindir}/tee
%{_bindir}/test
%{_bindir}/touch
%{_bindir}/tr
%{_bindir}/true
%{_bindir}/truncate
%{_bindir}/tsort
%{_bindir}/unexpand
%{_bindir}/uniq
%{_bindir}/unlink
%{_bindir}/vdir
%{_bindir}/wc
%{_bindir}/yes

%changelog
* Sat Aug 10 2024 Chris Co <[email protected]> - 0.0.26-2
- Original version for Azure Linux (license: MIT)
- License verified

* Fri May 31 2024 Antonio Salinas <[email protected]> - 0.0.26-1
- Intgrated Rust implementation of GNU coreutils.
10 changes: 10 additions & 0 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26959,6 +26959,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "rust-coreutils",
"version": "0.0.26",
"downloadUrl": "https://github.com/uutils/coreutils/archive/refs/tags/0.0.26.tar.gz"
}
}
},
{
"component": {
"type": "other",
Expand Down
Loading