Admin/init
author desharna
Tue, 16 May 2023 14:16:20 +0200
changeset 78102 f40bc75b2a3f
parent 73705 ac07f6be27ea
permissions -rwxr-xr-x
replaced some lemmas' implicit formulas by explicit ones to avoid silent changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     2
#
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     4
#
73514
01acd0eb29ce clarified name;
wenzelm
parents: 73508
diff changeset
     5
# DESCRIPTION: initialize Isabelle repository clone or repository archive
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     6
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     7
73501
f026a9a0a43f proper Admin script, outside the settings environment;
wenzelm
parents: 73497
diff changeset
     8
## environment
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
     9
73705
ac07f6be27ea avoid unexpected output+behaviour when CDPATH is set
kleing
parents: 73640
diff changeset
    10
unset CDPATH
73501
f026a9a0a43f proper Admin script, outside the settings environment;
wenzelm
parents: 73497
diff changeset
    11
export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    12
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    13
ISABELLE_REPOS="https://isabelle.sketis.net/repos/isabelle"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    14
73501
f026a9a0a43f proper Admin script, outside the settings environment;
wenzelm
parents: 73497
diff changeset
    15
f026a9a0a43f proper Admin script, outside the settings environment;
wenzelm
parents: 73497
diff changeset
    16
## diagnostics
f026a9a0a43f proper Admin script, outside the settings environment;
wenzelm
parents: 73497
diff changeset
    17
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    18
function usage()
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    19
{
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    20
  echo
73514
01acd0eb29ce clarified name;
wenzelm
parents: 73508
diff changeset
    21
  echo "Usage: Admin/init [OPTIONS]"
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    22
  echo
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    23
  echo "  Options are:"
73502
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
    24
  echo "    -C           force clean working directory (no backup!)"
73588
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    25
  echo "    -I NAME      set \$ISABELLE_HOME/etc/ISABELLE_IDENTIFIER (or reset via -I:)"
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    26
  echo "    -L           local history only: no pull from repository server"
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    27
  echo "    -R           version is current official release"
73515
wenzelm
parents: 73514
diff changeset
    28
  echo "    -U URL       Isabelle repository server"
wenzelm
parents: 73514
diff changeset
    29
  echo "                 (default: \"$ISABELLE_REPOS\")"
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    30
  echo "    -V PATH      version is taken from file, or directory"
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    31
  echo "                 with file \"ISABELLE_VERSION\""
73502
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
    32
  echo "    -c           check clean working directory"
73504
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
    33
  echo "    -f           fresh build of Isabelle/Scala/jEdit"
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
    34
  echo "    -n           no build of Isabelle/Scala/jEdit"
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    35
  echo "    -r REV       version given in Mercurial notation (changeset id or tag)"
73589
479e9b17090e clarified options (again);
wenzelm
parents: 73588
diff changeset
    36
  echo "    -u           update to latest tip"
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    37
  echo
73514
01acd0eb29ce clarified name;
wenzelm
parents: 73508
diff changeset
    38
  echo "  Initialize the current ISABELLE_HOME directory, which needs to be a"
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    39
  echo "  repository clone (all versions) or repository archive (fixed version)."
73515
wenzelm
parents: 73514
diff changeset
    40
  echo "  Download required components. Build Isabelle/Scala/jEdit by default."
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    41
  echo
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    42
  exit 1
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    43
}
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    44
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    45
function fail()
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    46
{
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    47
  echo "$1" >&2
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    48
  exit 2
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    49
}
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    50
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    51
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    52
## process command line
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    53
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    54
#options
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    55
73504
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
    56
BUILD_OPTIONS="-b"
73588
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    57
UPDATE_IDENTIFIER=""
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    58
IDENTIFIER=""
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    59
PULL="true"
73504
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
    60
73502
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
    61
CLEAN_FORCE=""
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
    62
CLEAN_CHECK=""
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    63
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    64
VERSION=""
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    65
VERSION_RELEASE=""
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    66
VERSION_PATH=""
73488
97692af929a4 more robust;
wenzelm
parents: 73487
diff changeset
    67
VERSION_REV=""
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    68
73589
479e9b17090e clarified options (again);
wenzelm
parents: 73588
diff changeset
    69
while getopts "CI:LRU:V:cfnr:u" OPT
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    70
do
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    71
  case "$OPT" in
73488
97692af929a4 more robust;
wenzelm
parents: 73487
diff changeset
    72
    C)
73502
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
    73
      CLEAN_FORCE="--clean"
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    74
      ;;
