OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.6 KiB

  1. #!/bin/sh
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: misc/archive/showsorteddeps.sh
  6. # Copyright (C) 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- T2-COPYRIGHT-NOTE-END ---
  15. cachefiles=
  16. packages=
  17. config=default
  18. if [ "$1" == "-cfg" ]; then
  19. config="$2"
  20. shift; shift
  21. fi
  22. echo_warning() {
  23. echo "$@" | sed -e 's,^,!> ,g' >& 2
  24. }
  25. echo_error() {
  26. echo "$@" | sed -e 's,^,!> ,g' >& 2
  27. exit 1
  28. }
  29. if [ ! -f config/$config/packages ]; then
  30. echo_error "config '$config' doesn't exist, sorry"
  31. fi
  32. # get the list of cache files
  33. #
  34. for pkg; do
  35. confdir=`echo package/*/$pkg/`
  36. if [ -d $confdir ]; then
  37. packages="$packages $pkg"
  38. if [ -f ${confdir}$pkg.cache ]; then
  39. cachefiles="$cachefiles ${confdir}$pkg.cache"
  40. else
  41. echo_warning "package '$pkg' doesn't have a .cache file"
  42. fi
  43. else
  44. echo_warning "package '$pkg' doesn't exist"
  45. fi
  46. done
  47. {
  48. # get the list of interesting packages
  49. # just one level of recursion
  50. #
  51. packages=$( {
  52. echo "$packages" | tr ' ' '\n'
  53. for cache in $cachefiles; do
  54. grep '^\[DEP\]' $cache | cut -d' ' -f2
  55. done } | sort -u | tr -s '\n' | tr '\n' ' ' )
  56. # pattern to search at packages file of this config
  57. #
  58. pkgsexp=$( echo "$packages" | sed -e 's,^ ,,' -e 's, $,,' -e 's,\+,[+],' -e 's, ,\\\|,g' )
  59. # catch interesting data from packages file
  60. # (sorted by package name)
  61. #
  62. mkfifo $0.$$
  63. ( sed -n -e "s,^\(.\) \([^ ]*\) \(...\)\.\(...\) [^ ]* \($pkgsexp\) .*,\5 \3\4 \2 \1,p" \
  64. config/$config/packages | sort > $0.$$ ) &
  65. sleep 1
  66. packages_orig="$packages"
  67. while read pkg prio stages status; do
  68. packages_new="${packages/ $pkg / }"
  69. if [ "$packages" != "$packages_new" ]; then
  70. packages="$packages_new"
  71. if [ "$status" != X ] ; then
  72. status='*'
  73. else
  74. status=' '
  75. fi
  76. echo "$prio $stages $status $pkg"
  77. else
  78. echo_warning "what is '$pkg' doing here?"
  79. fi
  80. done < $0.$$
  81. rm $0.$$
  82. # and catch data from dependencies which were not found at packages list
  83. #
  84. for pkg in $packages; do
  85. confdir=`echo package/*/$pkg/`
  86. if [ -f $confdir/$pkg.desc ]; then
  87. echo_warning "dependency '$pkg' is not available for this build."
  88. sed -n -e 's,^\[P\] . \([^ ]*\) \([^ \.]*\)\.\([^ \.]*\).*,\2\3 \1 - '$pkg',p' $confdir/$pkg.desc
  89. else
  90. echo_warning "dependency '$pkg' doesn't exist!"
  91. fi
  92. done
  93. } | sort -n