Re: [isabelle-dev] Modest proposal for image tagging

2011-07-13 Thread Alexander Krauss

On 07/12/2011 01:18 PM, Makarius wrote:

On Tue, 12 Jul 2011, Alexander Krauss wrote:


sed -i 's/THE_VERSION/$(hg id)/g' version.ML
isabelle usedir ...

Actually, a similar thing happens when an isabelle distribution is
built from a repository clone.


Alex needs to do this because he his crunching on the official sources.


Just to avoid misunderstandings: I am not doing this, but was referring 
to the makedist script: 
http://isabelle.in.tum.de/repos/isabelle/file/Isabelle2011/Admin/makedist#l171.


The mira framework works more like approach B), as it keeps metadata in 
its own database.



val my_id = getenv MY_ID;

In the latter case you have your own settings (potentially via user
components with etc/settings) to ensure that the environment variable is
present at build time.


This is probably the easiest approach discussed so far.

Alex
___
isabelle-dev mailing list
isabelle-...@in.tum.de
https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev


Re: [isabelle-dev] Modest proposal for image tagging

2011-07-11 Thread Makarius

On Mon, 11 Jul 2011, Rafal Kolanski wrote:


The problem:

There exist situations whereupon we find ourselves with an Isabelle image 
file without knowing what exactly it is.


One such situation is using wwwfind to present multiple images on multiple 
ports. One cannot expect users to remember which is which just based on the 
port number. It is much more useful to have the image name in the title.


Combined with a regression test system which automatically refreshes such 
images, it is also pertinent to know which repository revision the particular 
image was built from. This is also true when copying images between machines 
that would normally take hours to build (e.g. grabbing them from the 
regression test server in the morning).


Isabelle (well, the normal release one) currently does not have such a 
feature.


Have you seen structure Distribution in the ML context?  The 
Session.welcome message is also based on that.  WWW_Find just needs to 
provide this information to the client.


Concerning confusion of image files etc., it is basically your job to 
organize them in directories such that others find them again.  The 
standard settings of official releases or snapshots already include the 
ISABELLE_IDENTIFIER as directory prefix for ISABELLE_HOME_USER.  Other 
directory schemes can be done similarly in user space.


No tagging like that happens when you have a private repository clone, 
though.  By definition, private things are not shared with others, so 
there is no confusion. (Nonetheless there is isabelle version -i to tell 
about local repository state in the manner of Mercurial, with optional + 
signs etc. to indicate uncommitted stuff.)



BTW, I am currently formalizing many aspects of Isabelle management of 
system resources (images etc.) by producing official Isabelle/Scala 
library functions.  After some initial uncertainty, it has become clear 
that there is an implicit assumption that all contributing parts are from 
exactly the same Isabelle version.  In general, you cannot have robust 
tools that work with images from other versions, so no attempt is made in 
that direction.



Makarius
___
isabelle-dev mailing list
isabelle-...@in.tum.de
https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev


[isabelle-dev] Modest proposal for image tagging

2011-07-10 Thread Rafal Kolanski

Dear Isabelle Developers,

The problem:

There exist situations whereupon we find ourselves with an Isabelle 
image file without knowing what exactly it is.


One such situation is using wwwfind to present multiple images on 
multiple ports. One cannot expect users to remember which is which just 
based on the port number. It is much more useful to have the image name 
in the title.


Combined with a regression test system which automatically refreshes 
such images, it is also pertinent to know which repository revision the 
particular image was built from. This is also true when copying images 
between machines that would normally take hours to build (e.g. grabbing 
them from the regression test server in the morning).


Isabelle (well, the normal release one) currently does not have such a 
feature.


An approach:

Now, Makarius will doubtless tell me I've done it wrong, but within our 
project I have added a global val image_identifier string in every 
image which at least has the name of the image, along with any other 
identifying features. Then I added the -I option to isabelle usedir 
which allows one to specify those identifying features. I then modified 
wwwfind to display this string in the title.


So for example, when we build one of our images, we use:
IMAGE_IDENTIFIER_TAG = `hg log -l 1 --template '{node} {date|isodate}\n' 
-r .`
USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -I 
$(IMAGE_IDENTIFIER_TAG)


Then if we connect to our wwwfind server on a given port, the title reads:
Find Theorems: CREFINE (7a95fca6ca33e071fd1c948a559898af7e21697e 
2011-06-24 20:11 +1000)


If we pull the image off the server, we can also get this string by 
evaluating image_identifier.


