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.

87 lines
2.4 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/compare_builddirs.sh
  6. # Copyright (C) 2008 The OpenSDE Project
  7. # Copyright (C) 2005 - 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. config=default
  17. if [ "$1" = -cfg ]; then
  18. config="$2"
  19. fi
  20. compare_builddirs() {
  21. local config="$1" dir0="${2%/}" dir1="${3%/}"
  22. local cfgid0="${dir0#build/}" cfgid1="${dir1#build/}"
  23. local cfg0= cfg1=
  24. echo "compare: $cfgid0 vs. $cfgid1"
  25. # config dir
  26. if grep -q "^export SDECFG_ID='$cfgid0'" config/$config/config; then
  27. cfg0="config/$config"
  28. elif [ -f "$dir0/etc/ROCK-CONFIG/packages" ]; then
  29. cfg0="$dir0/etc/ROCK-CONFIG"
  30. elif [ -f "$dir0/etc/SDE-CONFIG/packages" ]; then
  31. cfg0="$dir0/etc/SDE-CONFIG"
  32. else
  33. echo "Unable to detect '$dir0' config."
  34. fi
  35. if grep -q "^export SDECFG_ID='$cfgid1'" config/$config/config; then
  36. cfg1="config/$config"
  37. elif [ -f "$dir1/etc/ROCK-CONFIG/packages" ]; then
  38. cfg1="$dir1/etc/ROCK-CONFIG"
  39. elif [ -f "$dir1/etc/SDE-CONFIG/packages" ]; then
  40. cfg1="$dir1/etc/SDE-CONFIG"
  41. else
  42. echo "Unable to detect '$dir1' config."
  43. fi
  44. [ -n "$cfg0" -a -n "$cfg1" ] || exit 1
  45. # package list
  46. #diff -U1 "$cfg0/packages" "$cfg1/packages"
  47. # dir0 vs dir1
  48. for flist in "$dir0/var/adm/flists/"*; do
  49. pkg="${flist#$dir0/var/adm/flists/}"
  50. if [ -f "$dir1/var/adm/flists/$pkg" ]; then
  51. diff -U1 "$flist" "$dir1/var/adm/flists/$pkg"
  52. else
  53. echo "missing '$pkg' at '$cfgid1'"
  54. fi
  55. done
  56. for flist in "$dir1/var/adm/flists/"*; do
  57. pkg="${flist#$dir1/var/adm/flists/}"
  58. if [ ! -f "$dir0/var/adm/flists/$pkg" ]; then
  59. echo "missing '$pkg' at '$cfgid0'"
  60. fi
  61. done
  62. }
  63. bd0= bd1=
  64. find build/$config-*/ -maxdepth 0 -type d 2> /dev/null | while read -r builddir; do
  65. if [ -z "$bd0" ]; then
  66. # first builddir
  67. bd0="$builddir"
  68. elif [ -z "$bd1" ]; then
  69. # second builddir
  70. bd1="$builddir"
  71. else
  72. # third or another builddir, rotate
  73. bd0="$bd1"
  74. bd1="$builddir"
  75. fi
  76. if [ -n "$bd0" -a -n "$bd1" ]; then
  77. compare_builddirs "$config" "$bd0" "$bd1"
  78. fi
  79. done