73588
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    75
    I)
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    76
      UPDATE_IDENTIFIER="true"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    77
      if [ "$OPTARG" = ":" ]; then
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    78
        IDENTIFIER=""
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    79
      else
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    80
        IDENTIFIER="$OPTARG"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    81
      fi
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
    82
      ;;
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    83
    L)
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    84
      PULL=""
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
    85
      ;;
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    86
    R)
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    87
      VERSION="true"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    88
      VERSION_RELEASE="true"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    89
      VERSION_PATH=""
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    90
      VERSION_REV=""
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    91
      ;;
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    92
    U)
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    93
      ISABELLE_REPOS="$OPTARG"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    94
      ;;
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    95
    V)
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    96
      VERSION="true"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    97
      VERSION_RELEASE=""
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
    98
      VERSION_PATH="$OPTARG"
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
    99
      VERSION_REV=""
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   100
      ;;
73502
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
   101
    c)
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
   102
      CLEAN_CHECK="--check"
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
   103
      ;;
73504
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   104
    f)
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   105
      BUILD_OPTIONS="-b -f"
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   106
      ;;
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   107
    n)
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   108
      BUILD_OPTIONS=""
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   109
      ;;
73488
97692af929a4 more robust;
wenzelm
parents: 73487
diff changeset
   110
    r)
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   111
      VERSION="true"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   112
      VERSION_RELEASE=""
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   113
      VERSION_PATH=""
73488
97692af929a4 more robust;
wenzelm
parents: 73487
diff changeset
   114
      VERSION_REV="$OPTARG"
97692af929a4 more robust;
wenzelm
parents: 73487
diff changeset
   115
      ;;
73589
479e9b17090e clarified options (again);
wenzelm
parents: 73588
diff changeset
   116
    u)
73492
8c93418ea257 more options;
wenzelm
parents: 73491
diff changeset
   117
      VERSION="true"
8c93418ea257 more options;
wenzelm
parents: 73491
diff changeset
   118
      VERSION_RELEASE=""
8c93418ea257 more options;
wenzelm
parents: 73491
diff changeset
   119
      VERSION_PATH=""
73493
827f53095f1c more robust: lest hg work out remote tip;
wenzelm
parents: 73492
diff changeset
   120
      VERSION_REV="tip"
73492
8c93418ea257 more options;
wenzelm
parents: 73491
diff changeset
   121
      ;;
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   122
    \?)
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   123
      usage
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   124
      ;;
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   125
  esac
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   126
done
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   127
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   128
shift $(($OPTIND - 1))
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   129
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   130
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   131
# args
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   132
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   133
[ "$#" -ne 0 ] && usage
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   134
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   135
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   136
## main
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   137
73588
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   138
if [ -f "$ISABELLE_HOME/etc/ISABELLE_IDENTIFIER" ]; then
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   139
  OLD_IDENTIFIER="$(cat "$ISABELLE_HOME/etc/ISABELLE_IDENTIFIER")"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   140
else
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   141
  OLD_IDENTIFIER=""
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   142
fi
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   143
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   144
if [ -n "$UPDATE_IDENTIFIER" -a "$IDENTIFIER" != "$OLD_IDENTIFIER" ]; then
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   145
  OLD_ISABELLE_HOME_USER="$("$ISABELLE_HOME/bin/isabelle" getenv -b ISABELLE_HOME_USER)"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   146
  if [ -n "$IDENTIFIER" ]; then
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   147
    echo -n "$IDENTIFIER" > "$ISABELLE_HOME/etc/ISABELLE_IDENTIFIER"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   148
  else
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   149
    rm -f "$ISABELLE_HOME/etc/ISABELLE_IDENTIFIER"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   150
  fi
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   151
  ISABELLE_HOME_USER="$("$ISABELLE_HOME/bin/isabelle" getenv -b ISABELLE_HOME_USER)"
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   152
  echo "Changed \$ISABELLE_HOME/etc/ISABELLE_IDENTIFIER: \"$OLD_IDENTIFIER\" ~> \"$IDENTIFIER\""
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   153
  echo "Changed \$ISABELLE_HOME_USER: \"$OLD_ISABELLE_HOME_USER\" ~> \"$ISABELLE_HOME_USER\""
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   154
fi
a96de8bbe8a3 more options: update ISABELLE_IDENTIFIER;
wenzelm
parents: 73584
diff changeset
   155
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   156
if [ -z "$VERSION" ]; then
73640
f4778e08dcd7 proper "$?";
wenzelm
parents: 73589
diff changeset
   157
  "$ISABELLE_HOME/bin/isabelle" components -I || exit "$?"
