summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-11 01:41:20 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-11 02:00:46 -0400
commitf3dd569efc04b1fb315d2233fda043e15bb7430b (patch)
treefc07b87d0c27f0bc1d2b33d5828a890260a83e7b
parent79e4605a163199344df44b8947a15bac9ece75d0 (diff)
librefetch: enhance debugging options (flags change)
-rwxr-xr-xsrc/librefetch/librefetch24
-rw-r--r--src/librefetch/librefetch.8.ronn8
2 files changed, 24 insertions, 8 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index d0bbf1b..c1c3494 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -70,7 +70,8 @@ usage() {
directory, it is used instead"
print " Alternate modes:"
flag "-g, --geninteg" "Generage integrity checks for source files"
- flag "-P, --print" "Print the effective build script (SRCBUILD)"
+ flag "-S, --srcbuild" "Print the effective build script (SRCBUILD)"
+ flag "-M, --makepkg" "Print the effective makepkg script"
flag "-h, --help" "Show this message"
}
@@ -90,6 +91,17 @@ main() {
########################################################################
+ makepkg="$(modified_makepkg "$(which makepkg)")"
+
+ # Mode: makepkg ########################################################
+
+ if [[ $mode =~ makepkg ]]; then
+ cat "$makepkg"
+ return 0
+ fi
+
+ ########################################################################
+
local BUILDFILEDIR="${BUILDFILE%/*}"
if [[ -f "${BUILDFILEDIR}/SRCBUILD" ]]; then
BUILDFILE="${BUILDFILEDIR}/SRCBUILD"
@@ -102,7 +114,6 @@ main() {
*/SRCBUILD) srcbuild="$(modified_srcbuild "$BUILDFILE")";;
*) srcbuild="$(modified_pkgbuild "$BUILDFILE")";;
esac
- makepkg="$(modified_makepkg "$(which makepkg)")"
# Mode: checksums ######################################################
@@ -115,9 +126,9 @@ main() {
return 0
fi
- # Mode: print ##########################################################
+ # Mode: srcbuild #######################################################
- if [[ $mode =~ print ]]; then
+ if [[ $mode =~ srcbuild ]]; then
cat "$srcbuild"
return 0
fi
@@ -212,7 +223,8 @@ parse_options() {
-C) mode=create;;
-D) mode=download;;
-g|--geninteg) mode=checksums;;
- -P|--print) mode=print;;
+ -S|--srcbuild) mode=srcbuild;;
+ -M|--makepkg) mode=makepkg;;
-p) BUILDFILE="$(readlink -m -- "$opt")";;
-h|--help) mode=help;;
--) shift; break;;
@@ -235,7 +247,7 @@ parse_options() {
case "$mode" in
help) # don't worry about it
:;;
- checksums|print) # don't take any extra arguments
+ checksums|srcbuild|makepkg) # don't take any extra arguments
if [[ ${#extra_opts[@]} != 0 ]]; then
print "%s: found extra non-flag arguments: %s" "$cmd" "${extra_opts[*]}" >&2
usage >&2
diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn
index 3b51fb4..4c9c1c4 100644
--- a/src/librefetch/librefetch.8.ronn
+++ b/src/librefetch/librefetch.8.ronn
@@ -31,7 +31,8 @@ There are 5 modes:
* `download`: Download the tarball from the configured mirror.
* `create`: Create the tarball from a `PKGBUILD`/`SRCBUILD`.
* `checksums`: Generate integrity checks for source files.
- * `print`: Print the effective build script.
+ * `srcbuild`: Print the effective build script.
+ * `makepkg`: Print the effective makepkg script.
* `help`: Print `librefetch` usage information.
The normal mode of operation is `download` mode. If `download` mode
@@ -46,7 +47,10 @@ fails, it may choose to try `create` mode.
directory, it is used instead.
* `-g` | `--geninteg`: Use `checksums` mode: Generate integrity
checks for source files.
- * `-P` | `--print`: Use `print` mode: print the effective build script.
+ * `-S` | `--srcbuild`: Use `srcbuild` mode: print the effective build
+ script.
+ * `-M` | `--makepkg`: Use `makepkg` mode: print the effective makepkg
+ script.
* `-h` | `--help`: Use `help` mode: Show useage information.
## DOWNLOAD MODE