b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # bash feeds/packages/lang/ruby/ruby_missingfiles staging_dir/target-i386_i486_musl-1.1.11/ bin/x86/packages/packages/*ruby*_2.3.0* |
| 4 | # |
| 5 | |
| 6 | function list_staging_files { |
| 7 | cd "$1"; find \ |
| 8 | \( \( -name "root-*" -or -name "packages" -or -name "stamp" -or -name "pkginfo" -or -name "host" -or -name man \) -prune \) -or -true \ |
| 9 | \( -path "*ruby*" -or -name "erb" -or -name "gem" -or -name "irb" -or -name "rake" -or -name "rdoc" -or -name "ri" -or -name "testrb" -or -name "racc" -or -name "racc2y" -or -name "y2racc" \) \ |
| 10 | -not -path "*/usr/lib/ruby/gems/*/cache/*" \ |
| 11 | -not -name "*test_case.rb" \ |
| 12 | -not -name "*.rdoc" \ |
| 13 | -not -name "*.doc" \ |
| 14 | -not -name "*.md" \ |
| 15 | -not -name "*.txt" \ |
| 16 | -not -name "*.travis.yml" \ |
| 17 | -not -regex ".*/usr/lib/ruby/gems/[^/]*/gems/[^/]*/benchmark/.*" \ |
| 18 | -not -regex ".*/usr/lib/ruby/gems/[^/]*/gems/[^/]*/evaluation/.*" \ |
| 19 | -not -regex ".*/usr/lib/ruby/gems/[^/]*/gems/[^/]*/sample/.*" \ |
| 20 | -not -regex ".*/usr/lib/ruby/gems/[^/]*/gems/[^/]*/test/.*" \ |
| 21 | -not -regex ".*/usr/lib/ruby/gems/[^/]*/gems/[^/]*/doc/.*" \ |
| 22 | -not -type d \ |
| 23 | -print | sort |
| 24 | } |
| 25 | |
| 26 | function list_ipkg_files { |
| 27 | for OPKG; do |
| 28 | tar --to-stdout -xzf "$OPKG" ./data.tar.gz | tar tzv | grep -v ^d | sed -e 's,.* \./,./,;s/ -> .*//' |
| 29 | done | sort -u | grep -v ./usr/lib/ruby/ruby...-bin |
| 30 | } |
| 31 | |
| 32 | |
| 33 | |
| 34 | set -e |
| 35 | : ${1:?First arg is staging_dir} |
| 36 | : ${2:?Second and following args are ruby ipkg packages} |
| 37 | STAGING_DIR=$1; shift |
| 38 | (cd "$STAGING_DIR" ) |
| 39 | if ! [ -e "$1" ]; then |
| 40 | echo "$1 does not exist!" |
| 41 | exit 1 |
| 42 | fi |
| 43 | printf '%-62s %-62s\n' "Installed in Staging" "From Packages Files" |
| 44 | diff -d -y <(list_staging_files "$STAGING_DIR") <(list_ipkg_files "$@") |
| 45 | |