f4778e08dcd7 proper "$?";
wenzelm
parents: 73589
diff changeset
   158
  "$ISABELLE_HOME/bin/isabelle" components -a || exit "$?"
73504
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   159
  if [ -n "$BUILD_OPTIONS" ]; then
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   160
    "$ISABELLE_HOME/bin/isabelle" jedit $BUILD_OPTIONS
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   161
  fi
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   162
elif [ ! -d "$ISABELLE_HOME/.hg" ]; then
73515
wenzelm
parents: 73514
diff changeset
   163
  fail "Not a repository clone: cannot switch version"
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   164
else
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   165
  if [ -n "$VERSION_REV" ]; then
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   166
    REV="$VERSION_REV"
73491
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   167
  elif [ -n "$VERSION_RELEASE" ]; then
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   168
    URL="$ISABELLE_REPOS/raw-file/tip/Admin/Release/official"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   169
    REV="$(curl -s -f "$URL" | head -n1)"
dbe5bbc2331e clarified treatment of multiple versions: last one counts;
wenzelm
parents: 73490
diff changeset
   170
    [ -z "$REV" ] && fail "Failed to access \"$URL\""
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   171
  elif [ -f "$VERSION_PATH" ]; then
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   172
    REV="$(cat "$VERSION_PATH")"
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   173
  elif [ -d "$VERSION_PATH" ]; then
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   174
    if [ -f "$VERSION_PATH/ISABELLE_VERSION" ]; then
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   175
      REV="$(cat "$VERSION_PATH/ISABELLE_VERSION")"
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   176
    else
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   177
      fail "Missing file \"$VERSION_PATH/ISABELLE_VERSION\""
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   178
    fi
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   179
  else
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   180
    fail "Missing file \"$VERSION_PATH\""
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   181
  fi
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   182
73507
wenzelm
parents: 73506
diff changeset
   183
  "$ISABELLE_HOME/bin/isabelle" components -I || exit "$?"
wenzelm
parents: 73506
diff changeset
   184
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   185
  export LANG=C
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   186
  export HGPLAIN=
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   187
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   188
  #Atomic exec: avoid inplace update of running script!
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
   189
  export PULL CLEAN_FORCE CLEAN_CHECK REV ISABELLE_REPOS BUILD_OPTIONS
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   190
  exec bash -c '
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   191
    set -e
73584
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
   192
    if [ -n "$PULL" ]; then
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
   193
      "${HG:-hg}" -R "$ISABELLE_HOME" pull -r "$REV" "$ISABELLE_REPOS"
1d4c9fa00821 clarified options;
wenzelm
parents: 73517
diff changeset
   194
    fi
73502
c582bf975a5b more options;
wenzelm
parents: 73501
diff changeset
   195
    "${HG:-hg}" -R "$ISABELLE_HOME" update -r "$REV" $CLEAN_FORCE $CLEAN_CHECK
73501
f026a9a0a43f proper Admin script, outside the settings environment;
wenzelm
parents: 73497
diff changeset
   196
    "$ISABELLE_HOME/bin/isabelle" components -a
73504
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   197
    if [ -n "$BUILD_OPTIONS" ]; then
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   198
      "$ISABELLE_HOME/bin/isabelle" jedit $BUILD_OPTIONS
c259c7a42ac3 more options: build is part of default setup;
wenzelm
parents: 73502
diff changeset
   199
    fi
73489
9460f1f45405 more robust: explicit repository root;
wenzelm
parents: 73488
diff changeset
   200
    "${HG:-hg}" -R "$ISABELLE_HOME" log -r "$REV"
73514
01acd0eb29ce clarified name;
wenzelm
parents: 73508
diff changeset
   201
    if [ ! -f "$ISABELLE_HOME/Admin/init" ]; then
01acd0eb29ce clarified name;
wenzelm
parents: 73508
diff changeset
   202
      echo >&2 "### The Admin/init script has disappeared in this version"
73497
7cdcf131699d tuned message;
wenzelm
parents: 73496
diff changeset
   203
      echo >&2 "### (need to invoke \"${HG:-hg} update\" before using it again)"
73494
e16133a05458 clarified messages;
wenzelm
parents: 73493
diff changeset
   204
    fi
73487
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   205
  '
47f055b40ab9 more convenient repository setup;
wenzelm
parents:
diff changeset
   206
fi