Print this page
4030 remove useless nightly/bldenv options
Reviewed by: Andy Stormont <andyjstormont@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/scripts/bldenv.sh
          +++ new/usr/src/tools/scripts/bldenv.sh
↓ open down ↓ 34 lines elided ↑ open up ↑
  35   35          exit 1
  36   36  }
  37   37  
  38   38  function usage
  39   39  {
  40   40      OPTIND=0
  41   41      getopts -a "${progname}" "${USAGE}" OPT '-?'
  42   42      exit 2
  43   43  }
  44   44  
  45      -function is_source_build
  46      -{
  47      -        "${flags.s.e}" || "${flags.s.d}" || "${flags.s.h}" || "${flags.s.o}"
  48      -        return $?
  49      -}
  50      -
  51      -#
  52      -# single function for setting -S flag and doing error checking.
  53      -# usage: set_S_flag <type>
  54      -# where <type> is the source build type ("E", "D", ...).
  55      -#
  56      -function set_S_flag
  57      -{
  58      -        if is_source_build; then
  59      -                print 'Can only build one source variant at a time.'
  60      -                exit 1
  61      -        fi
  62      -        
  63      -        case "$1" in
  64      -                "E") flags.s.e=true ;;
  65      -                "D") flags.s.d=true ;;
  66      -                "H") flags.s.h=true ;;
  67      -                "O") flags.s.o=true ;;
  68      -                *)   usage ;;
  69      -        esac
  70      -}
  71      -
  72   45  typeset -r USAGE=$'+
  73   46  [-?\n@(#)\$Id: bldenv (OS/Net) 2008-04-06 \$\n]
  74   47  [-author?OS/Net community <tools-discuss@opensolaris.org>]
  75   48  [+NAME?bldenv - spawn shell for interactive incremental OS-Net
  76   49      consolidation builds]
  77   50  [+DESCRIPTION?bldenv is a useful companion to the nightly(1) script for
  78   51      doing interactive and incremental builds in a workspace
  79   52      already built with nightly(1). bldenv spawns a shell set up
  80   53      with the same environment variables taken from an env_file,
  81   54      as prepared for use with nightly(1).]
  82   55  [+?In addition to running a shell for interactive use, bldenv
  83   56      can optionally run a single command in the given environment,
  84   57      in the vein of sh -c or su -c. This is useful for
  85   58      scripting, when an interactive shell would not be. If the
  86   59      command is composed of multiple shell words or contains
  87   60      other shell metacharacters, it must be quoted appropriately.]
  88   61  [+?bldenv is particularly useful for testing Makefile targets
  89   62      like clobber, install and _msg, which otherwise require digging
  90   63      through large build logs to figure out what is being
  91   64      done.]
  92      -[+?bldenv is also useful if you run into build issues with the
  93      -    source product or when generating OpenSolaris deliverables.
  94      -    If a source product build is flagged, the environment is set
  95      -    up for building the indicated source product tree, which is
  96      -    assumed to have already been created. If the OpenSolaris
  97      -    deliverables flag (-O) is set in NIGHTLY_OPTIONS, the
  98      -    environment is set up for building just the open source.
  99      -    This includes using an alternate proto area, as well as
 100      -    using the closed binaries in $CODEMGR_WS/closed.skel (which
 101      -    is assumed to already exist).]
 102   65  [+?By default, bldenv will invoke the shell specified in
 103   66      $SHELL. If $SHELL is not set or is invalid, csh will be
 104   67      used.]
 105   68  [c?force the use of csh, regardless of the  value  of $SHELL.]
 106   69  [f?invoke csh with the -f (fast-start) option. This option is valid
 107   70      only if $SHELL is unset or if it points to csh.]
 108   71  [d?set up environment for doing DEBUG builds (default is non-DEBUG)]
 109   72  [t?set up environment to use the tools in usr/src/tools (this is the
 110   73      default, use +t to use the tools from /opt/onbld)]
 111      -[S]:[option?Build a variant of the source product.
 112      -The value of \aoption\a must be one of the following:]{
 113      -       [+E?build the exportable source variant of the source product.]
 114      -       [+D?build the domestic  source  (exportable + crypt) variant of
 115      -           the source product.]
 116      -       [+H?build hybrid source (binaries + deleted source).]
 117      -       [+O?simulate an OpenSolaris (open source only) build.]
 118      -}
 119   74  
 120   75  <env_file> [command]
 121   76  
 122   77  [+EXAMPLES]{
 123   78      [+?Example 1: Interactive use]{
 124   79          [+?Use bldenv to spawn a shell to perform  a  DEBUG  build  and
 125   80              testing of the  Makefile  targets  clobber and install for
 126   81              usr/src/cmd/true.]
 127   82          [+\n% rlogin wopr-2 -l gk
 128   83  {root::wopr-2::49} bldenv -d /export0/jg/on10-se.env
↓ open down ↓ 52 lines elided ↑ open up ↑
 181  136  while getopts -a "${progname}" "${USAGE}" OPT ; do 
 182  137      case ${OPT} in
 183  138            c)    flags.c=true  ;;
 184  139            +c)   flags.c=false ;;
 185  140            f)    flags.f=true  ;;
 186  141            +f)   flags.f=false ;;
 187  142            d)    flags.d=true  SUFFIX=""    ;;
 188  143            +d)   flags.d=false SUFFIX="-nd" ;;
 189  144            t)    flags.t=true  ;;
 190  145            +t)   flags.t=false ;;
 191      -          S)    set_S_flag "$OPTARG" ;;
 192  146            \?)   usage ;;
 193  147      esac
 194  148  done
 195  149  shift $((OPTIND-1))
 196  150  
 197  151  # test that the path to the environment-setting file was given
 198  152  if (( $# < 1 )) ; then
 199  153          usage
 200  154  fi
 201  155  
↓ open down ↓ 64 lines elided ↑ open up ↑
 266  220  # STDENV_END
 267  221  
 268  222  # Check if we have sufficient data to continue...
 269  223  [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
 270  224  [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
 271  225  [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
 272  226  
 273  227  # must match the getopts in nightly.sh
 274  228  OPTIND=1
 275  229  NIGHTLY_OPTIONS="-${NIGHTLY_OPTIONS#-}"
 276      -while getopts '+0AaBCDdFfGIilMmNnOopRrS:tUuWwXxz' FLAG "$NIGHTLY_OPTIONS"
      230 +while getopts '+0AaBCDdFfGIilMmNnopRrtUuWwXxz' FLAG "$NIGHTLY_OPTIONS"
 277  231  do
 278  232          case "$FLAG" in
 279      -          O)    flags.O=true  ;;
 280      -          +O)   flags.O=false ;;
 281  233            o)    flags.o=true  ;;
 282  234            +o)   flags.o=false ;;
 283  235            t)    flags.t=true  ;;
 284  236            +t)   flags.t=false ;;
 285      -          S)    set_S_flag "$OPTARG" ;;
 286  237            *)    ;;
 287  238          esac
 288  239  done
 289  240  
 290  241  POUND_SIGN="#"
 291  242  # have we set RELEASE_DATE in our env file?
 292  243  if [ -z "$RELEASE_DATE" ]; then
 293  244          RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
 294  245  fi
 295  246  BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
