Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/sys_info Update sys_info to 20170920



details:   https://anonhg.NetBSD.org/src/rev/9b4f566445c8
branches:  trunk
changeset: 826658:9b4f566445c8
user:      agc <agc%NetBSD.org@localhost>
date:      Thu Sep 21 01:15:45 2017 +0000

description:
Update sys_info to 20170920

+ add a -d <destdir> option, which allows the versions of programs
in a directory tree rooted at "<destdir>" to be reported on, rather
than the programs and libraries rooted under /. This is useful, for
example, for finding out the versions of utilities and libraries
after a build.sh run:

        % sys_info
        awk-20121220
        bind-9.10.5pl2
        bozohttpd-20170201
        bzip2-1.0.6
        calendar-20160601
        dhcpcd-7.0.0-rc1
        dtc-1.4.4
        ftpd-20110904
        g++-5.4.0
        gcc-5.4.0
        grep-2.5.1anb1
        gzip-20170803
        libc-12.208
        ...
        % sys_info -d /data/8/build/dest/x86_64
        awk-20121220
        bind-9.10.5pl1
        bozohttpd-20170201
        bzip2-1.0.6
        calendar-20160601
        dhcpcd-7.0.0-rc1
        ftpd-20110904
        g++-5.4.0
        gcc-5.4.0
        grep-2.5.1anb1
        gzip-20150113
        libc-12.207
        ...
        %

diffstat:

 usr.bin/sys_info/sys_info.1  |  16 +++++++++++++---
 usr.bin/sys_info/sys_info.sh |  24 ++++++++++++++----------
 2 files changed, 27 insertions(+), 13 deletions(-)

diffs (121 lines):

diff -r 08235195dcc5 -r 9b4f566445c8 usr.bin/sys_info/sys_info.1
--- a/usr.bin/sys_info/sys_info.1       Thu Sep 21 00:40:10 2017 +0000
+++ b/usr.bin/sys_info/sys_info.1       Thu Sep 21 01:15:45 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.6 2017/08/27 20:39:26 wiz Exp $
+.\" $NetBSD: sys_info.1,v 1.7 2017/09/21 01:15:45 agc Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks <agc%NetBSD.org@localhost>
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 23, 2017
+.Dd September 20, 2017
 .Dt SYS_INFO 1
 .Os
 .Sh NAME
@@ -31,9 +31,10 @@
 .Nd script to show system version information
 .Sh SYNOPSIS
 .Nm
-.Op Fl v
 .Op Fl L Ar lib-path
 .Op Fl P Ar path
+.Op Fl d Ar destination-dir
+.Op Fl v
 .Op Ar component No ...
 .Sh DESCRIPTION
 The
@@ -66,6 +67,15 @@
 is used.
 To use the current value of $PATH from the caller, use:
 .Dl -P \*q$PATH\*q
+.It Fl d
+This option provides a destination directory, used
+as the root directory of an alternative set of programs
+and libraries.
+This can be useful for finding versions of utilities
+and libraries rooted in the file system directory,
+such as the destination directory from a
+.Dv build.sh
+run.
 .It Fl v
 Show the commands used to obtain the version information
 for each component
diff -r 08235195dcc5 -r 9b4f566445c8 usr.bin/sys_info/sys_info.sh
--- a/usr.bin/sys_info/sys_info.sh      Thu Sep 21 00:40:10 2017 +0000
+++ b/usr.bin/sys_info/sys_info.sh      Thu Sep 21 01:15:45 2017 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.14 2017/09/09 14:12:09 jmcneill Exp $
+# $NetBSD: sys_info.sh,v 1.15 2017/09/21 01:15:45 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks <agc%NetBSD.org@localhost>
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170909
+SYS_INFO_VERSION=20170920
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -110,10 +110,10 @@
                run "named -v | awk '{ gsub(\"-\", \"\", \$2); gsub(\"P\", \"pl\", \$2); print tolower(\$1) \"-\" \$2 }'"
                $all || return 0 ;&
        bozohttpd|httpd)
-               v=$(run "/usr/libexec/httpd -G" 2>/dev/null)
+               v=$(run "${destdir}/usr/libexec/httpd -G" 2>/dev/null)
                case "${v}" in
                "")
-                       run  "strings -a /usr/libexec/httpd | awk -F/ '\$1 == \"bozohttpd\" && NF == 2 { print \$1 \"-\" \$2; exit }'"
+                       run  "strings -a ${destdir}/usr/libexec/httpd | awk -F/ '\$1 == \"bozohttpd\" && NF == 2 { print \$1 \"-\" \$2; exit }'"
                        ;;
                *)
                        printf '%s\n' "bozohttpd-${v##*/}"
@@ -207,8 +207,8 @@
                fi
                $all || return 0 ;&
        tzdata)
-               if [ -f /usr/share/zoneinfo/TZDATA_VERSION ]; then
-                       run "cat /usr/share/zoneinfo/TZDATA_VERSION"
+               if [ -f ${destdir}/usr/share/zoneinfo/TZDATA_VERSION ]; then
+                       run "cat ${destdir}/usr/share/zoneinfo/TZDATA_VERSION"
                else
                        run "printf '%s\n' tzdata-too-old-to-matter"
                fi
@@ -221,7 +221,7 @@
                fi
                $all || return 0 ;&
        [uU]ser[lL]and|release)
-               run "sed </etc/release -e 's/ /-/g' -e 's/^/userland-/' -e 1q"
+               run "sed <${destdir}/etc/release -e 's/ /-/g' -e 's/^/userland-/' -e 1q"
                $all || return 0 ;&
        xz)
                run "xz --version | awk '{ print \$1 \"-\" \$4; exit }'"
@@ -240,14 +240,18 @@
 }
 
 verbose=false
+destdir=""
 # check if we have our only option
-while getopts "L:P:v" a; do
+while getopts "L:P:d:v" a; do
        case "$a" in
-       v)      verbose=true;;
        L)      LIBRARY_PATH=${OPTARG};;
        P)      PATH=${OPTARG};;
+       d)      PATH=${OPTARG}/bin:${OPTARG}/sbin:${OPTARG}/usr/bin:${OPTARG}/usr/sbin
+               LIBRARY_PATH=${OPTARG}/usr/lib:${OPTARG}/usr.X11R7/lib
+               destdir=${OPTARG};;
+       v)      verbose=true;;
        \?)     printf >&2 '%s\n' \
-                   "Usage: $0 [-v] [-L lib-path] [-P path] [component ...]"
+                   "Usage: $0 [-P path] [-L libdirs] [-d destdir] [-v] [system...]"
                exit 2
        esac
 done



Home | Main Index | Thread Index | Old Index