
- added compress-level parameter to select a compression level for file writing and changed the default for lz4 compression to do a better job compressing. finished splitting glz input routines apart from glz output routines and did a bit of other restructuring. removed gzxfile struct-as-bytevector wrapper and moved its fd into glzFile. moved DEACTIVATE to before glzdopen_input calls in S_new_open_input_fd and S_compress_input_fd, since glzdopen_input reads from the file and could block. the compress format and now level are now recorded directly the thread context. replaced as-gz? flag bit in compressed bytevector header word with a small number of bits recording the compression format at the bottom of the header word. flushed a couple of bytevector compression mats that depended on the old representation. (these last few changes should make adding new compression formats easier.) added s-directory build options to choose whether to compress and, if so, the format and level. compress-io.h, compress-io.c, new-io.c, equates.h, system.h, scheme.c, gc.c, io.ss, cmacros.ss, back.ss, bytevector.ss, primdata.ss, s/Mf-base, io.ms, mat.ss, bytevector.ms, root-experr*, release_notes.stex, io.stex, system.stex, objects.stex - improved the effectiveness of LZ4 boot-file compression to within 15% of gzip by increasing the lz4 output-port in_buffer size to 1<<18. With the previous size (1<<14) LZ4-compressed boot files were about 50% larger. set the lz4 input-port in_buffer and out_buffer sizes to 1<<12 and 1<<14. there's no clear win at present for larger input-port buffer sizes. compress-io.c - To reduce the memory hit for the increased output-port in_buffer size and the corresponding increase in computed out_buffer size, one output-side out_buffer is now allocated (lazily) per thread and stored in the thread context. The other buffers are now directly a part of the lz4File_out and lz4File_in structures rather than allocated separately. compress-io.c, scheme.c, gc.c, cmacros.ss - split out the buffer emit code from glzwrite_lz4 into a separate glzemit_lz4 helper that is now also used by gzclose so we can avoid dealing with a NULL buffer in glzwrite_lz4. glzwrite_lz4 also uses it to writing large buffers directly and avoid the memcpy. compress-io.c - replaced lz4File_out and lz4File_in mode enumeration with the compress format and inputp boolean. using switch to check and raising exceptions for unexpected values to further simplify adding new compression formats in the future. compress-io.c - replaced the never-defined struct lz4File pointer in glzFile union with the more specific struct lz4File_in_r and Lz4File_out_r pointers. compress-io.h, compress-io.c - added free of lz4 structures to gzclose. also changed file-close logic generally so that (1) port is marked closed before anything is freed to avoid dangling pointers in the case of an interrupt or error, and (2) structures are freed even in the case of a write or close error, before the error is reported. also now mallocing glz and lz4 structures after possibility of errors have passed where possible and freeing them when not. compress-io.c, io.ss - added return-value checks to malloc calls and to a couple of other C-library calls. compress-io.c - corrected EINTR checks to look at errno rather than return codes. compress-io.c - added S_ prefixes to the glz* exports externs.h, compress-io.c, new-io.c, scheme.c, fasl.c - added entries for mutex-name and mutex-thread threads.stex original commit: 722ffabef4c938bc92c0fe07f789a9ba350dc6c6
345 lines
8.0 KiB
Tcsh
Executable File
345 lines
8.0 KiB
Tcsh
Executable File
#! /bin/csh -f
|
|
|
|
# checkin
|
|
# Copyright 1984-2017 Cisco Systems, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
if ($#argv != 1) then
|
|
echo "Usage: checkin <workarea name>"
|
|
exit 1
|
|
endif
|
|
|
|
# set M to machine type and W to workarea name
|
|
set W = $1
|
|
if (!(-d $W)) then
|
|
echo "Workarea ./$W not found."
|
|
exit 1
|
|
endif
|
|
|
|
set M = $W/boot/*/.
|
|
if ($status || $#M != 1) then
|
|
echo "Cannot determine machine type."
|
|
exit 1
|
|
endif
|
|
|
|
set M = $M:h
|
|
set M = $M:t
|
|
|
|
onintr error
|
|
|
|
# This shell script checks sources and binaries in from a workarea to
|
|
# the release directory. Invoke with the name of a machine type and
|
|
# an optional workarea name. The workarea name defaults to the machine
|
|
# type.
|
|
|
|
set BACKUPDIR = $cwd:h/backup
|
|
if (!(-d $BACKUPDIR)) then
|
|
echo "creating backup directory $BACKUPDIR"
|
|
mkdir $BACKUPDIR || goto error
|
|
endif
|
|
|
|
echo -n "have you updated $W/LOG? [y]: "
|
|
set RESPONSE = $<
|
|
if ("$RESPONSE" != "y" && "$RESPONSE" != "") goto error
|
|
|
|
if (-e $W/scheme.1.in) then
|
|
cmp scheme.1.in $W/scheme.1.in >& /dev/null
|
|
if ($status != 0) then
|
|
echo -n "Did you update the date in $W/scheme.1.in? [y]: "
|
|
set RESPONSE = $<
|
|
if ("$RESPONSE" != "y" && "$RESPONSE" != "") goto error
|
|
endif
|
|
endif
|
|
|
|
set tmpsdirs = (. c mats s examples unicode makefiles csug release_notes wininstall bintar rpm pkg)
|
|
set sdirs = ()
|
|
foreach x ($tmpsdirs)
|
|
if (!(-e $x)) then
|
|
echo "ERROR: ./$x does not exist"
|
|
goto error
|
|
endif
|
|
if (!(-d $x)) then
|
|
echo "ERROR: ./$x is not a directory"
|
|
goto error
|
|
endif
|
|
test -d $W/$x && set sdirs = ($sdirs $x)
|
|
end
|
|
|
|
set tmpbdirs = (bin/$M boot/$M)
|
|
set bdirs = ()
|
|
foreach x ($tmpbdirs)
|
|
if ((-e $x) && !(-d $x)) then
|
|
echo "ERROR: ./$x is not a directory"
|
|
goto error
|
|
endif
|
|
test -d $W/$x && set bdirs = ($bdirs $x)
|
|
end
|
|
|
|
echo '*** running "make clean" in source directories ***'
|
|
foreach x ($sdirs)
|
|
switch ($x)
|
|
case .:
|
|
case unicode:
|
|
case unicode/UNIDATA:
|
|
case makefiles:
|
|
case csug:
|
|
case release_notes:
|
|
breaksw
|
|
case c:
|
|
case s:
|
|
case mats:
|
|
case benchmarks:
|
|
case examples:
|
|
case wininstall:
|
|
case bintar:
|
|
case rpm:
|
|
case pkg:
|
|
(cd $W/$x; make clean >& /dev/null)
|
|
breaksw
|
|
default:
|
|
echo "checkin error: unexpected sdir $x"
|
|
goto error
|
|
endsw
|
|
end
|
|
|
|
set ignorefiles = ()
|
|
|
|
set tmpsfiles = ()
|
|
foreach x ($sdirs)
|
|
set y = `(cd $W; find $x/* -type f -print -o -type d -prune)`
|
|
set tmpsfiles = ($tmpsfiles $y)
|
|
end
|
|
|
|
set sfiles = ()
|
|
foreach x ($tmpsfiles)
|
|
if ("$x" == "./Makefile" || "$x" == "./Mf-install" || "$x" == "./Mf-boot" || "$x" == "c/config.h" || "$x" == "c/Mf-config") then
|
|
set ignorefiles = ($ignorefiles $x)
|
|
else
|
|
cmp $W/$x $x >& /dev/null
|
|
if ($status == 0) then
|
|
set ignorefiles = ($ignorefiles $x)
|
|
else
|
|
set sfiles = ($sfiles $x)
|
|
endif
|
|
endif
|
|
end
|
|
|
|
if ($#sfiles == 0) echo "*** no source files found in ./$W ***"
|
|
|
|
set tmpbfiles = ()
|
|
foreach x ($bdirs)
|
|
set y = `(cd $W; find $x/* -type f -print -o -type d -prune)`
|
|
set tmpbfiles = ($tmpbfiles $y)
|
|
end
|
|
|
|
set bfiles = ()
|
|
foreach x ($tmpbfiles)
|
|
cmp $W/$x $x >& /dev/null
|
|
if ($status == 0) then
|
|
set ignorefiles = ($ignorefiles $x)
|
|
else
|
|
set bfiles = ($bfiles $x)
|
|
endif
|
|
end
|
|
|
|
if ($#bfiles == 0) echo "*** no binary files found in ./$W ***"
|
|
|
|
if ($#sfiles == 0 && $#bfiles == 0) goto delete
|
|
|
|
set tmpsfiles = ($sfiles)
|
|
set sfiles = ()
|
|
foreach x ($tmpsfiles)
|
|
if ($x:h == ".") then
|
|
set xpretty = $x:t
|
|
else
|
|
set xpretty = $x
|
|
endif
|
|
if (-e $x) then
|
|
set comment = ""
|
|
else
|
|
set comment = " new"
|
|
endif
|
|
echo -n "check in$comment source file $W/$xpretty? [y]: "
|
|
set RESPONSE = $<
|
|
if ("$RESPONSE" == "" || "$RESPONSE" == "y") set sfiles = ($sfiles $x)
|
|
end
|
|
|
|
set tmpbfiles = ($bfiles)
|
|
set bfiles = ()
|
|
foreach x ($tmpbfiles)
|
|
if (-e $x) then
|
|
set comment = ""
|
|
else
|
|
set comment = " new"
|
|
endif
|
|
echo -n "check in$comment binary file $W/$x? [y]: "
|
|
set RESPONSE = $<
|
|
if ("$RESPONSE" == "" || "$RESPONSE" == "y") set bfiles = ($bfiles $x)
|
|
end
|
|
|
|
set RESPONSE = ""
|
|
while ("$RESPONSE" != "y")
|
|
echo -n "proceed with check in? (y/n): "
|
|
set RESPONSE = $<
|
|
if ("$RESPONSE" == "n") exit 0
|
|
end
|
|
|
|
set oldsfiles = ()
|
|
foreach x ($sfiles)
|
|
if (-e $x) set oldsfiles = ($oldsfiles $x)
|
|
end
|
|
if ($#oldsfiles != 0) then
|
|
echo "backing up old versions of source files"
|
|
if (!(-f $BACKUPDIR/seqno)) then
|
|
set seqno = 0
|
|
else
|
|
set seqno = `cat $BACKUPDIR/seqno`
|
|
endif
|
|
set backuproot = $BACKUPDIR/$seqno
|
|
@ seqno = $seqno + 1
|
|
echo $seqno > $BACKUPDIR/seqno
|
|
echo "backup directory is $backuproot"
|
|
mkdir $backuproot || goto error
|
|
set n = 4
|
|
echo -n " "
|
|
foreach x ($oldsfiles)
|
|
set i = `echo "$x" | wc -c`
|
|
@ n = $n + $i + 1
|
|
if ($n > 78) then
|
|
echo ""
|
|
echo -n " "
|
|
@ n = $i + 4
|
|
endif
|
|
echo -n "$x "
|
|
set y = $backuproot/$x:h
|
|
if (!(-d $y)) then
|
|
mkdir -p $y || goto error
|
|
endif
|
|
rm -f $y/$x:t || goto error
|
|
mv $x $y || goto error
|
|
gzip $y/$x:t || goto error
|
|
end
|
|
echo ""
|
|
endif
|
|
|
|
set oldbfiles = ()
|
|
foreach x ($bfiles)
|
|
if (-e $x) set oldbfiles = ($oldbfiles $x)
|
|
end
|
|
if ($#oldbfiles != 0) then
|
|
echo "deleting old versions of binary files"
|
|
set n = 4
|
|
echo -n " "
|
|
foreach x ($oldbfiles)
|
|
set i = `echo "$x" | wc -c`
|
|
@ n = $n + $i + 1
|
|
if ($n > 78) then
|
|
echo ""
|
|
echo -n " "
|
|
@ n = $i + 4
|
|
endif
|
|
echo -n "$x "
|
|
rm -f $x || goto error
|
|
end
|
|
echo ""
|
|
endif
|
|
|
|
if ($#sfiles != 0) then
|
|
echo "moving new source files to release directory"
|
|
set n = 4
|
|
echo -n " "
|
|
foreach x ($sfiles)
|
|
set i = `echo "$x" | wc -c`
|
|
@ n = $n + $i + 1
|
|
if ($n > 78) then
|
|
echo ""
|
|
echo -n " "
|
|
@ n = $i + 4
|
|
endif
|
|
echo -n "$x "
|
|
mv $W/$x $x || goto error
|
|
end
|
|
echo ""
|
|
endif
|
|
|
|
if ($#bfiles != 0) then
|
|
echo "moving new binary files to release directory"
|
|
set n = 4
|
|
echo -n " "
|
|
foreach x ($bfiles)
|
|
set i = `echo "$x" | wc -c`
|
|
@ n = $n + $i + 1
|
|
if ($n > 78) then
|
|
echo ""
|
|
echo -n " "
|
|
@ n = $i + 4
|
|
endif
|
|
echo -n "$x "
|
|
if (!(-e $x:h)) mkdir -p $x:h || goto error
|
|
mv $W/$x $x || goto error
|
|
end
|
|
echo ""
|
|
endif
|
|
|
|
delete:
|
|
|
|
set tmpfiles = `(cd $W; find . -name zlib -prune -o -name lz4 -prune -o -type f -print)`
|
|
set files = ()
|
|
foreach x ($tmpfiles)
|
|
set files = ($x $files)
|
|
set tmpignorefiles = ($ignorefiles)
|
|
while ($#tmpignorefiles)
|
|
if ($x == ./$tmpignorefiles[1] || $x == $tmpignorefiles[1]) then
|
|
shift files
|
|
break
|
|
endif
|
|
shift tmpignorefiles
|
|
end
|
|
end
|
|
|
|
if ($#files == 0) then
|
|
set delete = "y"
|
|
else
|
|
set delete = "n"
|
|
echo "*** new or modified files remain in ./$W"
|
|
set n = 4
|
|
echo -n " "
|
|
foreach x ($files)
|
|
set i = `echo "$x" | wc -c`
|
|
@ n = $n + $i + 1
|
|
if ($n > 78) then
|
|
echo ""
|
|
echo -n " "
|
|
@ n = $i + 4
|
|
endif
|
|
echo -n "$x "
|
|
end
|
|
echo ""
|
|
endif
|
|
|
|
echo -n "delete ./$W? [$delete]: "
|
|
set RESPONSE = $<
|
|
if ("$RESPONSE" == "") set RESPONSE = $delete
|
|
if ("$RESPONSE" == "y") then
|
|
rm -rf $W || goto error
|
|
endif
|
|
|
|
exit 0
|
|
|
|
error:
|
|
|
|
echo ""
|
|
echo "quitting (error occurred)."
|
|
exit 1
|