mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
doc: remove CPU features from man pages
It doesn't really belong in the man page since it's an artifact of a build/runtime configuration. Moreover, it inhibits reproducible builds. Fixes #1441
This commit is contained in:
parent
daa8319398
commit
12e4180985
@ -57,6 +57,8 @@ Bug fixes:
|
|||||||
Fixes a bug where ripgrep would panic when searching a symlinked directory.
|
Fixes a bug where ripgrep would panic when searching a symlinked directory.
|
||||||
* [BUG #1439](https://github.com/BurntSushi/ripgrep/issues/1439):
|
* [BUG #1439](https://github.com/BurntSushi/ripgrep/issues/1439):
|
||||||
Improve documentation for ripgrep's automatic stdin detection.
|
Improve documentation for ripgrep's automatic stdin detection.
|
||||||
|
* [BUG #1441](https://github.com/BurntSushi/ripgrep/issues/1441):
|
||||||
|
Remove CPU features from man page.
|
||||||
* [BUG #1445](https://github.com/BurntSushi/ripgrep/issues/1445):
|
* [BUG #1445](https://github.com/BurntSushi/ripgrep/issues/1445):
|
||||||
ripgrep now respects ignore rules from .git/info/exclude in worktrees.
|
ripgrep now respects ignore rules from .git/info/exclude in worktrees.
|
||||||
* [BUG #1485](https://github.com/BurntSushi/ripgrep/issues/1485):
|
* [BUG #1485](https://github.com/BurntSushi/ripgrep/issues/1485):
|
||||||
|
2
build.rs
2
build.rs
@ -86,7 +86,7 @@ fn generate_man_page<P: AsRef<Path>>(outdir: P) -> io::Result<()> {
|
|||||||
|
|
||||||
let githash = git_revision_hash();
|
let githash = git_revision_hash();
|
||||||
let githash = githash.as_ref().map(|x| &**x);
|
let githash = githash.as_ref().map(|x| &**x);
|
||||||
tpl = tpl.replace("{VERSION}", &app::long_version(githash));
|
tpl = tpl.replace("{VERSION}", &app::long_version(githash, false));
|
||||||
|
|
||||||
File::create(&txt_path)?.write_all(tpl.as_bytes())?;
|
File::create(&txt_path)?.write_all(tpl.as_bytes())?;
|
||||||
let result = process::Command::new("a2x")
|
let result = process::Command::new("a2x")
|
||||||
|
@ -66,7 +66,7 @@ pub fn app() -> App<'static, 'static> {
|
|||||||
// 'static, but we need to build the version string dynamically. We can
|
// 'static, but we need to build the version string dynamically. We can
|
||||||
// fake the 'static lifetime with lazy_static.
|
// fake the 'static lifetime with lazy_static.
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref LONG_VERSION: String = long_version(None);
|
static ref LONG_VERSION: String = long_version(None, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut app = App::new("ripgrep")
|
let mut app = App::new("ripgrep")
|
||||||
@ -91,14 +91,19 @@ pub fn app() -> App<'static, 'static> {
|
|||||||
/// If a revision hash is given, then it is used. If one isn't given, then
|
/// If a revision hash is given, then it is used. If one isn't given, then
|
||||||
/// the RIPGREP_BUILD_GIT_HASH env var is inspected for it. If that isn't set,
|
/// the RIPGREP_BUILD_GIT_HASH env var is inspected for it. If that isn't set,
|
||||||
/// then a revision hash is not included in the version string returned.
|
/// then a revision hash is not included in the version string returned.
|
||||||
pub fn long_version(revision_hash: Option<&str>) -> String {
|
///
|
||||||
|
/// If `cpu` is true, then the version string will include the compiled and
|
||||||
|
/// runtime CPU features.
|
||||||
|
pub fn long_version(revision_hash: Option<&str>, cpu: bool) -> String {
|
||||||
// Do we have a git hash?
|
// Do we have a git hash?
|
||||||
// (Yes, if ripgrep was built on a machine with `git` installed.)
|
// (Yes, if ripgrep was built on a machine with `git` installed.)
|
||||||
let hash = match revision_hash.or(option_env!("RIPGREP_BUILD_GIT_HASH")) {
|
let hash = match revision_hash.or(option_env!("RIPGREP_BUILD_GIT_HASH")) {
|
||||||
None => String::new(),
|
None => String::new(),
|
||||||
Some(githash) => format!(" (rev {})", githash),
|
Some(githash) => format!(" (rev {})", githash),
|
||||||
};
|
};
|
||||||
// Put everything together.
|
if !cpu {
|
||||||
|
format!("{}{}", crate_version!(), hash,)
|
||||||
|
} else {
|
||||||
let runtime = runtime_cpu_features();
|
let runtime = runtime_cpu_features();
|
||||||
if runtime.is_empty() {
|
if runtime.is_empty() {
|
||||||
format!(
|
format!(
|
||||||
@ -117,6 +122,7 @@ pub fn long_version(revision_hash: Option<&str>) -> String {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the relevant CPU features enabled at compile time.
|
/// Returns the relevant CPU features enabled at compile time.
|
||||||
fn compile_cpu_features() -> Vec<&'static str> {
|
fn compile_cpu_features() -> Vec<&'static str> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user