script_setup.ksh 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #!/bin/ksh
  2. #
  3. # script_setup.ksh
  4. #
  5. ########################################################################
  6. #set -x
  7. ##########################################################################
  8. ##########################################################################
  9. #
  10. # Common global code
  11. #
  12. ##########################################################################
  13. ##########################################################################
  14. umask 002
  15. TEMPORARY_FILES=""
  16. trap '/bin/rm -f $TEMPORARY_FILES; exit 1' INT QUIT TERM
  17. do_exit ()
  18. {
  19. do_delete_temporary_files
  20. exit $1
  21. }
  22. do_delete_temporary_files ()
  23. {
  24. if [ -n "$TEMPORARY_FILES" ]; then
  25. /bin/rm -f $TEMPORARY_FILES
  26. TEMPORARY_FILES=""
  27. fi
  28. }
  29. do_register_temporary_file ()
  30. {
  31. if [ -n "$1" ]; then
  32. if [ -z "$TEMPORARY_FILES" ]; then
  33. TEMPORARY_FILES="$1"
  34. else
  35. TEMPORARY_FILES="$TEMPORARY_FILES $1"
  36. fi
  37. fi
  38. }
  39. do_check_file ()
  40. {
  41. # $1 = the file to check
  42. # $2 = file flag (e.g. "x" for -x, "f" for -f, etc.
  43. # #3 = error message
  44. case $2 in
  45. -x) if [ ! -x $1 ]; then
  46. print -u2 "Exiting ... Executable '$1 $3"
  47. do_exit 1
  48. fi ;;
  49. -d) if [ ! -d $1 ]; then
  50. print -u2 "Exiting ... Directory '$1 $3"
  51. do_exit 1
  52. fi ;;
  53. -f) if [ ! -f $1 ]; then
  54. print -u2 "Exiting ... File '$1 $3"
  55. do_exit 1
  56. fi ;;
  57. -L) if [ ! -L $1 ]; then
  58. print -u2 "Exiting ... Sym link '$1 $3"
  59. do_exit 1
  60. fi ;;
  61. *) print -u2 "Exiting ... '$1' NOT found!"
  62. do_exit 1 ;;
  63. esac
  64. }
  65. ##########################################################################
  66. ##########################################################################
  67. #
  68. # Directory and executable paths.
  69. #
  70. CLEAR_CASE_TOOL=/usr/atria/bin/cleartool
  71. if [ "" = "$PROJECT_NAME" ]; then
  72. LOG_DIR_BASE=/project/dt/logs/build
  73. else
  74. LOG_DIR_BASE=/project/${PROJECT_NAME}/logs/build
  75. fi
  76. ##########################################################################
  77. #
  78. # Initialize the scripts and data files
  79. #
  80. BUILD_PROJECT=$SCRIPTS_DIR/build_project
  81. BUILD_SUMMARY=$SCRIPTS_DIR/build_summary
  82. BUILD_WORLD=$SCRIPTS_DIR/build_world
  83. COMPONENT_FILE="-c $SCRIPTS_DIR/cde.components"
  84. COMPRESS_MSG=$SCRIPTS_DIR/compress_msg
  85. EXTRACT_LOG=$SCRIPTS_DIR/extract_log
  86. EXTRACT_MSG=$SCRIPTS_DIR/extract_msg
  87. INITIALIZE_VIEW=$SCRIPTS_DIR/initialize_view
  88. CDE_COMPONENTS=$SCRIPTS_DIR/cde.components
  89. CDEDOC_COMPONENTS=$SCRIPTS_DIR/cdedoc.components
  90. CDETEST_COMPONENTS=$SCRIPTS_DIR/cdetest.components
  91. MOTIF_COMPONENTS=$SCRIPTS_DIR/motif.components
  92. X_COMPONENTS=$SCRIPTS_DIR/x11.components
  93. BUILD_MSGS=$SCRIPTS_DIR/dt_make.msg
  94. ERROR_MSGS=$SCRIPTS_DIR/dt_errors.msg
  95. IGNORE_MSGS=$SCRIPTS_DIR/dt_ignore.msg
  96. WARNING_MSGS=$SCRIPTS_DIR/dt_warnings.msg
  97. ##########################################################################
  98. #
  99. # Strings used in the Subject line of mailed reports
  100. #
  101. SUBJECT_BUILD_SUMMARY="CDE: Build Summary"
  102. SUBJECT_SUBMISSIONS="CDE: Submissions"
  103. SUBJECT_CHECKOUTS="CDE: Check-Outs"
  104. SUBJECT_BUILD_COMPLETE="CDE: Build Complete"
  105. SUBJECT_DATE='+%m/%d/%y'
  106. ##########################################################################
  107. #
  108. # Build Strings marking information extracted by the build_summary script.
  109. #
  110. BTAG_CMPL="BUILD COMPLETE"
  111. BTAG_CFGS="BUILD CFG SPEC"
  112. BTAG_DATE="BUILD DATE "
  113. BTAG_DFMT="+%a %h %d, %H:%M"
  114. BTAG_LOGD="BUILD LOG DIR "
  115. BTAG_PRJT="BUILD PROJECT "
  116. BTAG_PTFM="BUILD PLATFORM"
  117. BTAG_TYPE="BUILD TYPE "
  118. BTAG_VIEW="BUILD VIEW "
  119. BTAG_ENDD="BUILD ENDED "
  120. BTAG_LOGF="LOG FILE "
  121. BTAG_STRT="BUILD STARTED "
  122. BTAG_SYST="SYSTEM "
  123. ##########################################################################
  124. #
  125. # TOP of project development hierarchies
  126. #
  127. X_TOP=/proj/x11/xc
  128. MOTIF_TOP=/proj/motif
  129. CDE_TOP=/proj/cde
  130. CDEDOC_TOP=/proj/cde
  131. CDETEST_TOP=/proj/cde-test
  132. ##########################################################################
  133. #
  134. # Mail aliases for the project groups
  135. #
  136. TRW_MAIL_ALIAS="devtrw"
  137. CDE_MAIL_ALIAS="devobj"
  138. X_MAIL_ALIAS="devobj"