From 44d13ce2560266eff535208ffc437b0243930ac3 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 28 Sep 2016 03:28:20 -0700 Subject: [PATCH 1/2] dev-cmd/man: display diff --stat, add --exit-code The --fail-if-changed option will cause `brew man` to return a failing status code if the man files have changed. --- Library/Homebrew/dev-cmd/man.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 871fbf46c9..d7f47d199d 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -1,5 +1,9 @@ -#: * `man`: +#: * `man` [`--fail-if-changed`]: #: Generate Homebrew's manpages. +#: +#: If `--fail-if-changed` is passed, the command will return a failing +#: status code if changes are detected in the manpage outputs. +#: This can be used for CI to be notified when the manpages are out of date. require "formula" require "erb" @@ -18,6 +22,12 @@ module Homebrew else regenerate_man_pages end + + if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/brew.1.html", "manpages" + puts "No changes to manpage output detected." + elsif ARGV.include?("--fail-if-changed") + Homebrew.failed = true + end end private From 779833a0c3c89076a683e82391894825693e25f6 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 28 Sep 2016 03:30:08 -0700 Subject: [PATCH 2/2] Update man pages --- docs/brew.1.html | 18 ++++++++++++++++-- manpages/brew.1 | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/brew.1.html b/docs/brew.1.html index 1aee073c14..c5cb7f6424 100644 --- a/docs/brew.1.html +++ b/docs/brew.1.html @@ -467,7 +467,8 @@ for instance, for implementing pre-commit hooks.

bump-formula-pr [--devel] [--dry-run] [--audit|--strict] --tag=tag --revision=revision formula

Creates a pull request to update the formula with a new url or a new tag.

If a url is specified, the sha-256 checksum of the new download must -also be specified.

+also be specified. A best effort to determine the sha-256 and formula +name will be made if either or both values are not supplied by the user.

If a tag is specified, the git commit revision corresponding to that tag must also be specified.

@@ -477,10 +478,19 @@ The development spec must already exist.

If --dry-run is passed, print what would be done rather than doing it.

+

If --write is passed along with --dry-run, perform a not-so-dry run +making the expected file modifications but not taking any git actions.

+

If --audit is passed, run brew audit before opening the PR.

If --strict is passed, run brew audit --strict before opening the PR.

+

If --mirror=url is passed, use the value as a mirror url.

+ +

If --version=version is passed, use the value to override the value +parsed from the url or tag. Note that --version=0 can be used to delete +an existing version override from a formula if it has become redundant.

+

Note that this command cannot be used to transition a formula from a url-and-sha256 style specification into a tag-and-revision style specification, nor vice versa. It must use whichever style specification @@ -515,7 +525,11 @@ non-zero exit code if any missing libraries were found.

If --reverse is passed, print the dylib followed by the binaries which link to it for each library the keg references.

-
man

Generate Homebrew's manpages.

+
man [--fail-if-changed]

Generate Homebrew's manpages.

+ +

If --fail-if-changed is passed, the command will return a failing +status code if changes are detected in the manpage outputs. +This can be used for CI to be notified when the manpages are out of date.

diff --git a/manpages/brew.1 b/manpages/brew.1 index 55f1500943..f32a6282b7 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -656,7 +656,7 @@ Generate a bottle (binary package) from a formula installed with \fB\-\-build\-b Creates a pull request to update the formula with a new url or a new tag\. . .IP -If a \fIurl\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. +If a \fIurl\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. A best effort to determine the \fIsha\-256\fR and \fIformula\fR name will be made if either or both values are not supplied by the user\. . .IP If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that tag must also be specified\. @@ -668,12 +668,21 @@ If \fB\-\-devel\fR is passed, bump the development rather than stable version\. If \fB\-\-dry\-run\fR is passed, print what would be done rather than doing it\. . .IP +If \fB\-\-write\fR is passed along with \fB\-\-dry\-run\fR, perform a not\-so\-dry run making the expected file modifications but not taking any git actions\. +. +.IP If \fB\-\-audit\fR is passed, run \fBbrew audit\fR before opening the PR\. . .IP If \fB\-\-strict\fR is passed, run \fBbrew audit \-\-strict\fR before opening the PR\. . .IP +If \fB\-\-mirror=\fR\fIurl\fR is passed, use the value as a mirror url\. +. +.IP +If \fB\-\-version=\fR\fIversion\fR is passed, use the value to override the value parsed from the url or tag\. Note that \fB\-\-version=0\fR can be used to delete an existing \fBversion\fR override from a formula if it has become redundant\. +. +.IP Note that this command cannot be used to transition a formula from a url\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. . .TP @@ -717,9 +726,12 @@ If \fB\-\-test\fR is passed, only display missing libraries and exit with a non\ If \fB\-\-reverse\fR is passed, print the dylib followed by the binaries which link to it for each library the keg references\. . .TP -\fBman\fR +\fBman\fR [\fB\-\-fail\-if\-changed\fR] Generate Homebrew\'s manpages\. . +.IP +If \fB\-\-fail\-if\-changed\fR is passed, the command will return a failing status code if changes are detected in the manpage outputs\. This can be used for CI to be notified when the manpages are out of date\. +. .P \fBpull\fR [\fB\-\-bottle\fR] [\fB\-\-bump\fR] [\fB\-\-clean\fR] [\fB\-\-ignore\-whitespace\fR] [\fB\-\-resolve\fR] [\fB\-\-branch\-okay\fR] [\fB\-\-no\-pbcopy\fR] [\fB\-\-no\-publish\fR] \fIpatch\-source\fR [\fIpatch\-source\fR] .