summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-08-21 21:26:18 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-08-21 23:05:52 -0400
commit5c80e4adb69c618e458cfc70a8502a497604825c (patch)
treeb67b9781845888a61693cd4db7fb079e3954b340
parentfcd185303198f9a6c8026e0a632c84bacf36e779 (diff)
release: better support for binary Debian package
This commit beefs up the package metadata used by the 'cargo deb' tool to produce a binary dpkg. In particular, we now include ripgrep's man page. This commit includes a new script, 'ci/build_deb.sh', which will handle the build process for a dpkg, which has become a bit more nuanced than just running 'cargo deb'. We don't (yet) run this script in CI. Fixes #842
-rw-r--r--CHANGELOG.md2
-rw-r--r--Cargo.toml22
-rwxr-xr-xci/build_deb.sh31
3 files changed, 55 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3abbfba5..4052e668 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -58,6 +58,8 @@ Bug fixes:
Matching empty lines now works correctly in several corner cases.
* [BUG #764](https://github.com/BurntSushi/ripgrep/issues/764):
Color escape sequences now coalesce, which reduces output size.
+* [BUG #842](https://github.com/BurntSushi/ripgrep/issues/842):
+ Add man page to binary Debian package.
* [BUG #922](https://github.com/BurntSushi/ripgrep/issues/922):
ripgrep is now more robust with respect to memory maps failing.
* [BUG #937](https://github.com/BurntSushi/ripgrep/issues/937):
diff --git a/Cargo.toml b/Cargo.toml
index 208a07b5..48296bdc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -84,3 +84,25 @@ pcre2 = ["grep/pcre2"]
[profile.release]
debug = 1
+
+[package.metadata.deb]
+features = ["pcre2"]
+assets = [
+ ["target/release/rg", "usr/bin/", "755"],
+ ["COPYING", "usr/share/doc/ripgrep/", "644"],
+ ["LICENSE-MIT", "usr/share/doc/ripgrep/", "644"],
+ ["UNLICENSE", "usr/share/doc/ripgrep/", "644"],
+ ["CHANGELOG.md", "usr/share/doc/ripgrep/CHANGELOG", "644"],
+ ["README.md", "usr/share/doc/ripgrep/README", "644"],
+ ["FAQ.md", "usr/share/doc/ripgrep/FAQ", "644"],
+ # The man page is automatically generated by ripgrep's build process, so
+ # this file isn't actually commited. Instead, to create a dpkg, either
+ # create a deployment directory and copy the man page to it, or use the
+ # 'ci/build_deb.sh' script.
+ ["deployment/rg.1", "usr/share/man/man1/rg.1", "644"],
+]
+extended-description = """\
+ripgrep (rg) recursively searches your current directory for a regex pattern.
+By default, ripgrep will respect your .gitignore and automatically skip hidden
+files/directories and binary files.
+"""
diff --git a/ci/build_deb.sh b/ci/build_deb.sh
new file mode 100755
index 00000000..eb516191
--- /dev/null
+++ b/ci/build_deb.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -e
+
+# This script builds a binary dpkg for Debian based distros. It does not
+# currently run in CI, and is instead run manually and the resulting dpkg is
+# uploaded to GitHub via the web UI.
+#
+# Note that this requires 'cargo deb', which can be installed with
+# 'cargo install cargo-deb'.
+#
+# This should be run from the root of the ripgrep repo.
+
+if ! command -V cargo-deb > /dev/null 2>&1; then
+ echo "cargo-deb command missing" >&2
+ exit 1
+fi
+
+# 'cargo deb' does not seem to provide a way to specify an asset that is
+# created at build time, such as ripgrep's man page. To work around this,
+# we force a debug build, copy out the man page produced from that build, put
+# it into a predictable location and then build the deb, which knows where to
+# look.
+
+mkdir -p deployment
+cargo build
+manpage="$(find ./target/debug -name rg.1 -print0 | xargs -0 ls -t | head -n1)"
+cp "$manpage" deployment/
+# Since we're distributing the dpkg, we don't know whether the user will have
+# PCRE2 installed, so just do a static build.
+PCRE2_SYS_STATIC=1 cargo deb