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.

105 lines
2.6 KiB

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