pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/fetch Add a verbose flag to the fetch script to out...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a067c13ff0ff
branches:  trunk
changeset: 516329:a067c13ff0ff
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Jul 19 14:16:29 2006 +0000

description:
Add a verbose flag to the fetch script to output the actual fetch command.

diffstat:

 mk/fetch/fetch |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r fb38a2c075ba -r a067c13ff0ff mk/fetch/fetch
--- a/mk/fetch/fetch    Wed Jul 19 14:03:59 2006 +0000
+++ b/mk/fetch/fetch    Wed Jul 19 14:16:29 2006 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: fetch,v 1.2 2006/07/18 22:41:06 jlam Exp $
+# $NetBSD: fetch,v 1.3 2006/07/19 14:16:29 jlam Exp $
 #
 # Copyright (c) 2006 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -72,6 +72,9 @@
 #              and is later renamed to the final file name if the
 #              complete file has been sucessfully fetched.
 #
+#      -v      Show the actual command line used to fetch the file
+#              from each site.
+#
 # ENVIRONMENT
 #      PKGSRCDIR       This is a hint to help locate the default
 #                      checksum script.
@@ -125,12 +128,14 @@
 distinfo=
 fetchdir=.
 resume=
+verbose=
 while ${TEST} $# -gt 0; do
        case "$1" in
        -c)     checksum=yes; shift ;;
        -d)     fetchdir="$2"; shift 2 ;;
        -f)     distinfo="$2"; shift 2 ;;
        -r)     resume=yes; shift ;;
+       -v)     verbose=yes; shift ;;
        --)     shift; break ;;
        -*)     ${ECHO} 1>&2 "$self: unknown option -- ${1#-}"
                usage
@@ -254,10 +259,12 @@
 
        ( cd $fetchdir
          if ${TEST} -n "$resume"; then
-               ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} ${FETCH_OUTPUT_ARGS} $outputfile $site$file
+               fetch_cmd="${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} ${FETCH_OUTPUT_ARGS} $outputfile $site$file"
          else
-               ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $site$file ${FETCH_AFTER_ARGS}
-         fi )
+               fetch_cmd="${FETCH_CMD} ${FETCH_BEFORE_ARGS} $site$file ${FETCH_AFTER_ARGS}"
+         fi
+         ${TEST} -z "$verbose" || ${ECHO} "$fetch_cmd"
+         $fetch_cmd )
        if ${TEST} $? -ne 0; then
                ${ECHO} 1>&2 "$self: Unable to fetch expected file $file"
                continue



Home | Main Index | Thread Index | Old Index