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.

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