diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-08-07 23:46:19 -0600 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-08-07 23:46:19 -0600 |
commit | 14a150b73b66288dfdd67a275d88a0367c122210 (patch) | |
tree | 0d5374c9dbbb519edfae3891a12424af220c0fb2 | |
parent | 45ed1620d3aaad1978782a437211fc51b383eec6 (diff) |
librefetch: add a `print` mode
-rwxr-xr-x | src/librefetch/librefetch | 16 | ||||
-rw-r--r-- | src/librefetch/librefetch.8.ronn | 10 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 168d30e..3a5aef2 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -28,7 +28,7 @@ trap cleanup EXIT cmd=${0##*/} usage() { print "Usage: %s [options] <source-url> [<output-file>]" "$cmd" - print "Usage: %s -[g|V|h]" "$cmd" + print "Usage: %s -[g|P|V|h]" "$cmd" print "Downloads or creates a liberated source tarball." echo print "The default mode is to create <output-file>, first by trying download" @@ -61,6 +61,7 @@ usage() { print " instead" print " Alternate modes:" print " -g, --geninteg Generage integrity checks for source files" + print " -P, --print Print the effective build script (SRCBUILD)" print " -V, --version Show version information" print " -h, --help Show this message" } @@ -118,6 +119,18 @@ main() { return 0 fi + # Mode: print ########################################################## + + if [[ $mode =~ print ]]; then + if [[ ${#extra_opts[@]} != 0 ]]; then + print "%s: found extra non-flag arguments: %s" "$cmd" "${extra_opts[*]}" >> /dev/stderr + usage >> /dev/stderr + return 1 + fi + cat "$srcbuild" + return 0 + fi + ######################################################################## local src dst @@ -189,6 +202,7 @@ parse_options() { -C) mode=create;; -D) mode=download;; -g|--geninteg) mode=checksums;; + -P|--print) mode=print;; -p) BUILDFILE="$(readlink -m -- "$opt")";; -V|--version) mode=version;; -h|--help) mode=help;; diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 5df2e09..44c24f5 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -18,13 +18,14 @@ package adds `librefetch` as a download agent for `libre://` to `makepkg.conf`. Because of this, it is almost never necessary to call `librefetch` manually. -There are 6 modes: +There are 7 modes: * `download-create`: The default mode. First try `download` mode, then `create` mode. * `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. * `version`: Print `librefetch` version information. * `help`: Print `librefetch` usage information. @@ -37,6 +38,7 @@ There are 6 modes: 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. * `-V` | `--version`: Use `version` mode: Show version information. * `-h` | `--help`: Use `help` mode: Show useage information. @@ -62,6 +64,12 @@ When this documentation speaks of a file being modified, it is a temporary copy of the file that is modified, your original file will remain intact. +## SRCBUILD GENERATION + +As explained in the `CREATE MODE` section, in `create` mode, this +program generates an `SRCBUILD` file. For debugging purposes, this +file can be printed instead of executed with `print` mode. + ### PRE-EXISTING SRCBUILD The use of `SRCBUILD` files pre-dates `librefetch`. By convention, |