Skip to content

Commit

Permalink
explain the Debian package file release in document and contribution …
Browse files Browse the repository at this point in the history
…guide
  • Loading branch information
rhysd committed Apr 5, 2024
1 parent d0e7cb1 commit 87b29ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ git add testdata/snapshots
These snapshot tests were added because `clap`'s major changes caused some regressions. `clap`'s major version bump caused API
breaking changes frequently and it was hard to follow them without tests.

## How to generate `.deb` file

[cargo-deb][] needs to be installed. The `.deb` package metadata is described in `[package.metadata.deb]` section in
[Cargo.toml](./Cargo.toml).

The `.deb` file contains a manual file for `man` and a Bash completion file. You need to generate them in advance.

```sh
cargo build --release
# Create a manual file
target/release/hgrep --generate-man-page > target/release/hgrep.1
# Create a Bash completion file
target/release/hgrep --generate-completion-script bash > target/release/hgrep.bash
# Generate `.deb` file at `target/debian/`
cargo deb
# Try to install the package
sudo dpkg -i target/debian/hgrep_*.deb
```

These build steps should be done on Linux. I haven't tried cross compilation.

The release CI workflow automatically builds `.deb` file and uploads it to [the GitHub releases page][releases] so usually you
don't need to build it manually.

## Make a new release

Let's say we're releasing v1.2.3.
Expand Down Expand Up @@ -102,6 +126,7 @@ Syntax set and theme set are managed in [./assets](./assets) directory. See [the
[clippy]: https://github.com/rust-lang/rust-clippy
[rustfmt]: https://github.com/rust-lang/rustfmt
[repo]: https://github.com/rhysd/hgrep
[cargo-deb]: https://github.com/kornelski/cargo-deb
[release-ci]: ./.github/workflows/release.yml
[releases]: https://github.com/rhysd/hgrep/releases
[changelog-from-release]: https://github.com/rhysd/changelog-from-release
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ cd /usr/pkgsrc/textproc/hgrep
make install
```

### Via [APT][apt] package manager on Debian or Ubuntu

Visit [the releases page][releases] and download `.deb` package file. It can be installed via `dpkg` command:

```sh
sudo dpkg -i hgrep_v0.3.5_amd64.deb
```

The manual (for `man` command) and Bash completion is automatically installed. If you're using some other shell, setup the shell
completion by yourself. See ['Generate completion scripts' section](#gen-completion-scripts) for more details.

### Via [cargo][] package manager

```sh
Expand Down Expand Up @@ -354,6 +365,8 @@ $Env:HGREP_DEFAULT_OPTS = "--glob '!C:\Program Files'"

See `--help` for the full list of available options in your environment.


<a name="gen-completion-scripts"></a>
### Generate completion scripts

Shell completion script for `hgrep` command is available. `--generate-completion-script` option generates completion script and
Expand Down Expand Up @@ -493,6 +506,7 @@ hgrep is distributed under [the MIT license](./LICENSE.txt).
[nushell]: https://www.nushell.sh/
[homebrew]: https://brew.sh/
[macports]: https://www.macports.org/
[apt]: https://www.debian.org/doc/manuals/debian-faq/pkgtools.html
[new-issue]: https://github.com/rhysd/hgrep/issues/new
[syntect]: https://github.com/trishume/syntect
[bat-vs-syntect]: #bat-printer-vs-syntect-printer
Expand Down

0 comments on commit 87b29ea

Please sign in to comment.