I think that this style of feature would be really nice in Isabelle. I 
am also attaching a patch for Isabelle 2009-1 for your consideration.


If there is interest, I can port it to 2011, but I'd like to get some 
feedback first.


Sincerely,

Rafal Kolanski.
summary: Added image_identifier functionality to isabelle images.

diff --git a/lib/Tools/usedir b/lib/Tools/usedir
--- a/lib/Tools/usedir
+++ b/lib/Tools/usedir
@@ -33,6 +33,7 @@
   echo -s NAME  override session NAME
   echo -t BOOL  internal session timing (default false)
   echo -v BOOL  be verbose (default false)
+  echo -I STRINGadd STRING to image_identifier val in image (default \\)
   echo
   echo   Build object-logic or run examples. Also creates browsing
   echo   information (HTML etc.) according to settings.
@@ -87,11 +88,12 @@
 PARALLEL_PROOFS=1
 TIMING=false
 VERBOSE=false
+IMAGE_IDENTIFIER_TAG=
 
 function getoptions()
 {
   OPTIND=1
-  while getopts C:D:M:P:T:V:bd:f:g:i:m:p:q:rs:t:v: OPT
+  while getopts C:D:M:P:T:V:bd:f:g:i:m:p:q:rs:t:v:I: OPT
   do
 case $OPT in
   C)
@@ -169,6 +171,9 @@
 check_bool $OPTARG
 VERBOSE=$OPTARG
 ;;
+  I)
+IMAGE_IDENTIFIER_TAG= ($OPTARG)
+;;
   \?)
 usage
 ;;
@@ -236,7 +241,7 @@
   LOG=$LOGDIR/$ITEM
 
   $ISABELLE_PROCESS \
--e Session.use_dir \$ITEM\ \$ROOT_FILE\ true [$MODES] $RESET $INFO \$DOC\ $DOCUMENT_GRAPH [$DOCUMENT_VERSIONS] \$PARENT\ \$SESSION\ ($COPY_DUMP, \$DUMP\) \$RPATH\ $PROOFS $TIMING $VERBOSE $MAXTHREADS $TRACETHREADS $PARALLEL_PROOFS; \
+-e val image_identifier = \${NAME}${IMAGE_IDENTIFIER_TAG}\; Session.use_dir \$ITEM\ \$ROOT_FILE\ true [$MODES] $RESET $INFO \$DOC\ $DOCUMENT_GRAPH [$DOCUMENT_VERSIONS] \$PARENT\ \$SESSION\ ($COPY_DUMP, \$DUMP\) \$RPATH\ $PROOFS $TIMING $VERBOSE $MAXTHREADS $TRACETHREADS $PARALLEL_PROOFS; \
 -q -w $LOGIC $NAME  $LOG
   RC=$?
 else
diff --git a/src/Pure/mk b/src/Pure/mk
--- a/src/Pure/mk
+++ b/src/Pure/mk
@@ -93,6 +93,7 @@
 -e use\$COMPAT\ handle _ = exit 1; \
 -e structure Isar = struct fun main () = () end; \
 -e ml_prompts \ML \ \ML# \; \
+-e val image_identifier = \RAW\; \
 -q -w RAW_ML_SYSTEM RAW  $LOG 21
   RC=$?
 elif [ -n $RAW_SESSION ]; then
@@ -114,6 +115,7 @@
 -e val ml_platform = \$ML_PLATFORM\; \
 -e (use\$COMPAT\; use\ROOT.ML\) handle _ = exit 1; \
 -e ml_prompts \ML \ \ML# \; \
+-e val image_identifier = \Pure\; \
 -f -q -w RAW_ML_SYSTEM Pure  $LOG 21
   RC=$?
 fi
diff --git a/src/Tools/WWW_Find/find_theorems.ML b/src/Tools/WWW_Find/find_theorems.ML
--- a/src/Tools/WWW_Find/find_theorems.ML
+++ b/src/Tools/WWW_Find/find_theorems.ML
@@ -66,7 +66,9 @@
 
 fun html_header thy_name args =
   html { lang = en } [
-head { title = Find Theorems: results, stylesheet_href = /basic.css }
+(* use global image_identifier which should be defined in all images *)
+head { title = Find Theorems:  ^ image_identifier,
+   stylesheet_href = /basic.css }
  [script (noid, { script_type=text/javascript,
   src=/find_theorems.js })],
 add_script (OnLoad, encodequery(document.getElementById('query')))

___
isabelle-dev