Admin/setup
changeset 73759 c259c7a42ac3
parent 73757 c582bf975a5b
child 73760 a35b2ee3148f
equal deleted inserted replaced
73758:eda1d95ef538 73759:c259c7a42ac3
    23   echo "    -C           force clean working directory (no backup!)"
    23   echo "    -C           force clean working directory (no backup!)"
    24   echo "    -R           version is current official release"
    24   echo "    -R           version is current official release"
    25   echo "    -U URL       Isabelle repository server (default: \"$ISABELLE_REPOS\")"
    25   echo "    -U URL       Isabelle repository server (default: \"$ISABELLE_REPOS\")"
    26   echo "    -V PATH      version from explicit file or directory (file \"ISABELLE_VERSION\")"
    26   echo "    -V PATH      version from explicit file or directory (file \"ISABELLE_VERSION\")"
    27   echo "    -c           check clean working directory"
    27   echo "    -c           check clean working directory"
       
    28   echo "    -f           fresh build of Isabelle/Scala/jEdit"
       
    29   echo "    -n           no build of Isabelle/Scala/jEdit"
    28   echo "    -r REV       version according to Mercurial notation"
    30   echo "    -r REV       version according to Mercurial notation"
    29   echo "    -u           version is remote tip"
    31   echo "    -u           version is remote tip"
    30   echo
    32   echo
    31   echo "  Setup the current ISABELLE_HOME directory, which needs to be a"
    33   echo "  Setup the current ISABELLE_HOME directory, which needs to be a"
    32   echo "  repository clone (all versions) or repository archive (fixed version)."
    34   echo "  repository clone (all versions) or repository archive (fixed version)."
    43 
    45 
    44 ## process command line
    46 ## process command line
    45 
    47 
    46 #options
    48 #options
    47 
    49 
       
    50 BUILD_OPTIONS="-b"
       
    51 
    48 CLEAN_FORCE=""
    52 CLEAN_FORCE=""
    49 CLEAN_CHECK=""
    53 CLEAN_CHECK=""
    50 
    54 
    51 VERSION=""
    55 VERSION=""
    52 VERSION_RELEASE=""
    56 VERSION_RELEASE=""
    53 VERSION_PATH=""
    57 VERSION_PATH=""
    54 VERSION_REV=""
    58 VERSION_REV=""
    55 
    59 
    56 while getopts "CRU:V:cr:u" OPT
    60 while getopts "CRU:V:cfnr:u" OPT
    57 do
    61 do
    58   case "$OPT" in
    62   case "$OPT" in
    59     C)
    63     C)
    60       CLEAN_FORCE="--clean"
    64       CLEAN_FORCE="--clean"
    61       ;;
    65       ;;
    74       VERSION_PATH="$OPTARG"
    78       VERSION_PATH="$OPTARG"
    75       VERSION_REV=""
    79       VERSION_REV=""
    76       ;;
    80       ;;
    77     c)
    81     c)
    78       CLEAN_CHECK="--check"
    82       CLEAN_CHECK="--check"
       
    83       ;;
       
    84     f)
       
    85       BUILD_OPTIONS="-b -f"
       
    86       ;;
       
    87     n)
       
    88       BUILD_OPTIONS=""
    79       ;;
    89       ;;
    80     r)
    90     r)
    81       VERSION="true"
    91       VERSION="true"
    82       VERSION_RELEASE=""
    92       VERSION_RELEASE=""
    83       VERSION_PATH=""
    93       VERSION_PATH=""
   104 
   114 
   105 
   115 
   106 ## main
   116 ## main
   107 
   117 
   108 if [ -z "$VERSION" ]; then
   118 if [ -z "$VERSION" ]; then
   109   "$ISABELLE_HOME/bin/isabelle" components -I && \
   119   "$ISABELLE_HOME/bin/isabelle" components -I || exit "?$"
   110   "$ISABELLE_HOME/bin/isabelle" components -a
   120   "$ISABELLE_HOME/bin/isabelle" components -a || exit "?$"
       
   121   if [ -n "$BUILD_OPTIONS" ]; then
       
   122     "$ISABELLE_HOME/bin/isabelle" jedit $BUILD_OPTIONS
       
   123   fi
   111 elif [ ! -d "$ISABELLE_HOME/.hg" ]; then
   124 elif [ ! -d "$ISABELLE_HOME/.hg" ]; then
   112   fail "Not a repository clone: cannot specify version"
   125   fail "Not a repository clone: cannot specify version"
   113 else
   126 else
   114   if [ -n "$VERSION_REV" ]; then
   127   if [ -n "$VERSION_REV" ]; then
   115     REV="$VERSION_REV"
   128     REV="$VERSION_REV"
   133   export HGPLAIN=
   146   export HGPLAIN=
   134 
   147 
   135   "$ISABELLE_HOME/bin/isabelle" components -I || exit "$?"
   148   "$ISABELLE_HOME/bin/isabelle" components -I || exit "$?"
   136 
   149 
   137   #Atomic exec: avoid inplace update of running script!
   150   #Atomic exec: avoid inplace update of running script!
   138   export CLEAN REV ISABELLE_REPOS
   151   export CLEAN REV ISABELLE_REPOS BUILD_OPTIONS
   139   exec bash -c '
   152   exec bash -c '
   140     set -e
   153     set -e
   141     "${HG:-hg}" -R "$ISABELLE_HOME" pull -r "$REV" "$ISABELLE_REPOS"
   154     "${HG:-hg}" -R "$ISABELLE_HOME" pull -r "$REV" "$ISABELLE_REPOS"
   142     "${HG:-hg}" -R "$ISABELLE_HOME" update -r "$REV" $CLEAN_FORCE $CLEAN_CHECK
   155     "${HG:-hg}" -R "$ISABELLE_HOME" update -r "$REV" $CLEAN_FORCE $CLEAN_CHECK
   143     "$ISABELLE_HOME/bin/isabelle" components -a
   156     "$ISABELLE_HOME/bin/isabelle" components -a
       
   157     if [ -n "$BUILD_OPTIONS" ]; then
       
   158       "$ISABELLE_HOME/bin/isabelle" jedit $BUILD_OPTIONS
       
   159     fi
   144     "${HG:-hg}" -R "$ISABELLE_HOME" log -r "$REV"
   160     "${HG:-hg}" -R "$ISABELLE_HOME" log -r "$REV"
   145     if [ ! -f "$ISABELLE_HOME/Admin/setup" ]; then
   161     if [ ! -f "$ISABELLE_HOME/Admin/setup" ]; then
   146       echo >&2 "### The Admin/setup script has disappeared in this version"
   162       echo >&2 "### The Admin/setup script has disappeared in this version"
   147       echo >&2 "### (need to invoke \"${HG:-hg} update\" before using it again)"
   163       echo >&2 "### (need to invoke \"${HG:-hg} update\" before using it again)"
   148     fi
   164     fi