Commit 7e2a98ee authored by Raymond Toy's avatar Raymond Toy
Browse files

Allow disabling the use of git for the file-comment.

 * src/compiler/main.lisp:
   * Add *FILE-COMMENT-FROM-GIT* to control whether to use git to
     derive the file-comment.  Default is T.  Otherwise, the actual
     file-comment is used.
   * Update PROCESS-FILE-COMMENT to use *FILE-COMMENT-FROM-GIT*.

 * bin/build-all.sh
 * bin/build.sh
 * bin/build-world.sh
   * Add -G option to control whether file-comment's are derived from
     git.
parent 44abdb52
......@@ -35,12 +35,13 @@ usage ()
echo " -P On the last build, (re)generate cmucl.pot and the"
echo " translations"
echo " -R Force recompilation of C runtime"
echo " -G Don't use git to fill file-comment information"
}
CREATE_OPT=""
UPDATE_POT="-P"
while getopts "PRUB:b:v:C:o:8:?" arg
while getopts "PRUGB:b:v:C:o:8:?" arg
do
case $arg in
b) BASE="$OPTARG" ;;
......@@ -53,6 +54,7 @@ do
U) UPDATE_TRANS="-U" ;;
P) UPDATE_POT="" ;;
R) RECOMPILEC="-R" ;;
G) GIT_FILE_COMMENT="-G" ;;
\?) usage; exit 1 ;;
esac
done
......@@ -87,15 +89,15 @@ buildx86 ()
if [ -n "$OLD8" ]; then
# Build non-unicode versions
set -x
$BINDIR/build.sh -f x87 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLD8"
$BINDIR/build.sh -f sse2 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLD8"
$BINDIR/build.sh -f x87 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLD8"
$BINDIR/build.sh -f sse2 -b ${BASE}-8bit $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLD8"
set +x
fi
# Build the unicode versions
if [ -n "$OLDLISP" ]; then
set -x
$BINDIR/build.sh -f x87 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLDLISP"
$BINDIR/build.sh -f sse2 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLDLISP"
$BINDIR/build.sh -f x87 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLDLISP"
$BINDIR/build.sh -f sse2 -b ${BASE} $bootfiles ${VERSION:+-v "$VERSION"} -C "${CREATE_OPT}" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLDLISP"
set +x
fi
}
......@@ -108,13 +110,13 @@ buildsun4 ()
# Build non-unicode versions
if [ -n "$OLD8" ]; then
set -x
$BINDIR/build.sh -b ${BASE}-8bit $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLD8"
$BINDIR/build.sh -b ${BASE}-8bit $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLD8"
set +x
fi
# Build the unicode version.
if [ -n "$OLDLISP" ]; then
set -x
$BINDIR/build.sh -b ${BASE} $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} -o "$OLDLISP"
$BINDIR/build.sh -b ${BASE} $bootfiles ${VERS} -C "$CREATE_OPT" ${UPDATE_TRANS} ${UPDATE_POT} ${RECOMPILEC} ${GIT_FILE_COMMENT} -o "$OLDLISP"
set +x
fi
}
......
......@@ -26,6 +26,12 @@ if [ -n "$MAKE_POT" ]; then
SAVEPOT='(intl::dump-pot-files :output-directory "default:src/i18n/locale/")'
fi
if [ "$GIT_FILE_COMMENT" = "no" ]; then
GIT_FILE_COMMENT="(setf c::*file-comment-from-git* nil)"
else
GIT_FILE_COMMENT=
fi
$LISP "$@" -noinit -nositeinit <<EOF
(in-package :cl-user)
......@@ -56,6 +62,8 @@ $LISP "$@" -noinit -nositeinit <<EOF
(setq debug:*debug-print-level* nil)
(setq debug:*debug-print-length* nil)
$GIT_FILE_COMMENT
(load "target:tools/worldcom")
#-(or no-compiler runtime) (load "target:tools/comcom")
;; Compile at least new-genesis, so that genesis doesn't take ages
......@@ -64,7 +72,6 @@ $LISP "$@" -noinit -nositeinit <<EOF
$GETFMT
$SAVEPOT
(setq *gc-verbose* t *interactive* t)
(load "target:tools/worldbuild")
......
......@@ -45,6 +45,8 @@ BINDIR=bin
TOOLDIR=$BINDIR
OLDLISPFLAGS="-noinit -nositeinit"
OLDLISP="cmulisp"
GIT_FILE_COMMENT="yes"
export GIT_FILE_COMMENT
SKIPUTILS=no
......@@ -66,7 +68,7 @@ fi
usage ()
{
echo "build.sh [-123obvuBCU?]"
echo "build.sh [-123obvuBCUG?]"
echo " -1 Skip build 1"
echo " -2 Skip build 2"
echo " -3 Skip build 3"
......@@ -96,6 +98,7 @@ usage ()
echo " The flags always include -noinit -nositeinit"
echo " -R Force recompiling the C runtime. Normally, just runs make to "
echo " recompile anything that has changed."
echo " -G Don't use git to fill file-comment information"
exit 1
}
......@@ -152,7 +155,7 @@ BUILDWORLD="$TOOLDIR/build-world.sh"
BUILD_POT="yes"
UPDATE_TRANS=
while getopts "123PRo:b:v:uB:C:Ui:f:w:O:?" arg
while getopts "123PRGo:b:v:uB:C:Ui:f:w:O:?" arg
do
case $arg in
1) ENABLE2="no" ;;
......@@ -172,6 +175,7 @@ do
U) UPDATE_TRANS="yes";;
O) OLDLISPFLAGS="$OLDLISPFLAGS $OPTARG" ;;
R) REBUILD_LISP="yes";;
G) GIT_FILE_COMMENT="no";;
\?) usage
;;
esac
......
......@@ -1094,34 +1094,41 @@
;;;
;;; Stash file comment in the file-info structure.
;;;
(defvar *file-comment-from-git* t
"If non-Nil, use git to derive the file-comment. This info includes
the sha1 hash, the time and the author of the change. Otherwise,
just use the supplied file-comment.")
(defun process-file-comment (form)
(unless (and (= (length form) 2) (stringp (second form)))
(compiler-error _N"Bad FILE-COMMENT form: ~S." form))
(let ((file (first (source-info-current-file *source-info*))))
(labels
((run-git (path)
(let ((cwd (default-directory))
(new (make-pathname :directory (pathname-directory path))))
(unwind-protect
(progn
;; Cd to the directory containing the file so that
;; git can find the git repo, if available.
(setf (default-directory) new)
;; Run git to get the info. Don't signal any
;; errors if we can't find git and discard any
;; error messages from git. We only use the
;; result if git returns a zero exit code, anyway.
(handler-case
(run-program "git"
(list "log"
"-1"
"--pretty=format:%h %ai %an"
(namestring path))
:output :stream
:error nil)
(error ()
nil)))
(setf (default-directory) cwd))))
(when *file-comment-from-git*
(let ((cwd (default-directory))
(new (make-pathname :directory (pathname-directory path))))
(unwind-protect
(progn
;; Cd to the directory containing the file so that
;; git can find the git repo, if available.
(setf (default-directory) new)
;; Run git to get the info. Don't signal any
;; errors if we can't find git and discard any
;; error messages from git. We only use the
;; result if git returns a zero exit code, anyway.
(handler-case
(run-program "git"
(list "log"
"-1"
"--pretty=format:%h %ai %an"
(namestring path))
:output :stream
:error nil)
(error ()
nil)))
(setf (default-directory) cwd)))))
(generate-comment (file-info)
(let* ((name (pathname (source-info-stream file-info)))
(proc (run-git name))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment