summaryrefslogtreecommitdiff
path: root/hack
diff options
context:
space:
mode:
Diffstat (limited to 'hack')
-rwxr-xr-xhack/make-and-check-size30
-rwxr-xr-xhack/xref-helpmsgs-manpages24
2 files changed, 37 insertions, 17 deletions
diff --git a/hack/make-and-check-size b/hack/make-and-check-size
index a6a77e8ca..71b382b44 100755
--- a/hack/make-and-check-size
+++ b/hack/make-and-check-size
@@ -2,28 +2,30 @@
#
# make-and-check-size - wrapper around 'make' that also checks binary growth
#
-# This script is intended to be run via 'git rebase -x', in a Makefile rule
-# such as:
+# This script is intended to be run via 'git rebase -x', in a form such as:
#
-# build-all-new-commits:
-# CONTEXT_DIR=$(shell mktemp -d --tmpdir make-size-check.XXXXXXX); \
-# git rebase $(GIT_BASE_BRANCH)^ -x "hack/make-and-check-size $$CONTEXT_DIR"; \
-# $(RM) -rf $$CONTEXT_DIR
+# context_dir=$(mktemp -d --tmpdir make-size-check.XXXXXXX)
+# git rebase ${GIT_BASE_BRANCH}^ -x "hack/make-and-check-size $context_dir"
+# rm -rf $context_dir
#
-# ...which has long been a part of our usual CI, one that makes sure that
-# each commit (in a multi-commit PR) can be compiled individually. By
-# adding the '^' to GIT_BASE_BRANCH we establish a baseline and store
+# (Carefully note the '^' next to GIT_BASE_BRANCH!)
+#
+# A 'git rebase -x' has long been a part of our usual CI; it guarantees
+# that each commit (whether in a single- or multi-commit PR) can be
+# compiled individually.
+#
+# By adding the '^' to GIT_BASE_BRANCH we establish a baseline and store
# the binary sizes of each file (podman, podman-remote) prior to our PR.
#
-# CONTEXT_DIR is a temporary directory used to store the original sizes
+# context_dir is a temporary directory used to store the original sizes
# of each binary file under bin/
#
# *IMPORTANT NOTE*: this script will leave the git checkout in a funky state!
# (because we rebase onto a nonterminal commit). I believe this is OK, since
-# this makefile target is used only in CI and only in a scratch VM. Running
-# this in a development environment would yield unpredictable results anyway,
-# by rebasing onto origin/main by default and by leaving an aborted rebase
-# on failure.
+# this script is only invoked in CI from runner.sh and only in a scratch VM.
+# Running this in a development environment would yield unpredictable results
+# anyway, by rebasing onto origin/main by default and by leaving an aborted
+# rebase on failure.
#
ME=$(basename $0)
diff --git a/hack/xref-helpmsgs-manpages b/hack/xref-helpmsgs-manpages
index a447f4da1..33ba43e9b 100755
--- a/hack/xref-helpmsgs-manpages
+++ b/hack/xref-helpmsgs-manpages
@@ -287,6 +287,7 @@ sub podman_man {
my $section = '';
my @most_recent_flags;
my $previous_subcmd = '';
+ my $previous_flag = '';
while (my $line = <$fh>) {
chomp $line;
next unless $line; # skip empty lines
@@ -294,6 +295,12 @@ sub podman_man {
# .md files designate sections with leading double hash
if ($line =~ /^##\s*(GLOBAL\s+)?OPTIONS/) {
$section = 'flags';
+ $previous_flag = '';
+ }
+ elsif ($line =~ /^###\s+\w+\s+OPTIONS/) {
+ # poaman image trust has sections for set & show
+ $section = 'flags';
+ $previous_flag = '';
}
elsif ($line =~ /^\#\#\s+(SUB)?COMMANDS/) {
$section = 'commands';
@@ -320,7 +327,7 @@ sub podman_man {
# $1 will be changed by recursion _*BEFORE*_ left-hand assignment
my $subcmd = $1;
if ($previous_subcmd gt $subcmd) {
- warn "$ME: $subpath: '$previous_subcmd' and '$subcmd' are out of order\n";
+ warn "$ME: $subpath:$.: '$previous_subcmd' and '$subcmd' are out of order\n";
++$Errs;
}
$previous_subcmd = $subcmd;
@@ -342,9 +349,20 @@ sub podman_man {
# If option has long and short form, long must come first.
# This is a while-loop because there may be multiple long
# option names, e.g. --net/--network
+ my $is_first = 1;
while ($line =~ s/^\*\*(--[a-z0-9-]+)\*\*(=\*[a-zA-Z0-9-]+\*)?(,\s+)?//g) {
- $man{$1} = 1;
- push @most_recent_flags, $1;
+ my $flag = $1;
+ $man{$flag} = 1;
+ if ($flag lt $previous_flag && $is_first) {
+ warn "$ME: $subpath:$.: $flag should precede $previous_flag\n";
+ ++$Errs;
+ }
+ $previous_flag = $flag if $is_first;
+ push @most_recent_flags, $flag;
+
+ # Further iterations of /g are allowed to be out of order,
+ # e.g., it's OK for "--namespace, -ns" to precede --nohead
+ $is_first = 0;
}
# Short form
if ($line =~ s/^\*\*(-[a-zA-Z0-9])\*\*(=\*[a-zA-Z0-9-]+\*)?//g) {