↓ open down ↓ 10 lines elided ↑ open up ↑
 306  257          unset EXTRA_OPTIONS
 307  258          unset EXTRA_CFLAGS
 308  259  else
 309  260          # default is a non-DEBUG build
 310  261          print 'non-DEBUG'
 311  262          export RELEASE_BUILD=
 312  263          unset EXTRA_OPTIONS
 313  264          unset EXTRA_CFLAGS
 314  265  fi
 315  266  
 316      -[[ "${flags.O}" == "true" ]] && export MULTI_PROTO="yes"
 317      -
 318  267  # update build-type variables
 319  268  PKGARCHIVE="${PKGARCHIVE}${SUFFIX}"
 320  269  
 321      -# Append source version
 322      -if "${flags.s.e}" ; then
 323      -        VERSION+=":EXPORT"
 324      -        SRC="${EXPORT_SRC}/usr/src"
 325      -fi
 326      - 
 327      -if "${flags.s.d}" ; then
 328      -        VERSION+=":DOMESTIC"
 329      -        SRC="${EXPORT_SRC}/usr/src"
 330      -fi
 331      -
 332      -if "${flags.s.h}" ; then
 333      -        VERSION+=":HYBRID"
 334      -        SRC="${EXPORT_SRC}/usr/src"
 335      -fi
 336      - 
 337      -if "${flags.s.o}" ; then
 338      -        VERSION+=":OPEN_ONLY"
 339      -        SRC="${OPEN_SRCDIR}/usr/src"
 340      -fi
 341      -
 342  270  #       Set PATH for a build
 343  271  PATH="/opt/onbld/bin:/opt/onbld/bin/${MACH}:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/etc:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
 344  272  if [[ "${SUNWSPRO}" != "" ]]; then 
 345  273          export PATH="${SUNWSPRO}/bin:$PATH" 
 346  274  fi 
 347  275  
 348  276  TOOLS="${SRC}/tools"
 349  277  TOOLS_PROTO="${TOOLS}/proto/root_${MACH}-nd" ; export TOOLS_PROTO
 350  278  
 351  279  if "${flags.t}" ; then
↓ open down ↓ 51 lines elided ↑ open up ↑
 403  331  
 404  332  if [[ "$MULTI_PROTO" != "yes" && "$MULTI_PROTO" != "no" ]]; then
 405  333          printf \
 406  334              'WARNING: invalid value for MULTI_PROTO (%s); setting to "no".\n' \
 407  335              "$MULTI_PROTO"
 408  336          export MULTI_PROTO="no"
 409  337  fi
 410  338  
 411  339  [[ "$MULTI_PROTO" == "yes" ]] && export ROOT="${ROOT}${SUFFIX}"
 412  340  
 413      -if "${flags.O}" ; then 
 414      -        print "OpenSolaris closed binary generation requires "
 415      -        print "closed tree"
 416      -        exit 1
 417      -fi
 418      -
 419  341  ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib"
 420  342  ENVCPPFLAGS1="-I$ROOT/usr/include"
 421  343  MAKEFLAGS=e
 422  344  
 423  345  export \
 424  346          ENVLDLIBS1 \
 425  347          ENVLDLIBS2 \
 426  348          ENVLDLIBS3 \
 427  349          ENVCPPFLAGS1 \
 428  350          ENVCPPFLAGS2 \
↓ open down ↓ 47 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX