1 |
commit: e296d7ac9b45c75499dbfa89cfd4e2341303d2e2 |
2 |
Author: Mike Frysinger <vapier <AT> chromium <DOT> org> |
3 |
AuthorDate: Mon Oct 4 21:46:02 2021 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 4 21:46:02 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=e296d7ac |
7 |
|
8 |
build: add --debug for easy shell script tracing |
9 |
|
10 |
Improve the CLI parser slightly so we can add a --debug option. |
11 |
This makes it easy to get shell script tracing with a -x option |
12 |
rather than having to override the shebang/shell interpreter. |
13 |
|
14 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
15 |
|
16 |
autogen.sh | 26 ++++++++++++++++++++++++-- |
17 |
make-tarball.sh | 13 ++++++++++--- |
18 |
2 files changed, 34 insertions(+), 5 deletions(-) |
19 |
|
20 |
diff --git a/autogen.sh b/autogen.sh |
21 |
index 42e8a8c..a21b8e5 100755 |
22 |
--- a/autogen.sh |
23 |
+++ b/autogen.sh |
24 |
@@ -2,11 +2,33 @@ |
25 |
|
26 |
. "${0%/*}"/travis/lib.sh |
27 |
|
28 |
+# NB: This script is normally run in a GNU environment (e.g. Linux), but we also run it on other |
29 |
+# systems (e.g. macOS) as part of our automated CI. So a little care must be taken. |
30 |
+ |
31 |
+cd "${0%/*}" || exit 1 |
32 |
+ |
33 |
m4dir="autotools/m4" |
34 |
|
35 |
+: ${MAKE:=make} |
36 |
+ |
37 |
+FROM_TOOL= |
38 |
+while [[ $# -gt 0 ]] ;do |
39 |
+ case $1 in |
40 |
+ --from=*) FROM_TOOL=${1#*=};; |
41 |
+ -x|--debug) set -x;; |
42 |
+ *) break;; |
43 |
+ esac |
44 |
+ shift |
45 |
+done |
46 |
+ |
47 |
+if [[ $# -ne 0 ]] ; then |
48 |
+ echo "Usage: $0" >&2 |
49 |
+ exit 1 |
50 |
+fi |
51 |
+ |
52 |
v rm -rf autotools |
53 |
-if [[ $1 != "--from=make" ]] ; then |
54 |
- v ${MAKE:-make} autotools-update |
55 |
+if [[ ${FROM_TOOL} != "make" ]] ; then |
56 |
+ v ${MAKE} autotools-update |
57 |
fi |
58 |
|
59 |
# reload the gnulib code if possible |
60 |
|
61 |
diff --git a/make-tarball.sh b/make-tarball.sh |
62 |
index 04f778d..3cd3219 100755 |
63 |
--- a/make-tarball.sh |
64 |
+++ b/make-tarball.sh |
65 |
@@ -1,5 +1,8 @@ |
66 |
#!/bin/bash |
67 |
|
68 |
+# NB: This script is expected to be run in a GNU environment (e.g. Linux). |
69 |
+# So it is not written to be completely POSIX compliant. |
70 |
+ |
71 |
set -e |
72 |
|
73 |
if ! . /etc/init.d/functions.sh 2>/dev/null ; then |
74 |
@@ -13,10 +16,14 @@ v() { printf '\t%s\n' "$*"; "$@"; } |
75 |
: ${MAKE:=make} |
76 |
|
77 |
CHECK=false |
78 |
-if [[ $1 == "--check" ]] ; then |
79 |
- CHECK=true |
80 |
+while [[ $# -gt 0 ]] ;do |
81 |
+ case $1 in |
82 |
+ --check) CHECK=true;; |
83 |
+ -x|--debug) set -x;; |
84 |
+ *) break;; |
85 |
+ esac |
86 |
shift |
87 |
-fi |
88 |
+done |
89 |
|
90 |
if [[ $# -ne 1 ]] ; then |
91 |
die "Usage: $0 <ver>" |