File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Prints the number of bytes in a package.
4+ #
5+ # <package_path> <number_of_bytes>
6+
7+ # Determine root directory:
8+ root=" $( git rev-parse --show-toplevel) "
9+
10+ # Define the path to a utility to list packages:
11+ find_pkgs=" ${root} /tools/scripts/find_packages"
12+
13+ # Define the path to a utility to list files:
14+ find_files=" ${root} /tools/scripts/find_files"
15+
16+ # Get a list of packages:
17+ pkgs=" $( PACKAGES_FILTER=${PACKAGES_FILTER} ${find_pkgs} ) "
18+
19+ # For each package, determine the number of bytes...
20+ for pkg in ${pkgs} ; do
21+ # * `find_files`
22+ # - Find package files.
23+ # * `ls -l`
24+ # - Print file info, which includes number of bytes.
25+ # * `awk '{}'`
26+ # - Compute statistics and print results.
27+ FILES_PATTERN=" ${FILES_PATTERN} " FILES_FILTER=" $pkg /.*" " ${find_files} " | xargs ls -l | awk -v pkg=" $pkg " '
28+ {
29+ bytes += $5 # number of bytes
30+ }
31+
32+ END {
33+ print pkg OFS bytes
34+ }'
35+ done
You can’t perform that action at this time.
0 commit comments