summaryrefslogtreecommitdiff
path: root/dependencies/analyses
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-07-12 11:35:48 +0200
committerValentin Rothberg <rothberg@redhat.com>2019-07-16 14:16:16 +0200
commit25d63f009dfb0bd646b761591a08989cfd9d4fda (patch)
tree5e3f087177553f2c2c5dbe5654d5b6e488380e15 /dependencies/analyses
parent9ae3e7c1eced61253330c2c8bd93d51ee97a6774 (diff)
downloadpodman-25d63f009dfb0bd646b761591a08989cfd9d4fda.tar.gz
podman-25d63f009dfb0bd646b761591a08989cfd9d4fda.tar.bz2
podman-25d63f009dfb0bd646b761591a08989cfd9d4fda.zip
dependency-tree analysis: direct and transitive
Change the script to generate two files. One including direct dependencies, the other including direct and transitive dependencies. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'dependencies/analyses')
-rw-r--r--dependencies/analyses/README.md10
-rwxr-xr-xdependencies/analyses/dependency-tree.sh9
2 files changed, 14 insertions, 5 deletions
diff --git a/dependencies/analyses/README.md b/dependencies/analyses/README.md
index e05bc3e8f..a440a0ebd 100644
--- a/dependencies/analyses/README.md
+++ b/dependencies/analyses/README.md
@@ -71,15 +71,17 @@ Running the script can help identify sources of bloat and reveal potential candi
Use the `dependency-tree.sh` script to figure out which package includes which packages.
The output of the script has the format `package: dependency_1, dependency_2, ...`.
Each line is followed by a blank line to make it easier to read.
-Note that the list of dependencies includes only the direct dependencies and not all transitive dependencies.
-The transitive dependencies of a given package can be examined by running `go list -f '{{ .Name }}: {{ join .Deps ", " }}' $PACKAGE` or by browsing through the output of `dependency-tree.sh`.
+The script generates two files:
+
+ - `direct-tree.txt` - listing direct dependencies
+ - `transitive-tree.txt` - listing direct and transitive dependencies
Running such a dependency-tree analysis may look as follows:
```
-[libpod]$ ./dependencies/analyses/dependency-tree.sh github.com/containers/libpod > tree.txt
-[libpod]$ grep "^github.com/containers/libpod/pkg/registries" tree.txt
+[libpod]$ ./dependencies/analyses/dependency-tree.sh github.com/containers/libpod
+[libpod]$ grep "^github.com/containers/libpod/pkg/registries" direct-tree.txt
github.com/containers/libpod/pkg/registries: github.com/containers/libpod/vendor/github.com/containers/image/pkg/sysregistriesv2, github.com/containers/libpod/vendor/github.com/containers/image/types, github.com/containers/libpod/pkg/rootless, github.com/containers/libpod/vendor/github.com/docker/distribution/reference, github.com/containers/libpod/vendor/github.com/pkg/errors, os, path/filepath, strings
```
diff --git a/dependencies/analyses/dependency-tree.sh b/dependencies/analyses/dependency-tree.sh
index 3c9dccc51..9a2e3282d 100755
--- a/dependencies/analyses/dependency-tree.sh
+++ b/dependencies/analyses/dependency-tree.sh
@@ -10,4 +10,11 @@ DATA=$(go list $1/... \
| awk '{ printf "%s\n\n", $0 }' \
)
-echo "$DATA"
+echo "$DATA" > direct-tree.txt
+
+DATA=$(go list $1/... \
+ | xargs -d '\n' go list -f '{{ .ImportPath }}: {{ join .Deps ", " }}' \
+ | awk '{ printf "%s\n\n", $0 }' \
+ )
+
+echo "$DATA" > transitive-tree.txt