diff options
| author | Richard Lowe <richlowe@richlowe.net> | 2018-01-25 19:38:47 +0000 |
|---|---|---|
| committer | Richard Lowe <richlowe@richlowe.net> | 2018-01-27 21:42:31 +0000 |
| commit | f627793a66375709ebd33b4f64774dfee1db48fb (patch) | |
| tree | 98c46463bb69a2bf8950300bc3b910061f6d5ca2 | |
| parent | 4ed1382ba00606e1de9b09a46440fff341db026f (diff) | |
| download | illumos-joyent-f627793a66375709ebd33b4f64774dfee1db48fb.tar.gz | |
8998 depcheck is useless and should be removed
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Approved by: Dan McDonald <danmcd@joyent.com>
| -rw-r--r-- | usr/src/pkg/manifests/developer-build-onbld.mf | 6 | ||||
| -rw-r--r-- | usr/src/tools/Makefile | 1 | ||||
| -rw-r--r-- | usr/src/tools/README.tools | 8 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/DependencyCheck.txt | 129 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/Makefile | 54 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/SampleLinks | 75 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/SamplePkgLinks | 34 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/examples.txt | 447 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/get_depend_info | 552 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/get_depend_info.1onbld | 200 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/make_pkg_db | 527 | ||||
| -rw-r--r-- | usr/src/tools/depcheck/make_pkg_db.1onbld | 196 |
12 files changed, 0 insertions, 2229 deletions
diff --git a/usr/src/pkg/manifests/developer-build-onbld.mf b/usr/src/pkg/manifests/developer-build-onbld.mf index e313809960..6c3b0eddb1 100644 --- a/usr/src/pkg/manifests/developer-build-onbld.mf +++ b/usr/src/pkg/manifests/developer-build-onbld.mf @@ -102,7 +102,6 @@ file path=opt/onbld/bin/find_elf mode=0555 file path=opt/onbld/bin/findcrypto mode=0555 file path=opt/onbld/bin/flg.flp mode=0555 file path=opt/onbld/bin/genoffsets mode=0555 -file path=opt/onbld/bin/get_depend_info mode=0555 file path=opt/onbld/bin/git-pbchk mode=0555 file path=opt/onbld/bin/hdrchk mode=0555 file path=opt/onbld/bin/hg-active mode=0555 @@ -110,7 +109,6 @@ file path=opt/onbld/bin/hgsetup mode=0555 file path=opt/onbld/bin/interface_check mode=0555 file path=opt/onbld/bin/interface_cmp mode=0555 file path=opt/onbld/bin/jstyle mode=0555 -file path=opt/onbld/bin/make_pkg_db mode=0555 file path=opt/onbld/bin/mapfilechk mode=0555 file path=opt/onbld/bin/nightly mode=0555 file path=opt/onbld/bin/onu mode=0555 @@ -129,8 +127,6 @@ file path=opt/onbld/bin/wsdiff mode=0555 file path=opt/onbld/bin/xref mode=0555 file path=opt/onbld/bin/xref.mk file path=opt/onbld/env/illumos -file path=opt/onbld/etc/SampleLinks -file path=opt/onbld/etc/SamplePkgLinks file path=opt/onbld/etc/exception_lists/check_rtime file path=opt/onbld/etc/exception_lists/interface_check file path=opt/onbld/etc/exception_lists/interface_cmp @@ -232,7 +228,6 @@ file path=opt/onbld/man/man1onbld/cw.1onbld file path=opt/onbld/man/man1onbld/find_elf.1onbld file path=opt/onbld/man/man1onbld/findunref.1onbld file path=opt/onbld/man/man1onbld/flg.flp.1onbld -file path=opt/onbld/man/man1onbld/get_depend_info.1onbld file path=opt/onbld/man/man1onbld/git-pbchk.1onbld file path=opt/onbld/man/man1onbld/hdrchk.1onbld file path=opt/onbld/man/man1onbld/hgsetup.1onbld @@ -240,7 +235,6 @@ file path=opt/onbld/man/man1onbld/interface_check.1onbld file path=opt/onbld/man/man1onbld/interface_cmp.1onbld file path=opt/onbld/man/man1onbld/jstyle.1onbld file path=opt/onbld/man/man1onbld/lintdump.1onbld -file path=opt/onbld/man/man1onbld/make_pkg_db.1onbld file path=opt/onbld/man/man1onbld/mapfilechk.1onbld file path=opt/onbld/man/man1onbld/ndrgen.1onbld file path=opt/onbld/man/man1onbld/nightly.1onbld diff --git a/usr/src/tools/Makefile b/usr/src/tools/Makefile index 1b726bd8bb..5bc163d15a 100644 --- a/usr/src/tools/Makefile +++ b/usr/src/tools/Makefile @@ -39,7 +39,6 @@ COMMON_SUBDIRS= \ codesign \ cscope-fast \ ctf \ - depcheck \ env \ findunref \ install.bin \ diff --git a/usr/src/tools/README.tools b/usr/src/tools/README.tools index b8244addd6..b910e73079 100644 --- a/usr/src/tools/README.tools +++ b/usr/src/tools/README.tools @@ -128,14 +128,6 @@ ctfdump ctfmerge Merge the CTF data from one or more object files. -depcheck - A tool to try an assess the dependencies of executables. This tool - is not a definitive dependency check, but it does use "strings" and - "ldd" to gather as much information as it can. The dependency check - tool can handle filenames and pkgnames. Before using the dependency - checker you must build a database which reflects the properties and - files in your system. - elfcmp Compares two ELF modules (e.g. .o files, executables) section by section. Useful for determining whether "trivial" changes - diff --git a/usr/src/tools/depcheck/DependencyCheck.txt b/usr/src/tools/depcheck/DependencyCheck.txt deleted file mode 100644 index 9db1543504..0000000000 --- a/usr/src/tools/depcheck/DependencyCheck.txt +++ /dev/null @@ -1,129 +0,0 @@ - -CDDL HEADER START - -The contents of this file are subject to the terms of the -Common Development and Distribution License, Version 1.0 only -(the "License"). You may not use this file except in compliance -with the License. - -You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -or http://www.opensolaris.org/os/licensing. -See the License for the specific language governing permissions -and limitations under the License. - -When distributing Covered Code, include this CDDL HEADER in each -file and include the License file at usr/src/OPENSOLARIS.LICENSE. -If applicable, add the following below this CDDL HEADER, with the -fields enclosed by brackets "[]" replaced with your own identifying -information: Portions Copyright [yyyy] [name of copyright owner] - -CDDL HEADER END - -Copyright 2000 Sun Microsystems, Inc. All rights reserved. -Use is subject to license terms. - -ident "%Z%%M% %I% %E% SMI" - -What does this tool do for you? - -This tool statically analyzes executable files and tries to figure out -dependencies on libraries and other executable files. It is important to -recognize that the output of this tool may not be the definitive dependency -list, but the output should give you pointers on possible dependencies. - -For more information on how this tool works, see "How does this tool work?" -below. - - - -This set of tools contains 7 files: - - 1. DependencyCheck.txt - the file you are currently reading - 2. make_pkg_db - generate database to reflect the software installed - 3. SampleLinks - sample link resolution file for - /var/sadm/install/contents(see notes on make_pkg_db) - 4. SamplePkgLinks - sample link resolution file for - a package pool (see notes on make_pkg_db) - 5. get_depend_info - analyze executables, requires database files - 6. make_pkg_db.txt - text formatted man page - 7. get_depend_info.txt - text formatted man page - - - - -How to use this tool: - - a. run make_pkg_db with the -dbdir argument - b. read the README notes on make_pkg_db and decide if you - want to resolve the symbolic links - c. run the get_depend_info tool and specify the directory with - the package database files - - - -How does this tool work? - -At a high level, this tool uses /usr/bin/ldd and /usr/bin/strings to figure -out what an executable file depends upon. Since this is a static analysis -there is no way to know if the dependencies identified will actually be -executed. - -The strings command will not be run on binaries if the user specifies the --cons option for get_depend_info. - -This tool cannot resolve variable substitions. For example if a shell script -set "$MYPATH" to "/usr/sbin" and then executes "$MYPATH/df", this tool will -not be able to resolve that the shell script will execute "/usr/sbin/df". - -The only way to conclusively know all the dependencies is to do a runtime -analysis. Furthermore, to get the complete set of dependencies, you would need -to run all permutations of the executable being analyzed. Clearly a definitive -dependency check would be a tremendous amount of work and outside the scope -of this tool. - -This tool divides executables into three broad groups - kernel modules, -binaries and shell scripts. - -For all three types of files, all the output is verified against the entries -in database generated by make_pkg_db. This technique allows the tool to verify -that a dependency was part of the Solaris installation and determine which -package a given dependency came from. - - - -A. Dependency Checks on Kernel Modules - -Kernel modules are identified by having a "/kernel/" somewhere in their -path. If an input is identified as a kernel module, then an ldd is run on -that module. If the ldd returns output, then the tool parses that output -to see if it can find the library in /kernel or in /usr/kernel. For example, -if the tool runs on /kernel/drv/mydrv, the ldd will return something like -"misc/mylib". The tool will look for "mylib"in /kernel/misc/mylib or -/usr/kernel/misc/mylib. - -If the ldd returns nothing, then a "strings" command is run on the kernel -module. Again, the output of the strings is compared against /kernel and -/usr/kernel to see if there is a match. This method was designed to catch -the "_depends_on" string embedded in some kernel modules. - -Note, if the ldd succeeds, then a strings will not run on the kernel module. - - -B. Binary files - -Binary files have both the ldd and strings command run on them. The output of -both programs is parsed and checked against the contents of the database -generated by make_pkg_db. - -If the user specifies the -cons option on get_depend_info, then the strings -analysis will not be done. This is a more conservative approach which only -uses ldd and therefore has realiable output. - - -C. Shell scripts - -Shell scripts are parsed to remove comments and break the script into tokens -of the file. All the tokens in the file are cross-checked against the database -generated by make_pkg_db to determine if a dependency exists. - - diff --git a/usr/src/tools/depcheck/Makefile b/usr/src/tools/depcheck/Makefile deleted file mode 100644 index 9413e3b6d5..0000000000 --- a/usr/src/tools/depcheck/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -SHFILES= \ - get_depend_info \ - make_pkg_db \ - -ETCFILES= \ - SampleLinks \ - SamplePkgLinks - -MAN1ONBLDFILES= \ - get_depend_info.1onbld \ - make_pkg_db.1onbld - -include ../Makefile.tools - -$(ROOTONBLDETCFILES) := FILEMODE= 644 -$(ROOTONBLDMAN1ONBLDFILES) := FILEMODE= 644 - -.KEEP_STATE: - -all: $(SHFILES) $(MAN1ONBLDFILES) - -install: all .WAIT $(ROOTONBLDSHFILES) $(ROOTONBLDETCFILES) \ - $(ROOTONBLDMAN1ONBLDFILES) - -clean: - $(RM) $(CLEANFILES) - -include ../Makefile.targ - diff --git a/usr/src/tools/depcheck/SampleLinks b/usr/src/tools/depcheck/SampleLinks deleted file mode 100644 index 04ad931204..0000000000 --- a/usr/src/tools/depcheck/SampleLinks +++ /dev/null @@ -1,75 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2000 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -# these are additions or replacements to the /var/sadm/install/contents file -# to make link resolution come out cleanly - -# -# these are provided by the install process and don't show up in contents -# -/dev/fd/0 c none 00 00 0000 dummy dummy SUNWcsd SUNWcsd -/dev/fd/1 c none 00 00 0000 dummy dummy SUNWcsd SUNWcsd -/dev/fd/2 c none 00 00 0000 dummy dummy SUNWcsd SUNWcsd - -# -# these are missing link targets -# -/usr/openwin/lib/openwin-menu-demo f none 0000 dummy dummy 00 00 00 SUNWoldte -/var/sadm/system/admin/INST_RELEASE f none 0000 dummy dummy 00 00 00 SUNWadmr - -# -# these replace incorrect link relative pathnames -# -/usr/lib/libami.so.1=./libami-global.so.1 s none SUNWami -/usr/bin/java=../java1.2/bin/java s none SUNWj2rt -/usr/bin/javac=../java1.2/bin/javac s none SUNWj2dev -/usr/bin/javadoc=../java1.2/bin/javadoc s none SUNWj2dev -/usr/bin/javah=../java1.2/bin/javah s none SUNWj2dev -/usr/bin/javald=../java1.2/bin/javald s none SUNWj2dev -/usr/bin/javap=../java1.2/bin/javap s none SUNWj2dev -/usr/bin/appletviewer=../java1.2/bin/appletviewer s none SUNWj2dev -/usr/bin/extcheck=../java1.2/bin/extcheck s none SUNWj2dev -/usr/bin/jar=../java1.2/bin/jar s none SUNWj2dev -/usr/bin/jarsigner=../java1.2/bin/jarsigner s none SUNWj2dev -/usr/bin/jdb=../java1.2/bin/jdb s none SUNWj2dev -/usr/bin/native2ascii=../java1.2/bin/native2ascii s none SUNWj2dev -/usr/bin/oldjava=../java1.2/bin/oldjava s none SUNWj2dev -/usr/bin/rmic=../java1.2/bin/rmic s none SUNWj2dev -/usr/bin/serialver=../java1.2/bin/serialver s none SUNWj2dev -/usr/bin/keytool=../java1.2/bin/keytool s none SUNWj2rt -/usr/bin/policytool=../java1.2/bin/policytool s none SUNWj2rt -/usr/bin/rmid=../java1.2/bin/rmid s none SUNWj2rt -/usr/bin/rmiregistry=../java1.2/bin/rmiregistry s none SUNWj2rt -/usr/bin/tnameserv=../java1.2/bin/tnameserv s none SUNWj2rt -/usr/include/Mrm=../dt/share/include/Mrm s none SUNWxwhl -/usr/include/X11=../openwin/share/include/X11 s none SUNWxwhl -/usr/include/Xm=../dt/share/include/Xm s none SUNWxwhl -/usr/include/kcms=../openwin/share/include/kcms s none SUNWxwhl -/usr/include/xil=../openwin/share/include/xil s none SUNWxwhl -/usr/include/uil=../dt/share/include/uil s none SUNWxwhl - -# this line isn't 100% correct, but it'll do! -/etc/openwin/etc/devdata/SUNWaccel/monitors/pnp/edidgen.vda f none 0664 root root 6678 46353 938736229 SUNWxwpls diff --git a/usr/src/tools/depcheck/SamplePkgLinks b/usr/src/tools/depcheck/SamplePkgLinks deleted file mode 100644 index b318608c23..0000000000 --- a/usr/src/tools/depcheck/SamplePkgLinks +++ /dev/null @@ -1,34 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2000 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -1 s none usr/openwin/lib/openwin-menu-demo=openwin-menu-demo-fulldemo -1 s none usr/lib/libami.so.1=libami-global.so.1 -1 s none usr/include/Mrm=../dt/share/include/Mrm -1 s none usr/include/X11=../openwin/share/include/X11 -1 s none usr/include/Xm=../dt/share/include/Xm -1 s none usr/include/kcms=../openwin/share/include/kcms -1 s none usr/include/xil=../openwin/share/include/xil -1 s none usr/include/uil=../dt/share/include/uil diff --git a/usr/src/tools/depcheck/examples.txt b/usr/src/tools/depcheck/examples.txt deleted file mode 100644 index 9cc6971034..0000000000 --- a/usr/src/tools/depcheck/examples.txt +++ /dev/null @@ -1,447 +0,0 @@ - -CDDL HEADER START - -The contents of this file are subject to the terms of the -Common Development and Distribution License (the "License"). -You may not use this file except in compliance with the License. - -You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -or http://www.opensolaris.org/os/licensing. -See the License for the specific language governing permissions -and limitations under the License. - -When distributing Covered Code, include this CDDL HEADER in each -file and include the License file at usr/src/OPENSOLARIS.LICENSE. -If applicable, add the following below this CDDL HEADER, with the -fields enclosed by brackets "[]" replaced with your own identifying -information: Portions Copyright [yyyy] [name of copyright owner] - -CDDL HEADER END - -Copyright 2009 Sun Microsystems, Inc. All rights reserved. -Use is subject to license terms. - -The first step in doing any kind of dependency checking - setting up the -database. - -In this example, I use my SampleLinks file to help resolve some defficiencies -in the pkg database. The "OVERRIDDEN" line refer to information that was -provided by the SampleLinks file. The "CANNOT FIND" file refers to files -which are links but cannot be resolved to an executable. The "README" file -has a more in-depth explanation. -====================================================================== - - -euphoria>./make_pkg_db -dbdir DBM -ifiles SampleLinks -...initializing the databases -Creating directory DBM -...making the FTYPE MODE and PKGS databases -...opening SampleLinks -...opening /var/sadm/install/contents -...OVERRIDDEN: /usr/bin/appletviewer=../java/bin/appletviewer s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/extcheck=../java/bin/extcheck s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/jar=../java/bin/jar s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/jarsigner=../java/bin/jarsigner s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/java=../java/bin/java s none SUNWj2rt.2 -...OVERRIDDEN: /usr/bin/javac=../java/bin/javac s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/javadoc=../java/bin/javadoc s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/javah=../java/bin/javah s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/javald=../java/bin/javald s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/javap=../java/bin/javap s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/jdb=../java/bin/jdb s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/keytool=../java/bin/keytool s none SUNWj2rt.2 -...OVERRIDDEN: /usr/bin/native2ascii=../java/bin/native2ascii s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/oldjava=../java/bin/oldjava s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/policytool=../java/bin/policytool s none SUNWj2rt.2 -...OVERRIDDEN: /usr/bin/rmic=../java/bin/rmic s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/rmid=../java/bin/rmid s none SUNWj2rt.2 -...OVERRIDDEN: /usr/bin/rmiregistry=../java/bin/rmiregistry s none SUNWj2rt.2 -...OVERRIDDEN: /usr/bin/serialver=../java/bin/serialver s none SUNWj2dev.2 -...OVERRIDDEN: /usr/bin/tnameserv=../java/bin/tnameserv s none SUNWj2rt.2 -...OVERRIDDEN: /usr/include/Mrm=../dt/include/Mrm s none SUNWxwhl -...OVERRIDDEN: /usr/include/X11=../openwin/include/X11 s none SUNWxwhl -...OVERRIDDEN: /usr/include/Xm=../dt/include/Xm s none SUNWxwhl -...OVERRIDDEN: /usr/include/kcms=../openwin/include/kcms s none SUNWxwhl -...OVERRIDDEN: /usr/include/uil=../dt/include/uil s none SUNWxwhl -...OVERRIDDEN: /usr/include/xil=../openwin/include/xil s none SUNWxwhl -...making the ABSLINK database -***CANNOT FIND ABSOLUTE PATH /usr/dt/config/C/bookmarks FOR ENTRY: /usr/dt/config/C/wsmenu/Links/Personal_Bookmarks=../../bookmarks -***CANNOT FIND ABSOLUTE PATH /usr/dt/config/en_US.UTF-8/bookmarks FOR ENTRY: /usr/dt/config/en_US.UTF-8/wsmenu/Links/Personal_Bookmarks=../../bookmarks -***CANNOT FIND ABSOLUTE PATH /usr/lib/locale/fr/LC_MESSAGES FOR ENTRY: /usr/lib/locale/fr_CA.ISO8859-1/LC_MESSAGES=../fr/LC_MESSAGES -...DONE - -The default dependency check on /usr/bin/sh. This analysis uses -"/usr/bin/stings" and "/usr/bin/ldd" to glean information about -file being analysed. - -The default format of a dependency is "filename:pkgname". -======================================================================= - -euphoria>./get_depend_info -dbdir DBM /usr/bin/sh - - -Analyzing /usr/bin/sh: -/usr/lib/libgen.so.1:SUNWcsl -/usr/lib/libsecdb.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libcmd.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/bin:SUNWcsr -/dev/null:SUNWcsd -/etc/profile:SUNWcsr -/usr/5bin:SUNWscpu -/usr/bin/pfexec:SUNWcsu - -A conservative analysis of the executable which only yields guaranteed -dependencies.. This analysis does not use "/usr/bin/strings" and only -uses "/usr/bin/ldd". -=================================================================== - -euphoria>get_depend_info -dbdir DBM -cons /usr/bin/sh - - -Analyzing /usr/bin/sh: -/usr/lib/libgen.so.1:SUNWcsl -/usr/lib/libsecdb.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libcmd.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - -A pkg level anaysis on the executable. In this format, only pkg dependencies -are listed and file dependencies are dropped from the output. - -====================================================================== -euphoria>get_depend_info -dbdir DBM -p /usr/bin/ls - - -Analyzing /usr/bin/ls: -P SUNWcsl Core Solaris, (Shared Libs) -The default dependency check on /usr/bin/sh. This analysis uses -"/usr/bin/stings" and "/usr/bin/ldd" to glean information about -file being analysed. - -The default format of a dependency is "filename:pkgname". -======================================================================= - -euphoria>./get_depend_info -dbdir DBM /usr/bin/sh - - -Analyzing /usr/bin/sh: -/usr/lib/libgen.so.1:SUNWcsl -/usr/lib/libsecdb.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libcmd.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/bin:SUNWcsr -/dev/null:SUNWcsd -/etc/profile:SUNWcsr -/usr/5bin:SUNWscpu -/usr/bin/pfexec:SUNWcsu - -This is a dependency check on a pkg. All the files within the pkg are analysed -and a report is generated. Note at the end of the listing is a summarized -listing of pkg dependencies. - -============================================================================= -euphoria>get_depend_info -dbdir DBM -pkg SUNWnisu - - -Analyzing /usr: -Input file is a directory - - -Analyzing /usr/bin: -Input file is a directory - - -Analyzing /usr/bin/aliasadm: -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/usr/bin/vi:SUNWcsu - - -Analyzing /usr/bin/chkey: -/usr/lib/librpcsvc.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libdoor.so.1:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libresolv.so.2:SUNWcsl -/etc/nsswitch.conf:SUNWcsr -/etc/publickey:SUNWnisr -/usr/ccs/bin/make:SUNWsprot - - -Analyzing /usr/bin/getent: -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/bin/ldaplist: -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libresolv.so.2:SUNWcsl -/usr/lib/libdoor.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/bin/newaliases: -/usr/lib/libresolv.so.2:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/usr/lib/libdoor.so.1:SUNWcsl -/dev/ksyms:SUNWcsd -/dev/null:SUNWcsd -/etc/hosts:SUNWcsr -/etc/mail/sendmail.cf:SUNWsndmr -/etc/mnttab:SUNWcsr -/usr/tmp:SUNWcsu - - -Analyzing /usr/bin/ypcat: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/var/yp/nicknames:SUNWnisr - - -Analyzing /usr/bin/ypmatch: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/var/yp/nicknames:SUNWnisr - - -Analyzing /usr/bin/ypwhich: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/var/yp/nicknames:SUNWnisr - - -Analyzing /usr/lib: -Input file is a directory - - -Analyzing /usr/lib/ldap: -Input file is a directory - - -Analyzing /usr/lib/ldap/ldap_cachemgr: -/usr/lib/libdoor.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libthread.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libresolv.so.2:SUNWcsl -/dev/null:SUNWcsd - - -Analyzing /usr/lib/libnisdb.so: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/lib/libnisdb.so.2: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/lib/netsvc: -Input file is a directory - - -Analyzing /usr/lib/netsvc/nis: -Input file is a directory - - -Analyzing /usr/lib/netsvc/yp: -Input file is a directory - - -Analyzing /usr/lib/netsvc/yp/ypbind: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/dev/null:SUNWcsd -/etc/hosts:SUNWcsr -/etc/inet/ipnodes:SUNWcsr - - -Analyzing /usr/lib/netsvc/yp/ypstart: -/dev/null:SUNWcsd -/usr/bin/ps:SUNWcsu -/usr/sbin/fnsypd:SUNWfns -/usr/sbin/makedbm:SUNWcsu -/var/yp/Makefile:SUNWypr -/var/yp/updaters:SUNWypr - - -Analyzing /usr/lib/netsvc/yp/ypstop: -/usr/bin/ps:SUNWcsu - - -Analyzing /usr/lib/netsvc/yp/ypxfr: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/dev/null:SUNWcsd - - -Analyzing /usr/sbin: -Input file is a directory - - -Analyzing /usr/sbin/gettable: -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/sbin/htable: -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/sbin/ldap_gen_profile: -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libresolv.so.2:SUNWcsl -/usr/lib/libdoor.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/etc/nsswitch.conf:SUNWcsr -/etc/nsswitch.ldap:SUNWcsr - - -Analyzing /usr/sbin/ldapclient: -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libresolv.so.2:SUNWcsl -/usr/lib/libdoor.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/etc/nsswitch.conf:SUNWcsr -/etc/nsswitch.ldap:SUNWcsr - - -Analyzing /usr/sbin/newkey: -/usr/lib/librpcsvc.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/usr/lib/libsldap.so.1:SUNWcsl -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libldap.so.4:SUNWcsl -/usr/lib/libdoor.so.1:SUNWcsl -/usr/lib/libresolv.so.2:SUNWcsl -/etc/nsswitch.conf:SUNWcsr -/etc/publickey:SUNWnisr -/usr/ccs/bin/make:SUNWsprot - - -Analyzing /usr/sbin/rpc.rexd: -/usr/lib/libsocket.so.1:SUNWcsl -/usr/lib/librpcsvc.so.1:SUNWcsl -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libbsm.so.1:SUNWcsl -/usr/lib/libpam.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl -/dev/console:SUNWcsd -/etc/mnttab:SUNWcsr -/var/adm/wtmpx:SUNWcsr - - -Analyzing /usr/sbin/ypalias: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/sbin/ypinit: -/dev/null:SUNWcsd -/etc/hosts:SUNWcsr -/etc/inet/ipnodes:SUNWcsr -/usr/lib/netsvc/yp/ypxfr:SUNWnisu - - -Analyzing /usr/sbin/yppoll: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Analyzing /usr/sbin/ypset: -/usr/lib/libnsl.so.1:SUNWcsl -/usr/lib/libdl.so.1:SUNWcsl -/usr/lib/libc.so.1:SUNWcsl -/usr/lib/libmp.so.2:SUNWcsl - - -Package dependencies for SUNWnisu: -P SUNWcsd Core Solaris Devices -P SUNWcsl Core Solaris, (Shared Libs) -P SUNWcsr Core Solaris, (Root) -P SUNWcsu Core Solaris, (Usr) -P SUNWfns Federated Naming System -P SUNWlibC Sun Workshop Compilers Bundled libC -P SUNWlibms Sun WorkShop Bundled shared libm -P SUNWnisr Network Information System, (Root) -P SUNWnisu Network Information System, (Usr) -P SUNWsndmr Sendmail root -P SUNWsprot Solaris Bundled tools -P SUNWypr NIS Server for Solaris (root) diff --git a/usr/src/tools/depcheck/get_depend_info b/usr/src/tools/depcheck/get_depend_info deleted file mode 100644 index 74a52c1ef4..0000000000 --- a/usr/src/tools/depcheck/get_depend_info +++ /dev/null @@ -1,552 +0,0 @@ -#!/usr/bin/perl -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright (c) 2000 by Sun Microsystems, Inc. -# All rights reserved. -# - -# ident "%Z%%M% %I% %E% SMI" - -# -# check for perl5 -- we use things unavailable in perl4 -# - -die "Sorry, this program requires perl version 5.000 or up. You have $]. Stopping" if $] < 5.000; - -$DBM_DIR_CHARACTERIZATION = "directory for the dbm databases"; - -$Usage = -"Usage: get_depend_info - -dbdir <$DBM_DIR_CHARACTERIZATION> [ -s ] [ -cons ] [ -root directory ] - [ -f ] [ -p ] [ -pkg SUNWxxx ] [ filename ] - [-h for help]\n"; - -$Help = -"This program statically analyzes executable files and their -symbolic links using /usr/bin/ldd and /usr/bin/strings. It -can accept filename(s) or packages as the list of files to be -analyzed. By default, the program will report the file -dependencies and which packages those dependencies came from. -There is one required argument: - - -dbdir <dir> the $DBM_DIR_CHARACTERIZATION - -The optional argument -h produces this message instead of any processing. -The optional argument -cons tells the tool to be conservative and not to -run /usr/bin/strings. -The optional argument -root allows you to specify a new root (useful for -doing analysis on build trees). -The optional argument -pkg allows you to specify a package name. -The optional argument -f only outputs the filename of the dependencies -The optional argument -p only outputs the packanames of the dependencies - -The optional argument -s ONLY outputs symbolic links for files or packages. -No ldd or strings analysis is done. - -Some Examples: -get_depend_info -dbdir ./DBM /usr/bin/ls -get_depend_info -dbdir ./DBM /usr/bin/* -get_depend_info -dbdir ./DBM -pkg SUNWnisu -get_depend_info -f -dbdir ./DBM -pkg SUNWnisu -get_depend_info -s -dbdir ./DBM /usr/bin/* -get_depend_info -s -dbdir ./DBM -pkg SUNWnisu - - -NOTE: Run make_pkg_db to create the database directory for get_depend_info -"; - -# -# process arguments -# - -@PkgList = ""; -$PackageOnly = false; -$FileOnly = false; -$Verbose = true; -$Silent = false; -$SymLink = false; -$NoStrings = false; -$Root = ""; - -while (@ARGV) { - $arg = shift (@ARGV); - if ($arg eq "-h") { - print "$Help\n$Usage"; - exit 0; - } elsif ($arg eq "-dbdir") { - $DBDir = shift(@ARGV) unless ($ARGV[0] =~ /^-/); - } elsif ($arg eq "-s") { - $SymLink = true; - $Silent = true; - } elsif ($arg eq "-p") { - $PackageOnly = true; - $Verbose = false; - } elsif ($arg eq "-f") { - $FileOnly = true; - $Verbose = false; - } elsif ($arg eq "-cons") { - $NoStrings = true; - } elsif ($arg eq "-pkg") { - $PKGName = shift(@ARGV) unless ($ARGV[0] =~ /^-/); - } elsif ($arg eq "-root") { - $Root = shift(@ARGV) unless ($ARGV[0] =~ /^-/); - }else { - push(@filelist, $arg); - } -} - -if (!$DBDir) { - print STDERR "Required argument -dbdir missing. \n$Usage"; - exit 1; -} - -if ($PKGName) { - # For a given pkg definition directory, this subroutine will - # go through the proto files and look for executable files. - # It will then put all the executable files into @filelist - &HandlePackageName($PKGName); - - if ($PackageOnly eq true) { - $Silent = true; - } -} - -&OpenDBs; - -$Silent = true if (($Verbose eq false) && ($PackageOnly eq false) - && ($FileOnly eq false)); - -foreach $entry (@filelist) { - - print("\n\nAnalyzing $Root$entry:\n") unless ($Silent eq true); - - # make sure file exists - if (!(-r $entry)) { - print STDERR "Could not open file $entry\n"; - next; - } - - - $file = $FTYPE{$entry}; - $pkgs = $PKGS{$entry}; - $abslink = $ABSLINK{$entry}; - - if ($file eq "d") { - print("Input file is a directory\n") unless ($Silent eq true); - next; - } - - # destfile represents the actual file we are interested in! - if ($abslink =~ /\w/) { - $destfile = $abslink; - - if (($FTYPE{$entry} eq "s") && ($SymLink eq true)) { - print("$entry is linked to $destfile:$PKGS{$destfile}\n"); - } - } - else { - $destfile = $entry; - } - - # if the -s flag is set, tell 'em about sym links and go to the next file - next if ($SymLink eq true); - - $mode = $MODE{$destfile}; - - # Handle the case where the user resets $ROOT - $destfile = "$Root$destfile" if ($Root =~ /\w/); - $filecmd = `/usr/bin/file $destfile 2>&1`; - - # make sure we are dealing with an executable - if (($mode !~ /(.)(.*)7/) && ($mode !~ /(.)(.*)5/) && ($mode !~ /(.)(.*)3/) && ($mode !~ /(.)(.*)1/)){ - print("Input file is not an executable\n"); - next; - } - - # Kernel modules are handled separately - if ($destfile =~ /\/kernel\//) { - &HandleKernelMod($destfile, $FTYPE{$entry}); - &OutputPackageList if (($PackageOnly eq true) && !($PKGName)); - next; - } - - # take care of scripts - if (($filecmd =~ /script/) || ($filecmd =~ /text/)) { - &HandleScripts($destfile); - &OutputPackageList if (($PackageOnly eq true) && !($PKGName)); - next; - } - - # Its not a script, not a kernel module, so its get to be a binary - &HandleBinaries($destfile); - &OutputPackageList if (($PackageOnly eq true) && !($PKGName)); -} - -if (($PKGName) && ($SymLink eq false)) { - print ("\n\nPackage dependencies for $PKGName:\n"); - &OutputPackageList; -} - -&CloseDBs; - -#===========================END OF MAIN==================================== - -sub GetLddInfo { # return multi-line string of ldd info for File -local ($FileID, $FileType) = @_; - - $outstring = "* Not a File\n"; - return ($outstring) if $FileType =~ /[Mlsdc]/; # ldd results not useful here - - # - # use map file to see if this is a file that gives a known bad ldd return - # - -# if ($Unsup{$FileID} == 1) { -# $outstring = "* unsupported or unknown file type, per map file"; -# return ($outstring); -# } -# $err = ""; -# $string = `/usr/bin/ldd $FileID 2>&1`; -# if ($?) { # if some error (don't just get wait status here) -# $errnum = 0 + $!; -# $err = "==$?==$errnum=="; -# if (($err eq "==256==29==") || ($err eq "==256==0==")) { -# $err = "*"; # these are normal ldd returns -# } else { -# die "Unexpected ldd return $? $!"; -# } -# $string =~ s/\/usr\/bin\/ldd:[^\0]*://g; # trim up error line -# } elsif ($string =~ s/warning:.*://) { # other normal ldd returns -# $err = "*"; -# } - - $outstring = ""; - $string = `/usr/bin/ldd $FileID 2>&1`; - # on a non-zero ldd, return nothing - return ($outstring) if ($?); - - - $outstring = ""; - @infolines = split(/\s*\n\s*/, $string); - foreach $line (@infolines) { - $line =~ s/^\s+//; # trim leading ws - next unless $line; # skip if blank - @words = split(/\s/, $line); - $filename = $words[0]; - $outstring .= "$filename\n"; - } - return ($outstring); -} - -sub CloseDBs { - # close the dbs - dbmclose(FTYPE); - dbmclose(MODE); - dbmclose(PKGS); - dbmclose(ABSLINK); - dbmclose(PKGNAMES); -} - -sub OpenDBs { - # open the databases for read-only - dbmopen(%FTYPE, "$DBDir/FTYPE", 0664) || - die"Cannot open dbm db $DBDir/FTYPE\n"; - - dbmopen(%MODE, "$DBDir/MODE", 0664) || - die"Cannot open dbm db $DBDir/MODE\n"; - - dbmopen(%PKGS, "$DBDir/PKGS", 0664) || - die"Cannot open dbm db $DBDir/PKGS\n"; - - dbmopen(%ABSLINK, "$DBDir/ABSLINK", 0664) || - die"Cannot open dbm db $DBDir/ABSLINK \n"; - - dbmopen(%PKGNAMES, "$DBDir/PKGNAMES", 0644) || - die"Cannot open dbm db $DBDir/PKGNAMES\n"; -} - -sub HandleKernelMod { -local ($entry, $ftype) = @_; - - # search for the magic right, starting from the right (ie. end of path) - $index = rindex($entry, "kernel"); - # rindex() returns where the "kernel" began, add 6 to get - # "{some path}/kernel" - $index += 6; - # OK, now pull out the absolute path - $KernelPath = substr($entry, 0, $index); - - # There are two ways to figure out the dependencies. - # First, we check to see if /usr/bin/ldd will tell us. - # If ldd fails, then we need to look at the output of /usr/bin/strings - - $LddInfo = ""; - $LddInfo = &GetLddInfo($entry, $ftype); - - if ($LddInfo =~ /\w/) { - @list = ""; - @list = split(/\n/, $LddInfo); - foreach $file (@list) { - $found = 0; - - # first, check to see if there is a module relative to - # this file - if ($FTYPE{"$KernelPath/$file"} =~ /\w/){ - &Output("$KernelPath/$file"); - $found++; - } - - # Haven't found it yet, check /kernel - if (($FTYPE{"/kernel/$file"} =~ /\w/) && ($found == 0)){ - &Output("/kernel/$file"); - $found++; - } - - # Haven't found it yet, check /usr/kernel - if (($FTYPE{"/usr/kernel/$file"} =~ /\w/) && ($found == 0)){ - &Output("/usr/kernel/$file"); - $found++; - } - - if ($found == 0) { - print("Could not resolve $file\n"); - } - } - return; - } - - # the ldd failed, so now let's look at the string output - $string = ""; - @infolines = ""; - @outlines = ""; - - $string = `/usr/bin/strings $entry 2>&1`; - @infolines = split(/\s*\n\s*/, $string); - - foreach $line (@infolines) { - if ($line =~ /\//){ - push (@outlines,$line); - } - } - - foreach $line (@outlines) { - @words = split(/\s/, $line); - foreach $word (@words) { - $found = 0; - - # first, check to see if there is a module relative to - # this file - if ($FTYPE{"$KernelPath/$word"} =~ /\w/){ - &Output("$KernelPath/$word"); - $found++; - } - - # Haven't found it yet, check /kernel - if (($FTYPE{"/kernel/$word"} =~ /\w/) && ($found == 0)){ - &Output("/kernel/$word"); - $found++; - } - - # Haven't found it yet, check /usr/kernel - if (($FTYPE{"/usr/kernel/$word"} =~ /\w/) && ($found == 0)){ - &Output("/usr/kernel/$word"); - $found++; - } - } - } -} - -sub GetStringsInfo { # return multi-line string of ldd info for File -local ($FileID, $FileType) = @_; - - $outstring = "* Not a File\n"; - return ($outstring) if $FileType =~ /[Mlsdc]/; # ldd results not useful here - return ($outstring) if ($NoStrings eq true); # we are running in conservative mode - - # use map file to see if this is a file that gives a known bad ldd return - if ($Unsup{$FileID} == 1) { - $outstring = "* unsupported or unknown file type, per map file"; - return ($outstring); - } - $err = ""; - $string = ""; - $string = `/usr/bin/strings $FileID 2>&1`; - - $outstring = ""; - @infolines = ""; - @outlines = ""; - @infolines = split(/\s*\n\s*/, $string); - - foreach $line (@infolines) { - if (($line =~ /\//) && !($line =~ /%/) && !($line =~ m%/$%)){ - push (@outlines,$line); - } - } - @outlines = sort(@outlines); - - foreach $word (@outlines) { - if ($lastword ne $word) { - $outstring .= $word; $outstring .= "\n"; - } - $lastword = $word; - } - return ($outstring); -} - -sub HandleScripts { -local ($filename) = @_; - open(SCRIPT, $filename); - - undef @output; - while (<SCRIPT>) { - s/^\s+//; # trim leading ws - s/=/ /g; # get rid of all = - s/\`/ /g; # get rid of all ` - next if ($_ =~ /^#/); # strip out obvious comments - next unless $_; # skip if blank - - $line = $_; - @words = split(/\s/, $line); - foreach $word (@words) { - if (($PKGS{$word} =~ /\w/) && ($FTYPE{$word} ne "d")) { - push(@output, $word); - } - } - } - - @output = sort(@output); - $count = 0; - - # make sure we don't output dupes - foreach $file (@output) { - if ($count == 0) { - &Output($file); - } - - if (($count > 0) && ($output[$count] ne $output[$count-1])) { - &Output($file); - } - $count++; - } - - # remember to play nice - close(SCRIPT); -} - -sub HandleBinaries { -local ($filename) = @_; - $LddInfo = &GetLddInfo($destfile, $FTYPE{$filename}); - $StringInfo = &GetStringsInfo($destfile, $FTYPE{$filename}); - - # Parse the ldd output. - # Libs can be found in /kernel or /usr/lib - @list = split(/\n/, $LddInfo); - foreach $file (@list) { - $found = 0; - if ($FTYPE{"/kernel/$file"} =~ /\w/){ - &Output("/kernel/$file"); - $found++; - } - - if ($FTYPE{"/usr/lib/$file"} =~ /\w/){ - &Output("/usr/lib/$file"); - $found++; - } - - if ($found == 0) { - print("Could not resolve $file\n"); - } - } - - # For the strings output, we parse it to see if we can match it to - # any files distributed in a package. - @list = split(/\n/, $StringInfo); - foreach $file (@list) { - if (($FTYPE{$file} =~ /\w/) && ($FTYPE{$file} ne "d")) { - &Output($file); - } - } -} - -sub Output { -local($filename) = @_; - - # If they want a package listing, a unique sorted list - # will be outputted later. Here we simply push elements onto - # this list. - if ($PKGName) { - push(@PkgList, "$PKGS{$filename}\n"); - } - - if ($Verbose eq true) { - print("$filename:$PKGS{$filename}\n"); - return; - } - - # If they want a package listing, a unique sorted list - # will be outputted later. Here we simply push elements onto - # this list. - if ($PackageOnly eq true) { - push(@PkgList, "$PKGS{$filename}\n"); - return; - } - - if ($FileOnly eq true) { - print("$filename\n"); - return; - } -} - -sub HandlePackageName { -local($pkg) = @_; - $pkgchk = `/usr/sbin/pkgchk -l $pkg | grep Pathname | sed 's/Pathname: //'`; - - @files = split(/\n/, $pkgchk); - foreach $file (@files) { - push(@filelist, $file); - } -} - -sub OutputPackageList { -local($filename) = @_; - # If the user specified a package list, here we sort - # the list and make sure we don't output dupes. - $lastpkg = ""; - @outPkgs = sort(@PkgList); - - foreach $pkg (@outPkgs) { - $pkg =~ s/\s*$//; # trim extra space off the end - - # make sure this entry isn't a dupe before - # printing it - if ($lastpkg ne $pkg) { - print("P $pkg\t$PKGNAMES{$pkg}\n"); - } - - $lastpkg = $pkg; - } - - # reset the list for the next entry - @PkgList = ""; -} - diff --git a/usr/src/tools/depcheck/get_depend_info.1onbld b/usr/src/tools/depcheck/get_depend_info.1onbld deleted file mode 100644 index 1983732e2f..0000000000 --- a/usr/src/tools/depcheck/get_depend_info.1onbld +++ /dev/null @@ -1,200 +0,0 @@ -'\" t -.\" -.\" CDDL HEADER START -.\" -.\" The contents of this file are subject to the terms of the -.\" Common Development and Distribution License, Version 1.0 only -.\" (the "License"). You may not use this file except in compliance -.\" with the License. -.\" -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -.\" or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions -.\" and limitations under the License. -.\" -.\" When distributing Covered Code, include this CDDL HEADER in each -.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. -.\" If applicable, add the following below this CDDL HEADER, with the -.\" fields enclosed by brackets "[]" replaced with your own identifying -.\" information: Portions Copyright [yyyy] [name of copyright owner] -.\" -.\" CDDL HEADER END -.\" -.\" -.\" Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. -.\" Use is subject to license terms. -.\" -.TH GET_DEPEND_INFO 1ONBLD "Nov 2, 2000" -.SH "NAME" -get_depend_info \- get dependency information about a package or a file -.SH "SYNOPSIS" -.PP -.nf -\fBget_depend_info\fR [-\fBcons\fR] \-\fBdbdir\fR \fIdbm_database_pathname\fR - [-\fBf\fR | -\fBp\fR] [-\fBh\fR] [-\fBroot\fR \fIroot_pathname\fR] - [-\fBs\fR] [-\fBpkg\fR \fISUN_package\fR | \fIfilename\fR \&...] -.fi -.SH "DESCRIPTION" -.PP -The \fBget_depend_info\fR command prints dependency information about a package, -a file, or a set of files on the standard output\&. -.SH "OPTIONS" -.PP -The following options are supported: -.sp -.ne 2 -\fB-\fBcons\fR\fR -.in +16n -Turns on conservative mode, that is, refrains from using -\fB/usr/bin/strings\fR\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBdbdir\fR\fR -.in +16n -Specifies the directory in which the Perl DBM databases generated by -\fBmake_pkg_db\fR(1ONBLD) are located\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBf\fR\fR -.in +16n -Outputs file dependencies only\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBh\fR\fR -.in +16n -Displays help\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBp\fR\fR -.in +16n -Outputs package dependencies only\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBpkg\fR\fR -.in +16n -Specifies a particular package on which you want to run the dependency -analysis\&. You must specify this option if you specify either a Sun software -package or a third-party software package that conforms with the Sun package -format (\fISUN_package\fR)\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBroot\fR\fR -.in +16n -Specifies an alternate root\&. You must also use the -\fBpkg\fR option if you -use this option\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBs\fR\fR -.in +16n -Outputs symbolic links for files or packages only\&. -.sp -.sp 1 -.in -16n -.SH "OPERANDS" -.PP -The following operands are supported: -.sp -.ne 2 -\fB\fIdbm_database_pathname\fR\fR -.in +24n -Specifies the path name of the directory in which the Perl DBM databases -generated by \fBmake_pkg_db\fR are located\&. -.sp -.sp 1 -.in -24n -.sp -.ne 2 -\fB\fIfilename\fR\fR -.in +24n -Specifies the name of a file or files on which you want to run the dependency -analysis\&. -.sp -.sp 1 -.in -24n -.sp -.ne 2 -\fB\fIroot_pathname\fR\fR -.in +24n -Specifies the path name of an alternate root you want to use\&. -.sp -.sp 1 -.in -24n -.sp -.ne 2 -\fB\fISUN_package\fR\fR -.in +24n -Specifies the name of a particular Sun software package (or any third-party -software package that conforms with the Sun package format) on which you want -to run the dependency analysis\&. You must use the -\fBpkg\fR option if you -specify this operand\&. -.sp -.sp 1 -.in -24n -.PP -You can specify either a Sun software package or a file name, but not both\&. -.SH "EXAMPLES" -.PP -\fBExample 1:\fR To Get a Dependency Analysis of Two Particular Files -.PP -.nf -% get_depend_info -dbdir MyDir /usr/bin/ls /usr/bin/man -.fi -.PP -\fBExample 2:\fR To Get a Dependency Analysis of Files Using a Wild Card -.PP -.nf -% get_depend_info -dbdir MyDir /usr/sbin/* -.fi -.PP -\fBExample 3:\fR To Get a Dependency Analysis of a Package in Sun Format -.PP -.nf -% get_depend_info -dbdir MyDir -pkg NSCPcom -% get_depend_info -dbdir MyDir -pkg SUNWnisu -.fi -.PP -\fBExample 4:\fR To Display Help -.PP -.nf -% get_depend_info -h -.fi -.SH "ATTRIBUTES" -.PP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -Availability SUNWonbld -CSI Enabled -Interface Stability Evolving -MT-Level Unsafe -.TE -.sp -.SH "SEE ALSO" -.PP -\fBmake_pkg_db\fR(1ONBLD), \fBattributes\fR(5) diff --git a/usr/src/tools/depcheck/make_pkg_db b/usr/src/tools/depcheck/make_pkg_db deleted file mode 100644 index 56691e1f8b..0000000000 --- a/usr/src/tools/depcheck/make_pkg_db +++ /dev/null @@ -1,527 +0,0 @@ -#!/usr/bin/perl -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright (c) 2000 by Sun Microsystems, Inc. -# All rights reserved. -# - -# ident "%Z%%M% %I% %E% SMI" - -$PkgDir = "/var/sadm/pkg"; # where to find the pkg directories -$PROGRAM_NAME = "make_pkg_db"; -$DBM_DIR_CHARACTERIZATION = "directory for the dbm databases"; -$INPUT_FILES_CHARACTERIZATION = "one or more files in /var/sadm/install/contents format"; -$PKGDEFS_DIRECTORY = "package pool directory"; - -$Usage = -"Usage: $PROGRAM_NAME - [-ifiles <$INPUT_FILES_CHARACTERIZATION>] - [-pkgdef <$PKGDEFS_DIRECTORY>] - -dbdir <$DBM_DIR_CHARACTERIZATION> - [-h for help]\n"; - -$Help = -"This program initializes a set of dbm databases with information -from /var/sadm/install/contents or a user-defined package pool directory. -There is one required argument: - - -dbdir <dir> the $DBM_DIR_CHARACTERIZATION - -\nThe optional argument -h produces this message instead of any processing. -\nThe optional argument -ifiles is used for symbolic link resolution. -\nThe optional argument -pkgdef creates the databases based upon a package \npool directory instead of /var/sadm/install/contents on the local machine. -"; - - -# -# check for perl5 -- we use things unavailable in perl4 -# - -die "Sorry, this program requires perl version 5.000 or up. You have $]. Stopping" if $] < 5.000; - -# -# process arguments -# - -$PKGDefs = ""; - -while (@ARGV) { - $arg = shift (@ARGV); - if ($arg eq "-h") { - print "$Help\n$Usage"; - exit 0; - } elsif ($arg eq "-ifiles") { - while (($ARGV[0] !~ /^-/) && (@ARGV)){ - push (@IFiles, shift(@ARGV)); - } - } elsif ($arg eq "-dbdir") { - $DBDir = shift(@ARGV) unless ($ARGV[0] =~ /^-/); - } elsif ($arg eq "-pkgdef") { - $PKGDefs = shift(@ARGV) unless ($ARGV[0] =~ /^-/); - } else { - print STDERR "Unrecognized argument $arg. \n$Usage"; - exit 1; - } -} - -# make sure the package pool directory exists -if (($PKGDefs) && !(-d $PKGDefs)) { - print STDERR "Cannot open the directory $PKGDefs\n"; - exit 1; -} - -# Here we define the input files which will be parsed -if ($PKGDefs) { - - $dirs = `ls $PKGDefs`; - @dirlist = split(/\s*\n\s*/, $dirs); - - foreach $dir (@dirlist) { - push(@IFiles, "$PKGDefs/$dir/pkgmap"); - } - - reverse(@IFiles); -} -else { - push(@IFiles, "/var/sadm/install/contents"); -} - -if (!@IFiles) { - print STDERR "Required argument -ifiles missing. \n$Usage"; - exit 1; -} - -if (!$DBDir) { - print STDERR "Required argument -dbdir missing. \n$Usage"; - exit 1; -} - -$Struct = \%struct; # here is the structure we'll store everything in - - - -# -# now open the dbm databases we will initialize -# -&yelp ("...initializing the databases\n"); - -unless (-d "$DBDir") { - &yelp("Creating directory $DBDir\n"); - mkdir($DBDir, 0777); -} - -# db for package names from the /var/sadm/pkg/foo/pkginfo files -dbmopen(%PKGNAMES, "$DBDir/PKGNAMES", 0644) || die"Cannot open dbm db $DBDir/PKGNAMES\n"; - -# db for entity file types -dbmopen(%FTYPE, "$DBDir/FTYPE", 0664) || die"Cannot open dbm db $DBDir/FTYPE\n"; - -# db for entity modes types -dbmopen(%MODE, "$DBDir/MODE", 0664) || die"Cannot open dbm db $DBDir/MODE\n"; - -# db for entity packages -dbmopen(%PKGS, "$DBDir/PKGS", 0664) || die"Cannot open dbm db $DBDir/PKGS\n"; - -# db for absolute link targets -dbmopen(%ABSLINK, "$DBDir/ABSLINK", 0664) || die"Cannot open dbm db $DBDir/ABSLINK\n"; - - -undef %FTYPE; # remove existing records, if any -undef %MODE; -undef %PKGS; -undef %ABSLINK; -undef %PKGNAMES; - -$Debug = 1; # print extra gibberish - -# -# go make the package names db -# - -&MakePackageNamesDB($PkgDir); - -# -# read and parse each input file in contents file format -# - -&yelp ("...making the FTYPE MODE and PKGS databases\n"); -foreach $IFile (@IFiles) { - if ($PKGDefs) { - unless (-r $IFile) { - print STDERR "Could not open file: $IFile\n"; - next; - } - - @pkgname = split("/", $IFile); - $thisPkg = @pkgname[($#pkgname-1)]; - $pkgInfo="$PKGDefs/$thisPkg/pkginfo"; - $thisBaseDir=""; - if (-r $pkgInfo) { - $BASEDIR = `grep '^BASEDIR' $pkgInfo`; - $BASEDIR =~ s/^BASEDIR=//; - chomp($BASEDIR); - $thisBaseDir = $BASEDIR; - } - } - - open (IFILE, "$IFile") || die "cannot open input file $IFile\n"; - - # Tell the user what we are looking at UNLESS they are looking at a package - # pool. A package pool could have hundreds of entries which just creates - # a lot of useless (and confusing) output. - &yelp("...opening $IFile\n") unless ($PKGDefs); - - while (<IFILE>) { # loop over file line-at-a-time - if ($PKGDefs) { - next if /^:/; # ignore these lines from a pkgmap - next if (/(\S+)\s+[i]\s+/); - } - else { - next if /^#/; # ignore comments - next if /^\s*$/; # ignore blanks - } - - - chop; - undef $FType; - undef $Mode; - - $line=$_; - - if ($PKGDefs) { - &ParsePkgmapEntry($line); - @Pkgs = $thisPkg; - } - else { - &ParseContentsEntry($_); - } - - # if this entry was supplied by a earlier file, skip it - - if ($FTYPE{$Entity} =~ /\w/) { - - # don't bother complaining about directories, we know the same - # directory could exist in multiple packages - next if ($FTYPE{$Entity} eq "d"); - - if ($PKGDefs) { - # In the case where we are going through a package pool, we - # expect that a file may reside in multiple packages. If - # that is detected, we simply add this package to the list of - # packages for that file - - $currPkgs = $PKGS{$Entity}; -next if ($FTYPE{$Entity} eq "s"); - $PKGS{$Entity} = "$currPkgs $thisPkg"; - } - else { - # In the case where we are reading in from - # /var/sadm/install.contents, we do not expect to see any - # over-ridden files EXCEPT when the "-ifiles" option is used. - &yelp("...OVERRIDDEN: $line\n"); - } - next; - } else { - $Package = join(" ",@Pkgs);# store supplying packages sep by " " - - # This is a hack. In the case of directories like /bin which - # would belong in many packages, the $PKGS hash would not - # be able to handle such a long entry. So for directories, I - # just place the first package I find. For this tool, it doesn't - # matter since this tool does not report which directories come - # from which package. - - if ($FType eq "d") { - @FirstPackage = split(" ", $Package); - $PKGS{$Entity} = $FirstPackage[0]; - } - else { - $PKGS{$Entity} = $Package; # update PKGS database - } - } - - # - # put what we need from this entry line into the dbs - # - - &yelp ("***NO FILETYPE! IGNORING ENTRY: $_\n") unless $FType; - $FTYPE{$Entity} = $FType; # update the FTYPE database - - # - # now collect the possible paths for each basename - # - - ($path, $base) = $Entity =~ /(.*\/)(.*)/; - push(@{$Struct->{"PATHS"}->{$base}}, $Entity); - if ($FType =~ /[ls]/) { # link - $rellinkent = "$Entity;$RelEntity"; - push (@RelLinkEnts,$rellinkent); # make list of ents to resolve - } else { - $MODE{$Entity} = $Mode if $Mode ne ""; # update MODE database - } - } - close IFILE; -} # end foreach $IFile - -# -# now convert the relative links into absolute ones -# - -&yelp ("...making the ABSLINK database\n"); -foreach $rellinkent (@RelLinkEnts) { - ($Entity, $RelEntity) = split(/;/, $rellinkent); - $AbsLink = &GetAbsLink($Entity, $RelEntity); - $ABSLINK{$Entity} = $AbsLink; -} - -# -# close the dbs -- we're done -# - -dbmclose (FTYPE); -dbmclose (MODE); -dbmclose (PKGS); -dbmclose (ABSLINK); -dbmclose (PKGNAMES); - -&yelp ("...DONE\n"); -#===========================END OF MAIN==================================== - -sub GetAbsLink { # convert relative link to actual one -local ($entry, $rellink) = @_; - - return $rellink if $rellink =~ /^\//; # just return if abs already - - @RelPath = split(/\//,$rellink); - @EntryPath = split(/\//,$entry); - - # - # get the filename part - # - - undef @AbsPath; - @AbsPath = (pop(@RelPath)) if $RelPath[$#RelPath] =~ /w/; - pop @EntryPath; - - # - # pop the relative path until a relative dir shows up - # - - while (@RelPath) { - $relhere = pop(@RelPath); - if ($relhere =~ /\w/) { # there's a letter or number - unshift (@AbsPath, $relhere); # its a dirname; keep it - } elsif ($relhere =~ /^\.\.$/) { # its a .. pop up one dir - pop(@EntryPath); - } elsif ($relhere =~ /^\.$/) { # it's a . -- stop - last; - } - } - - while (@EntryPath) { # complete the path - unshift(@AbsPath, pop(@EntryPath)); # ...from the remaining entry - } - $abspath = join("/", @AbsPath); - if (!$FTYPE{$abspath}) { # no installed entity ! -# NICKI - for now - &yelp("***CANNOT FIND ABSOLUTE PATH $abspath FOR ENTRY: $entry=$rellink\n"); -# &yelp("***CANNOT RESOLVE ABSOLUTE PATH $abspath\n"); - -# COMMENTED OUT BY NICKI -# $base = $rellink; -# $base =~ s/.*\///; # get basename we're looking for -# @cans = @{$Struct->{"PATHS"}->{$base}}; # get all entities ... -# $numcans = $#cans + 1; # ... with this base - -# &yelp(" There are $numcans entries with this basename:\n"); -# foreach $can (@cans) { -# &yelp(" $can\n"); -# } -# $abspath = ""; - } - return $abspath; -} - -sub ParseContentsEntry { -#invocation: &ParseContentsEntry($l); # $l is a line in the file -local ($l) = @_; - - # - # look for b or c entries, like: - # /devices/pseudo/openeepr@0:openprom c none 38 0 0640 root sys SUNWcsd - # - - if (($Entity,$FType,$Class,$Maj,$Min,$Mode,$Owner,$Group,@Pkgs) = - ($l =~ /^(\S+)\s+([bc])\s+(\w+)\s+([0-9]+)\s+([0-9]+)\s+([0-7]+)\s+([a-z]+)\s+([a-z]+)\s+([A-Z].*)/)) { - - # - # look for d entries, like - # /devices/pseudo d none 0755 root sys SUNWcsd - # - - } elsif (($Entity,$FType,$Class,$Mode,$Owner,$Group,@Pkgs) = - ($l =~ /^(\S+)\s+([d])\s+(\w+)\s+([0-7]+)\s+([a-z]+)\s+([a-z]+)\s+([A-Z].*)/)) { - - # - # look for f or e or v entries, like - # /etc/asppp.cf f none 0744 root sys 360 27915 801314234 SUNWapppr - # - - } elsif (($Entity,$FType,$Class,$Mode,$Owner,$Group, - $Size,$Checksum,$Modtime,@Pkgs) = - ($l =~ /^(\S+)\s+([fev])\s+(\w+)\s+([0-7]+)\s+([a-z]+)\s+([a-z]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([A-Z].*)/)) { - - # - # look for l or s entries, like - # /bin=./usr/bin s none SUNWcsr - # - - } elsif (($Entity,$RelEntity,$FType,$Class,@Pkgs) = - ($l =~ /^([^=]+)=(\S+)\s+([ls])\s+(\w+)\s+([A-Z].*)/)) { - } else { - print STDERR "Unrecognized entry in $IFile: $l\n"; - } -} - -sub ParsePkgmapEntry { -local ($line) = @_; - - # for validation of input - $Unresolved = true; - - # look for d entries, like - # 1 d root etc 775 root sys - - if (($Part,$FType,$Class,$Entity,$Mode,$Owner,$Group) = - ($line =~ /^(\S+)\s+([d])\s+(\w+)\s+(\S+)\s+(\d+)\s+(\w+)\s+(\w+)/)) { - # prepend a install root - if ($thisBaseDir eq "/") { - $Entity = "/$Entity"; - } - else { - $Entity = "$thisBaseDir/$Entity"; - } - $Unresolved = false; - } - - # look for e,f or v entries, like - # 1 e master boot/solaris/devicedb/master 0644 root sys 75 5775 940882596 - - elsif (($Part,$FType,$Class,$Entity,$Mode,$Owner,$Group,$Size,$Checksum,$Modtime) = - ($line =~ /^(\S+)\s+([efv])\s+(\w+)\s+(\S+)\s+(\d+)\s+(\w+)\s+(\w+)/)) { - - # prepend a install root - if ($thisBaseDir eq "/") { - $Entity = "/$Entity"; - } - else { - $Entity = "$thisBaseDir/$Entity"; - } - $Unresolved = false; - } - elsif (($Part, $FType, $Class, $Entity, $RelEntity) = - ($line =~ /^(\S+)\s+([ls])\s+(\w+)\s+(\S+)[=](\S+)/)) { - - # prepend a install root - if ($thisBaseDir eq "/") { - $Entity = "/$Entity"; - } - else { - $Entity = "$thisBaseDir/$Entity"; - } - $Unresolved = false; - } - - print ("UNRESOLVED: $line\n") if ($Unresolved eq true); -} - -sub ParsePrototypeEntry { -#invocation: &ParsePrototypeEntry($l); # $l is a line in the file -local ($l) = @_; - - # - # look for b or c entries, like: - # /devices/pseudo/openeepr@0:openprom c none 38 0 0640 root sys SUNWcsd - # - - if (($Entity,$FType,$Class,$Maj,$Min,$Mode,$Owner,$Group,@Pkgs) = - ($l =~ /^(\S+)\s+([bc])\s+(\w+)\s+([0-9]+)\s+([0-9]+)\s+([0-7]+)\s+([a-z]+)\s+([a-z]+)\s+([A-Z].*)/)) { - - # - # look for d entries, like - # d root etc 775 root sys - # - - } elsif (($FType,$Class,$Entity,$Mode,$Owner,$Group) = - ($l =~ /^([d])\s+(\w+)\s+(\S+)\s+([0-7]+)\s+(\w+)\s+(\w+)/)) { - - # - # look for f or e or v entries, like - # e preserve etc/acct/holidays 664 bin bin - # - - } elsif (($FType,$Class,$Entity,$Mode,$Owner,$Group) = - ($l =~ /^([fev])\s+(\w+)\s+(\S+)\s+([0-7]+)\s+(\w+)\s+(\w+)/)) { - - # - # look for l or s entries, like - # l root etc/rc2.d/S21perf=../../etc/init.d/perf - # - - } elsif (($FType,$Class,$Entity,$RelEntity) = - ($l =~ /^([ls])\s+(\w+)\s+([^=]+)=(\S+)/)) { - } else { - print STDERR "Unrecognized Prototype File entry: $l\n"; - } -} - -sub yelp { -local($String) = @_; - print "$String"; -} - - - -sub MakePackageNamesDB { -#invocation: &MakePackageNamesDB($PkgDir); -local ($PkgDir) = @_; # argument is parent directory of pkg dirs - - #$PkgDir = "/var/sadm/pkg"; - opendir(PKGDIR, "$PkgDir") || die "Cannot open package directory $PkgDir\n"; - @Pkgs = grep(/^[A-Z]/,readdir(PKGDIR)); # list of all package directories - foreach $Pkg (@Pkgs) { # loop over 'em - $InfoFile = "$PkgDir/$Pkg/pkginfo"; # full name of the pkginfo file - if (-r $InfoFile) { # if we can read it - $str = `grep '^NAME=' $InfoFile`; # just grep the entry - $str =~ s/\s*\n$//; # trim trailing ws - $str =~ s/.*=\s*//; # trim leading NAME= - if ($str =~ /\w/) { # if the name has a letter or number in it - $PKGNAMES{$Pkg} = $str; - } else { - &yelp("***Cannot find usable NAME entry in $InfoFile\n"); - } - } else { - &yelp("***Cannot find readable file $InfoFile\n"); - } - } # end of loop over package directories -} diff --git a/usr/src/tools/depcheck/make_pkg_db.1onbld b/usr/src/tools/depcheck/make_pkg_db.1onbld deleted file mode 100644 index 89d42f881c..0000000000 --- a/usr/src/tools/depcheck/make_pkg_db.1onbld +++ /dev/null @@ -1,196 +0,0 @@ -'\" t -.\" -.\" CDDL HEADER START -.\" -.\" The contents of this file are subject to the terms of the -.\" Common Development and Distribution License, Version 1.0 only -.\" (the "License"). You may not use this file except in compliance -.\" with the License. -.\" -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -.\" or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions -.\" and limitations under the License. -.\" -.\" When distributing Covered Code, include this CDDL HEADER in each -.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. -.\" If applicable, add the following below this CDDL HEADER, with the -.\" fields enclosed by brackets "[]" replaced with your own identifying -.\" information: Portions Copyright [yyyy] [name of copyright owner] -.\" -.\" CDDL HEADER END -.\" -.\" -.\" Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. -.\" Use is subject to license terms. -.\" -.TH MAKE_PKG_DB 1ONBLD "Nov 2, 2000" -.SH "NAME" -make_pkg_db \- create a Perl DBM database of installed software -.SH "SYNOPSIS" -.PP -.nf -\fBmake_pkg_db\fR \-\fBdbdir\fR \fIdbm_database_pathname\fR\ [-\fBh\fR] - [-\fBifiles\fR \fIfilename\fR\&...] - [-\fBpkgdef\fR \fIpackage_pool_pathname\fR] -.fi -.SH "DESCRIPTION" -.PP -The \fBmake_pkg_db\fR command (a Perl script) generates a Perl DBM database of -software installed on a system based on \fB/var/sadm/install/contents\fR or the -contents of a package pool directory\&. The Perl DBM database files are used by -\fBget_depend_info\fR(1ONBLD)\&. -.PP -The Perl DBM database files contain information keyed on a file name\&. Some -files, for example, list the package in which a file is included and the -permissions of the file\&. -.PP -If you run \fBmake_pkg_db\ -dbdir\ \fIdbm_database_pathname\fR\fR, an error -message such as: -.PP -\fB***CANNOT RESOLVE ABSOLUTE PATH /usr/java/bin/appletviewer\fR -.PP -is generated because the script cannot resolve symbolic links based on the -information in \fB/var/sadm/install/contents\fR\&. In -\fB/var/sadm/install/contents\fR, for example, \fBappletviewer\fR is specified -as a symbolic link: -.sp -.nf -\f(CW/usr/bin/appletviewer=\&.\&./java/bin/appletviewer s none SUNWj2dev\fR -.fi -.sp -.PP -Unfortunately, \fB/usr/java\fR is a symbolic link to \fB/usr/java1\&.2\fR\&. -The correct file entry in \fB/var/sadm/install/contents\fR is therefore -\fB/usr/java1\&.2/bin/appletviewer\fR\&. It is impossible for this script to -resolve this link based on the information in -\fB/var/sadm/install/contents\fR\&. -.PP -To correct this problem, create a file named \fBMyLinkResolution\fR and add -this entry: -.sp -.nf -\f(CW/usr/bin/appletviewer=\&.\&./java1\&.2/bin/appletviewer s none SUNWj2dev\fR -.fi -.sp -.PP -Then enter this command: -.PP -.sp -.nf -\f(CWmake_pkg_db -dbdir \fIdbm_database_pathname\fR -ifiles MyLinkResolution\fR -.fi -.sp -When you execute this command, the following message is displayed: -.sp -.nf -\f(CW\&.\&.\&.OVERRIDDEN: /usr/bin/appletviewer= -\&.\&./java/bin/appletviewer s none SUNWj2dev\fR -.fi -.sp -.PP -This message indicates that the original entry in -\fB/var/sadm/install/contents\fR is ignored and your new entry in -\fBMyLinkResolution\fR is used instead\&. -.PP -\fBSampleLinks\fR is a file you can use to resolve links in -\fB/var/sadm/install/contents\fR for Solaris (Intel Platform Edition)\&. -\fBSamplePkgLinks\fR is a file you can use to resolve some of the links used on -the Solaris 8 Software 1 of 2 Intel Platform Edition CD\&. You might want to -modify these two preceding files for SPARC or for your particular environment\&. -.PP -The \fBmake_pkg_db\fR script verifies the files it finds against the software -that is actually installed on the system\&. The more complete the information, -the more accurate the output of the script\&. -.SH "OPTIONS" -.PP -The following options are supported: -.sp -.ne 2 -\fB-\fBdbdir\fR\fR -.in +16n -Specifies the directory in which you want to place the output Perl DBM -databases\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBh\fR\fR -.in +16n -Displays help\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBifiles\fR\fR -.in +16n -Specifies the name of an input file you want to use to help in resolving -symbolic links\&. -.sp -.sp 1 -.in -16n -.sp -.ne 2 -\fB-\fBpkgdef\fR\fR -.in +16n -Specifies the path name of the package pool you want to use instead of -\fB/var/sadm/install/contents\fR\&. -.sp -.sp 1 -.in -16n -.SH "OPERANDS" -.PP -The following operands are supported: -.sp -.ne 2 -\fB\fIdbm_database_pathname\fR\fR -.in +24n -Specifies the directory in which you want to place the output Perl DBM -databases\&. -.sp -.sp 1 -.in -24n -.sp -.ne 2 -\fB\fIfilename\fR\fR -.in +24n -Specifies the name of a file or files that contain data in the format used in -\fB/var/sadm/install/contents\fR\&. -.sp -.sp 1 -.in -24n -.sp -.ne 2 -\fB\fIpackage_pool_pathname\fR\fR -.in +24n -Specifies the path name of the package pool you want to use instead of -\fB/var/sadm/install/contents\fR\&. -.sp -.sp 1 -.in -24n -.SH "ATTRIBUTES" -.PP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp -.TS -box; -cw | cw -lw | lw . -ATTRIBUTE TYPE ATTRIBUTE VALUE -Availability SUNWonbld -CSI Enabled -Interface Stability Evolving -MT-Level Unsafe -.TE -.sp -.SH "SEE ALSO" -.PP -\fBget_depend_info\fR(1ONBLD), \fBattributes\fR(5) -.SH "NOTES" -.PP -DBM database files are platform dependent\&. DBM database files you generate on -a SPARC machine, for example, do not work on an IA machine (and vice-versa)\&. -.PP -This script might not resolve all symbolic links\&. |
