Repair release archives and document current Sized distribution
This commit is contained in:
+2
-1
@@ -4,7 +4,8 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A modern, fast, and concurrent disk usage analyzer"
|
description = "A modern, fast, and concurrent disk usage analyzer"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
repository = "https://gitlab.speelman.ca/gamertan/sized"
|
repository = "https://gitea.speelman.ca/gamertan/sized"
|
||||||
|
homepage = "https://gamertan.com/projects/sized/"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
categories = ["command-line-utilities", "filesystem"]
|
categories = ["command-line-utilities", "filesystem"]
|
||||||
|
|||||||
@@ -16,16 +16,28 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### From Binaries (Recommended)
|
### From source
|
||||||
Download the latest pre-compiled binaries from the [Releases](https://gitlab.speelman.ca/gamertan/sized/releases) page.
|
|
||||||
|
The following installs the current review branch, including scanner hardening
|
||||||
|
not present in the published v1.0.0 release:
|
||||||
|
|
||||||
### From Source
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://gitlab.speelman.ca/gamertan/sized.git
|
git clone --branch sizequeen-scan-hardening https://gitea.speelman.ca/gamertan/sized.git
|
||||||
cd sized
|
cd sized
|
||||||
make install # Installs binary and man page
|
cargo install --locked --path .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Cargo installs to `~/.cargo/bin`. For the published source instead, check out
|
||||||
|
`v1.0.0` before installing. `make install PREFIX="$HOME/.local"` additionally
|
||||||
|
installs the man page without requiring administrator privileges.
|
||||||
|
|
||||||
|
### Existing release files
|
||||||
|
|
||||||
|
The [v1.0.0 release](https://gitea.speelman.ca/gamertan/sized/releases/tag/v1.0.0)
|
||||||
|
has source archives, a macOS arm64 executable, a man page and completions.
|
||||||
|
It has no Linux binary, architecture-labelled binary archive or `.deb` attachment.
|
||||||
|
See the [README](README.md#installation) for current installation guidance.
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
By default, `sized` analyzes the current directory recursively and displays a table of the immediate children.
|
By default, `sized` analyzes the current directory recursively and displays a table of the immediate children.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ MANDIR = $(PREFIX)/share/man/man1
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
cargo build --release
|
cargo build --locked --release
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
install -d $(BINDIR)
|
install -d $(BINDIR)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
# Sized
|
# Sized
|
||||||
|
|
||||||
A fast, concurrent, and feature-rich command-line tool for visualizing disk usage, written in Rust.
|
**Know what’s taking up space. Without leaving your terminal.**
|
||||||
|
|
||||||
|
Sized is a Rust command-line disk usage tool for macOS and Linux. Inspect large
|
||||||
|
folders, filter the noise, and export reports for your own scripts.
|
||||||
|
[Project page](https://gamertan.com/projects/sized/) ·
|
||||||
|
[Prefer a visual map? Meet SizeQueen](https://gamertan.com/projects/sizequeen/).
|
||||||
|
|
||||||
|
This branch contains scanner hardening under review. The published **v1.0.0**
|
||||||
|
release predates the hard-link, partial-scan and filesystem-boundary changes
|
||||||
|
below. No new release is implied by a branch build.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Allocation by Default**: Prioritizes filesystem-reported allocated blocks; sparse files retain their separate apparent size, and hard-link allocation is counted once per scan. Reported allocation is not a promise of bytes freed by deletion on filesystems with shared extents or snapshots.
|
- **Allocation by Default**: Prioritizes filesystem-reported allocated blocks; sparse files retain their separate apparent size, and hard-link allocation is counted once per scan. Reported allocation is not a promise of bytes freed by deletion on filesystems with shared extents or snapshots.
|
||||||
- **Fast & Concurrent**: Uses `rayon` to process directories in parallel, making it extremely fast on modern multi-core systems.
|
- **Fast & Concurrent**: Processes directories in parallel with `rayon`; scan time depends on the filesystem and workload.
|
||||||
- **Rich Output**: Beautifully formatted tables with colors, distinguishing files and directories.
|
- **Rich Output**: Beautifully formatted tables with colors, distinguishing files and directories.
|
||||||
- **Apparent Size**: Toggle logical file length with `-a` or `--apparent`.
|
- **Apparent Size**: Toggle logical file length with `-a` or `--apparent`.
|
||||||
- **Unit Selection**: Switch between Binary (IEC) and Decimal (SI) unit systems via `--units`.
|
- **Unit Selection**: Switch between Binary (IEC) and Decimal (SI) unit systems via `--units`.
|
||||||
@@ -18,56 +27,40 @@ A fast, concurrent, and feature-rich command-line tool for visualizing disk usag
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### 🚀 Direct Download (macOS & Linux)
|
### Build the current review branch
|
||||||
Download the latest archive for your architecture from the [Releases](https://gitlab.speelman.ca/gamertan/sized/releases) page.
|
|
||||||
|
With a Rust toolchain and Git installed:
|
||||||
|
|
||||||
1. **Extract the archive**:
|
|
||||||
```bash
|
```bash
|
||||||
tar -xzf sized-v1.0.0-Darwin-arm64.tar.gz
|
git clone --branch sizequeen-scan-hardening https://gitea.speelman.ca/gamertan/sized.git
|
||||||
```
|
|
||||||
|
|
||||||
2. **Install Binary & Man Page**:
|
|
||||||
```bash
|
|
||||||
# Move binary to path
|
|
||||||
sudo mv sized /usr/local/bin/
|
|
||||||
|
|
||||||
# Install man page
|
|
||||||
sudo mkdir -p /usr/local/share/man/man1
|
|
||||||
sudo cp sized.1 /usr/local/share/man/man1/
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **macOS Security (Gatekeeper)**:
|
|
||||||
Since the binary isn't code-signed for the App Store, macOS may block it. To allow it:
|
|
||||||
```bash
|
|
||||||
sudo xattr -d com.apple.quarantine /usr/local/bin/sized
|
|
||||||
```
|
|
||||||
*Alternatively, run `sized` once, let it fail, then go to **System Settings > Privacy & Security** and click **"Allow Anyway"**.*
|
|
||||||
|
|
||||||
### 🍺 Homebrew (macOS & Linux)
|
|
||||||
If you have a homebrew tap:
|
|
||||||
```bash
|
|
||||||
brew install gamertan/tap/sized
|
|
||||||
```
|
|
||||||
|
|
||||||
### 📦 Debian / Ubuntu (.deb)
|
|
||||||
1. Download the `.deb` package from the [Releases](https://gitlab.speelman.ca/gamertan/sized/releases) page.
|
|
||||||
2. Install using `dpkg`:
|
|
||||||
```bash
|
|
||||||
sudo dpkg -i sized_1.0.0_amd64.deb
|
|
||||||
```
|
|
||||||
|
|
||||||
### 🦀 From Source (Rust toolchain required)
|
|
||||||
```bash
|
|
||||||
git clone https://gitlab.speelman.ca/gamertan/sized.git
|
|
||||||
cd sized
|
cd sized
|
||||||
make install # Installs binary and man page
|
cargo install --locked --path .
|
||||||
|
sized --help
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, via Cargo:
|
Cargo installs into `~/.cargo/bin`; include it in your `PATH`. For the published
|
||||||
|
source instead, check out `v1.0.0` before the install command. Source builds run
|
||||||
|
locally; they are separate from SizeQueen's signed and notarized Mac app.
|
||||||
|
|
||||||
|
To install the binary and man page together without administrator privileges:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --path .
|
make install PREFIX="$HOME/.local"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This uses `~/.local/bin` and `~/.local/share/man/man1`; configure `PATH` and your
|
||||||
|
manual-page search path as needed.
|
||||||
|
|
||||||
|
### Existing release downloads
|
||||||
|
|
||||||
|
The [v1.0.0 release](https://gitea.speelman.ca/gamertan/sized/releases/tag/v1.0.0)
|
||||||
|
contains source, one legacy executable named `sized`, a man page and shell
|
||||||
|
completions. The executable was inspected as macOS arm64 (Apple silicon); it is not a Linux download.
|
||||||
|
There are currently no attached architecture-labelled archives or `.deb`
|
||||||
|
packages, and no verified Homebrew tap. Build from source for the current
|
||||||
|
review changes. Platform-labelled archives will be advertised after a new
|
||||||
|
release is reviewed and published.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
- **[Manual](MANUAL.md)**: Detailed explanations of all flags and features.
|
- **[Manual](MANUAL.md)**: Detailed explanations of all flags and features.
|
||||||
- **[Man Page](sized.1)**: Standard unix man pages (installed via `make install`).
|
- **[Man Page](sized.1)**: Standard unix man pages (installed via `make install`).
|
||||||
@@ -177,19 +170,25 @@ Docker access inside the job. Fork contributions can run the local script;
|
|||||||
maintainers can bring reviewed changes onto a repository branch for CI.
|
maintainers can bring reviewed changes onto a repository branch for CI.
|
||||||
See SHIPMENT for runner-image setup. Documentation-only pushes skip builds.
|
See SHIPMENT for runner-image setup. Documentation-only pushes skip builds.
|
||||||
|
|
||||||
|
Run `./scripts/check-release.sh` to verify the actual archive, checksum and
|
||||||
|
extracted executable on the host. Linux CI also runs this packaging check.
|
||||||
|
|
||||||
See [source review and release process](SHIPMENT.md) and the [live queue](TODO.md).
|
See [source review and release process](SHIPMENT.md) and the [live queue](TODO.md).
|
||||||
|
|
||||||
|
## Sized, SizeQueen and the shared scanner
|
||||||
|
|
||||||
|
Sized began as terminal tooling. Its filesystem scanner was extracted into
|
||||||
|
`sized-core`, which SizeQueen now uses directly beneath its native Mac interface.
|
||||||
|
SizeQueen adds the treemap and desktop interactions; it does not run the CLI.
|
||||||
|
Sized currently retains its own scanner copy while shared-core adoption is
|
||||||
|
reviewed. A public checkout of Sized does not need access to the private core
|
||||||
|
repository. SizeQueen's matching source download includes its pinned core.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the **GNU General Public License v3.0 (GPL-3.0)**.
|
**GPL-3.0-only.** See [LICENSE](LICENSE) for the complete terms. All Sized features
|
||||||
|
are free; optional [support for Gamertan](https://gamertan.com/store/) does not
|
||||||
### Why GPL-3.0? (The "Insulin" Philosophy)
|
unlock features.
|
||||||
We believe that core diagnostic tools like `sized` should remain a public good. Inspired by the philosophy behind open-access medicine like insulin, this license ensures that:
|
|
||||||
- The tool remains **free and open** for everyone to use.
|
|
||||||
- Any improvements or forks made by others **must also be shared** with the community.
|
|
||||||
- It prevents proprietary "vampire" versions from taking private credit for public efforts.
|
|
||||||
|
|
||||||
For more details, see the [LICENSE](LICENSE) file.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
+42
-27
@@ -6,8 +6,9 @@ This document defines the process for versioning and distributing the `sized` pr
|
|||||||
|
|
||||||
Use a named branch from `main` and keep a pull request focused on one outcome.
|
Use a named branch from `main` and keep a pull request focused on one outcome.
|
||||||
The `sizequeen-scan-hardening` branch corrects accounting/error handling and
|
The `sizequeen-scan-hardening` branch corrects accounting/error handling and
|
||||||
adds the scan controls needed by SizeQueen; shared-crate extraction follows
|
adds the scan controls needed by SizeQueen; the scanner has also been
|
||||||
in a separate PR so reviewers can distinguish behaviour changes from packaging.
|
extracted into private `sized-core` for SizeQueen. Sized retains its own copy
|
||||||
|
until adoption preserves public source access.
|
||||||
|
|
||||||
1. Run local locked tests and strict Clippy as an unprivileged user. Run
|
1. Run local locked tests and strict Clippy as an unprivileged user. Run
|
||||||
`./scripts/check-linux.sh linux/arm64` and
|
`./scripts/check-linux.sh linux/arm64` and
|
||||||
@@ -20,8 +21,8 @@ in a separate PR so reviewers can distinguish behaviour changes from packaging.
|
|||||||
3. Review and merge independently of distribution. A branch push or PR merge
|
3. Review and merge independently of distribution. A branch push or PR merge
|
||||||
does not publish a package, change repository visibility or create a tag.
|
does not publish a package, change repository visibility or create a tag.
|
||||||
4. Choose the release version after reviewing library/API compatibility, then
|
4. Choose the release version after reviewing library/API compatibility, then
|
||||||
use the release steps below when explicitly authorized. Reconcile legacy
|
use the release steps below when explicitly authorized. Verify the exact archive
|
||||||
GitLab download/package links before announcing a Gitea release.
|
contents, target and installation instructions before announcing a release.
|
||||||
|
|
||||||
### Gitea Linux CI
|
### Gitea Linux CI
|
||||||
|
|
||||||
@@ -68,40 +69,54 @@ The project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html
|
|||||||
git tag -a v1.0.0 -m "Release v1.0.0"
|
git tag -a v1.0.0 -m "Release v1.0.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Asset Generation
|
## 2. Asset generation and verification
|
||||||
|
|
||||||
The `scripts/release.sh` script is the authoritative way to generate release assets locally or in any CI environment.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
./scripts/check-release.sh
|
||||||
./scripts/release.sh
|
./scripts/release.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
This script generates:
|
`release.sh` uses the locked dependencies and the Rust toolchain's host target.
|
||||||
- **Optimized Binary**: The production-ready `sized` executable.
|
It packages the executable **before** creating the archive, together with the
|
||||||
- **Documentation**: The `sized.1` man page.
|
man page, Bash/Zsh/Fish completions, licence, README, manual and build metadata.
|
||||||
- **Shell Completions**: Scripts for Bash, Zsh, and Fish.
|
Outputs are `dist/sized-v<VERSION>-<RUST-TARGET>-<REVISION>/`, a sibling `.tar.gz`
|
||||||
- **System Installers**: A `.deb` package for Debian-based Linux distributions.
|
and `.tar.gz.sha256`. Existing outputs are never replaced. Use
|
||||||
|
`--output-dir /absolute/new/path` for an explicitly named local candidate.
|
||||||
|
`CARGO_TARGET_DIR` is respected. The script does not sign, upload, tag or publish.
|
||||||
|
|
||||||
All assets are gathered in the `dist/v<VERSION>/` directory.
|
`check-release.sh` creates temporary outputs, extracts the archive, checks all
|
||||||
|
required files and the checksum, then runs the packaged executable against an
|
||||||
|
owned fixture. It also checks the refusal to overwrite. Gitea's Linux check
|
||||||
|
runs this same test; a successful compile alone is insufficient.
|
||||||
|
|
||||||
## 3. Distribution Channels
|
Only build from a clean, reviewed commit for distribution. `BUILD-INFO.txt`
|
||||||
|
records the commit, target, toolchain and whether tracked inputs were modified.
|
||||||
|
Exported source can provide `SIZED_SOURCE_REVISION`; verify that provenance
|
||||||
|
against the original checkout. Retain matching source and complete dependency
|
||||||
|
licences with any public binary distribution. A host build is unsigned; do not
|
||||||
|
advertise it as notarized or as a Mac App Store application.
|
||||||
|
|
||||||
### crates.io
|
## 3. Distribution channels
|
||||||
To update the project on the central Rust registry:
|
|
||||||
```bash
|
|
||||||
cargo publish
|
|
||||||
```
|
|
||||||
|
|
||||||
### System Package Managers
|
The existing public Gitea v1.0.0 release contains a macOS arm64 executable,
|
||||||
For Homebrew, GitLab, or Gitea-based distribution:
|
man page and completions, plus generated source archives. It predates the
|
||||||
1. Push the git tag to your SCM.
|
scanner hardening branch. No architecture-labelled binary archive, `.deb` or
|
||||||
2. Run the release script to generate assets.
|
verified Homebrew tap is currently offered.
|
||||||
3. Attach the contents of the `dist/` folder to your SCM's "Release" or "Tag" entry.
|
|
||||||
4. Update downstream formulas (like `homebrew-tap`) with the new source URL and SHA256 of the generated tarball.
|
|
||||||
|
|
||||||
## 4. Automation & Hooks
|
Future public releases need their own reviewed version, source, target-specific
|
||||||
|
archives, checksums and installation acceptance. Do not replace historical
|
||||||
|
v1.0.0 assets with newly built bytes. Add a new version only after review.
|
||||||
|
|
||||||
To automate asset generation locally, you can use a git `post-checkout` or a wrapper script. Since gitea and gitlab use different CI formats, it is recommended to simply call `./scripts/release.sh` within your preferred CI runner (e.g., `gitlab-ci.yml` or `gitea-actions`).
|
Debian/Alpine packaging is separate from the portable host archive. Do not
|
||||||
|
implicitly invoke `cargo deb` or `abuild` just because they are installed: a Mac
|
||||||
|
binary is not a Debian package. Validate each installer on its target OS before
|
||||||
|
publishing it. Registry and Homebrew publication are separate decisions too.
|
||||||
|
|
||||||
|
## 4. Automation
|
||||||
|
|
||||||
|
CI tests and packages temporary candidates without publishing credentials.
|
||||||
|
Do not run release generation automatically from Git hooks. Publication remains
|
||||||
|
an intentional operation after the checks above.
|
||||||
|
|
||||||
## 5. Manual Installation
|
## 5. Manual Installation
|
||||||
For system-wide installation from source, use the `Makefile`:
|
For system-wide installation from source, use the `Makefile`:
|
||||||
|
|||||||
@@ -23,23 +23,41 @@ Keep the existing CLI useful and preserve the GPL-3.0-only license.
|
|||||||
cliff-mads runner. Keep its container isolation and other jobs unchanged;
|
cliff-mads runner. Keep its container isolation and other jobs unchanged;
|
||||||
verify a real workflow result before treating CI as proven.
|
verify a real workflow result before treating CI as proven.
|
||||||
|
|
||||||
## Proposed next work
|
## Approved project page and release cleanup
|
||||||
|
|
||||||
SizeQueen now includes a byte-identical scanner snapshot in a small core crate,
|
The owner approved a Sized project page in the shared Gamertan CMS, truthful
|
||||||
removing terminal dependencies and allowing independent builds. Extract that
|
installation/release guidance, packaging repairs, and a Built on Sized section
|
||||||
shared core upstream in a separate PR after the behaviour changes are reviewed;
|
on SizeQueen. Website delivery is tracked in that repository's existing queue.
|
||||||
terminal formatting is already separate from scan logic.
|
|
||||||
Windows allocation support and very-large/deep-tree tuning need separate evidence.
|
- [x] Inspect the public v1.0.0 assets; the unlabelled executable is macOS arm64,
|
||||||
README/MANUAL/Cargo metadata still contain legacy GitLab addresses; reconcile
|
ad hoc signed, SHA-256 `50fde4d8215babbb64f4a4f55e030dd5c941a97ed1bedfa80392e4301c52d2bf`.
|
||||||
them against available Gitea releases before changing distribution instructions.
|
There are no attached Linux binaries, labelled archives or Debian packages.
|
||||||
Before producing release assets, fix and verify `scripts/release.sh`: it currently
|
- [x] Replace stale GitLab/unsupported package-manager installation claims with
|
||||||
creates the tarball before copying the executable into its input directory.
|
explicit review-branch source builds; explain the published release boundary.
|
||||||
Do not release/tag/publish automatically. The requested review-branch push is
|
- [x] Package the executable before the archive; include licence/docs/build
|
||||||
authorized; see `SHIPMENT.md` for source review and the separate release process.
|
provenance, target-labelled names and checksums. Reject output replacement.
|
||||||
|
Remove incidental installer generation; host binaries must not become `.deb`s.
|
||||||
|
- [x] Verify archive contents/checksum, run the extracted CLI and test overwrite
|
||||||
|
refusal on macOS arm64. Add the same verification to Linux CI.
|
||||||
|
- [ ] Verify the updated cliff-mads workflow, push the review checkpoint and
|
||||||
|
record the public CMS delivery. No new version, release assets or merge yet.
|
||||||
|
|
||||||
|
## Deferred / next release
|
||||||
|
|
||||||
|
SizeQueen now pins the extracted private `sized-core`; Sized retains its own
|
||||||
|
scanner copy. Adoption must keep public builds independently fetchable.
|
||||||
|
Review scanner/API/status changes before merging the existing branch. Select a
|
||||||
|
new release version, verify target-specific installation and package complete
|
||||||
|
corresponding source/dependency notices before publishing fresh binary assets.
|
||||||
|
Do not replace historical v1.0.0 files. Windows allocation and very-large/deep
|
||||||
|
scan tuning remain separate work. See `SHIPMENT.md` for the release process.
|
||||||
|
|
||||||
## Resume note
|
## Resume note
|
||||||
|
|
||||||
Current CI checkpoint: repository Actions is enabled and a real native AMD64
|
Current work: the approved project page and packaging cleanup above. Local Mac
|
||||||
|
archive verification passes; updated Linux CI and CMS publication are pending.
|
||||||
|
|
||||||
|
Previous CI checkpoint: repository Actions is enabled and a real native AMD64
|
||||||
push run passed on cliff-mads. [Gitea run 1048 (number 2)](https://gitea.speelman.ca/gamertan/sized/actions/runs/1048)
|
push run passed on cliff-mads. [Gitea run 1048 (number 2)](https://gitea.speelman.ca/gamertan/sized/actions/runs/1048)
|
||||||
tested `74b30bbf750417121f3b0c26017d2f011a2a8286` on
|
tested `74b30bbf750417121f3b0c26017d2f011a2a8286` on
|
||||||
`cliff-himesan-linux-amd64` (`gitea-runner v3.1.0`): all 23 tests, formatting,
|
`cliff-himesan-linux-amd64` (`gitea-runner v3.1.0`): all 23 tests, formatting,
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ check_root=$(mktemp -d /tmp/sized-check.XXXXXX)
|
|||||||
source_root=${SIZED_TEST_SOURCE:-/source}
|
source_root=${SIZED_TEST_SOURCE:-/source}
|
||||||
cp "$source_root/Cargo.toml" "$source_root/Cargo.lock" "$check_root/"
|
cp "$source_root/Cargo.toml" "$source_root/Cargo.lock" "$check_root/"
|
||||||
cp -R "$source_root/src" "$source_root/tests" "$source_root/benches" "$check_root/"
|
cp -R "$source_root/src" "$source_root/tests" "$source_root/benches" "$check_root/"
|
||||||
|
cp "$source_root/LICENSE" "$source_root/README.md" "$source_root/MANUAL.md" "$check_root/"
|
||||||
|
mkdir "$check_root/scripts"
|
||||||
|
cp "$source_root/scripts/release.sh" "$source_root/scripts/check-release.sh" "$check_root/scripts/"
|
||||||
|
export SIZED_SOURCE_REVISION="$(git -C "$source_root" rev-parse HEAD 2>/dev/null || printf unknown)"
|
||||||
cd "$check_root"
|
cd "$check_root"
|
||||||
cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
cargo test --locked
|
cargo test --locked
|
||||||
@@ -24,4 +28,5 @@ fixture_root=$(mktemp -d /tmp/sized-release.XXXXXX)
|
|||||||
printf 'Linux release smoke test\n' > "$fixture_root/payload"
|
printf 'Linux release smoke test\n' > "$fixture_root/payload"
|
||||||
./target/release/sized --version
|
./target/release/sized --version
|
||||||
./target/release/sized "$fixture_root" --threads 2 --one-file-system --apparent --format json
|
./target/release/sized "$fixture_root" --threads 2 --one-file-system --apparent --format json
|
||||||
|
./scripts/check-release.sh
|
||||||
printf 'Linux checks passed.\n'
|
printf 'Linux checks passed.\n'
|
||||||
|
|||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
repo_root=$(cd "$(dirname "$0")/.." && pwd)
|
||||||
|
check_root=$(mktemp -d "${TMPDIR:-/tmp}/sized-package.XXXXXX")
|
||||||
|
trap 'rm -rf "$check_root"' EXIT
|
||||||
|
"$repo_root/scripts/release.sh" --output-dir "$check_root/bundle"
|
||||||
|
mkdir "$check_root/extracted" "$check_root/fixture"
|
||||||
|
tar -xzf "$check_root/bundle.tar.gz" -C "$check_root/extracted"
|
||||||
|
for required in sized sized.1 sized.bash _sized sized.fish LICENSE README.md MANUAL.md BUILD-INFO.txt; do
|
||||||
|
test -s "$check_root/extracted/$required"
|
||||||
|
done
|
||||||
|
test -x "$check_root/extracted/sized"
|
||||||
|
(
|
||||||
|
cd "$check_root"
|
||||||
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
|
sha256sum -c bundle.tar.gz.sha256
|
||||||
|
else
|
||||||
|
shasum -a 256 -c bundle.tar.gz.sha256
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
printf 'owned package fixture\n' > "$check_root/fixture/payload"
|
||||||
|
"$check_root/extracted/sized" --version
|
||||||
|
"$check_root/extracted/sized" "$check_root/fixture" --apparent --format json > "$check_root/result.json"
|
||||||
|
grep -q 'payload' "$check_root/result.json"
|
||||||
|
grep -q '"complete":true' "$check_root/result.json"
|
||||||
|
if "$repo_root/scripts/release.sh" --output-dir "$check_root/bundle" > "$check_root/repeat.log" 2>&1; then
|
||||||
|
printf 'Packaging unexpectedly replaced an existing output.\n' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
grep -q 'Refusing to replace' "$check_root/repeat.log"
|
||||||
|
printf 'Archive contents, checksum, extracted CLI and overwrite guard passed.\n'
|
||||||
+50
-47
@@ -1,53 +1,56 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
VERSION=$(grep '^version =' Cargo.toml | cut -d '"' -f 2)
|
# Build a host-target archive only. No tags, uploads, installers or signing.
|
||||||
DIST_DIR="dist/v$VERSION"
|
repo_root=$(cd "$(dirname "$0")/.." && pwd)
|
||||||
|
cd "$repo_root"
|
||||||
|
version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml)
|
||||||
|
target=$(rustc -vV | sed -n 's/^host: //p')
|
||||||
|
revision=${SIZED_SOURCE_REVISION:-$(git rev-parse HEAD 2>/dev/null || printf unknown)}
|
||||||
|
destination="$repo_root/dist/sized-v$version-$target-${revision:0:12}"
|
||||||
|
if [[ $# == 2 && $1 == --output-dir ]]; then
|
||||||
|
destination=$2
|
||||||
|
elif [[ $# != 0 ]]; then
|
||||||
|
printf 'Usage: %s [--output-dir ABSOLUTE_PATH]\n' "$0" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
[[ $destination == /* ]] || { printf 'Output directory must be absolute.\n' >&2; exit 2; }
|
||||||
|
for output in "$destination" "$destination.tar.gz" "$destination.tar.gz.sha256"; do
|
||||||
|
[[ ! -e $output ]] || { printf 'Refusing to replace %s\n' "$output" >&2; exit 1; }
|
||||||
|
done
|
||||||
|
|
||||||
echo "Building release assets for sized v$VERSION..."
|
target_dir=${CARGO_TARGET_DIR:-"$repo_root/target"}
|
||||||
|
[[ $target_dir == /* ]] || target_dir="$repo_root/$target_dir"
|
||||||
# 1. Clean and Prepare
|
cargo build --locked --release --target "$target"
|
||||||
rm -rf "$DIST_DIR"
|
binary="$target_dir/$target/release/sized"
|
||||||
mkdir -p "$DIST_DIR"
|
mkdir -p "$destination"
|
||||||
|
install -m 755 "$binary" "$destination/sized"
|
||||||
# 2. Build Release Binary
|
"$binary" --generate-man-page "$destination"
|
||||||
cargo build --release
|
"$binary" --completions bash > "$destination/sized.bash"
|
||||||
|
"$binary" --completions zsh > "$destination/_sized"
|
||||||
# 3. Generate Man Page
|
"$binary" --completions fish > "$destination/sized.fish"
|
||||||
cargo run --release -- --generate-man-page "$DIST_DIR"
|
cp LICENSE README.md MANUAL.md "$destination/"
|
||||||
|
{
|
||||||
# 4. Generate Completions
|
printf 'Version: %s\nTarget: %s\nSource revision: %s\n' "$version" "$target" "$revision"
|
||||||
cargo run --release -- --completions bash > "$DIST_DIR/sized.bash"
|
printf 'Source worktree: '
|
||||||
cargo run --release -- --completions zsh > "$DIST_DIR/_sized"
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
cargo run --release -- --completions fish > "$DIST_DIR/sized.fish"
|
if git diff --quiet HEAD --; then printf 'clean tracked files\n'; else printf 'modified tracked files\n'; fi
|
||||||
|
|
||||||
# 5. Build Debian Package (if cargo-deb is installed)
|
|
||||||
if command -v cargo-deb &> /dev/null; then
|
|
||||||
echo "Building Debian package..."
|
|
||||||
# On macOS, we use --no-strip to avoid 'unrecognized option: --strip-unneeded'
|
|
||||||
# and --no-build because we already built the release binary.
|
|
||||||
cargo deb --no-build --no-strip
|
|
||||||
cp target/debian/*.deb "$DIST_DIR/"
|
|
||||||
echo "Note: .deb package contains the binary for $(uname -s)-$(uname -m)"
|
|
||||||
else
|
else
|
||||||
echo "Warning: cargo-deb not found. Skipping .deb packaging."
|
printf 'exported source; verify against supplied revision\n'
|
||||||
fi
|
fi
|
||||||
|
rustc --version
|
||||||
|
cargo --version
|
||||||
|
printf 'Unsigned host build; not a notarized Mac application.\n'
|
||||||
|
} > "$destination/BUILD-INFO.txt"
|
||||||
|
|
||||||
# 6. Build Alpine Package (Placeholder/Hook)
|
tar -czf "$destination.tar.gz" -C "$destination" .
|
||||||
# Note: For real .apk building, one usually uses a docker container or abuild.
|
(
|
||||||
# This serves as a reminder for Alpine users.
|
cd "$(dirname "$destination")"
|
||||||
if [ -f "APKBUILD" ] && command -v abuild &> /dev/null; then
|
archive="$(basename "$destination").tar.gz"
|
||||||
echo "Building Alpine package..."
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
abuild -r
|
sha256sum "$archive" > "$archive.sha256"
|
||||||
|
else
|
||||||
|
shasum -a 256 "$archive" > "$archive.sha256"
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
# 7. Create General Release Tarball
|
printf 'Archive: %s.tar.gz\nChecksum: %s.tar.gz.sha256\n' "$destination" "$destination"
|
||||||
echo "Creating release tarball..."
|
|
||||||
tar -czf "dist/sized-v$VERSION-$(uname -s)-$(uname -m).tar.gz" -C "$DIST_DIR" .
|
|
||||||
|
|
||||||
# 8. Copy Binary
|
|
||||||
cp target/release/sized "$DIST_DIR/"
|
|
||||||
|
|
||||||
echo "Success! Assets are ready in $DIST_DIR"
|
|
||||||
ls -F "$DIST_DIR"
|
|
||||||
echo "Tarball: dist/sized-v$VERSION-$(uname -s)-$(uname -m).tar.gz"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user