1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
Description: Use a temporary directory to build, run the make.sh script under errexit. Closes: #850879
Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
Bug-Debian: https://bugs.debian.org/850879
Forwarded: https://github.com/DataTables/DataTablesSrc/issues/91
Reviewed-By: Yadd <yadd@debian.org>
Last-Update: 2022-03-03
--- a/build/include.sh
+++ b/build/include.sh
@@ -5,6 +5,8 @@
CLOSURE="/usr/local/closure_compiler/compiler.jar"
JSHINT="/usr/bin/jshint"
+TMPDIR="$(mktemp --directory --tmpdir "jquery-datatables.$$.XXXXX")"
+trap "rm -rf \"$TMPDIR\"" EXIT
# CSS styling frameworks that DataTables supports
FRAMEWORKS=(
@@ -123,23 +125,23 @@
# Closure Compiler doesn't support "important" comments so we add a
# @license jsdoc comment to the license block to preserve it
- cp $DIR/$FILE.$COMP_EXTN /tmp/$FILE.$COMP_EXTN
- perl -i -0pe "s/^\/\*! (.*)$/\/** \@license \$1/s" /tmp/$FILE.$COMP_EXTN
+ cp $DIR/$FILE.$COMP_EXTN $TMPDIR/$FILE.$COMP_EXTN
+ perl -i -0pe "s/^\/\*! (.*)$/\/** \@license \$1/s" $TMPDIR/$FILE.$COMP_EXTN
- rm /tmp/closure_error.log
- java -jar $CLOSURE --charset 'utf-8' --language_out=ES5 --js /tmp/$FILE.$COMP_EXTN > /tmp/$FILE.min.$COMP_EXTN 2> /tmp/closure_error.log
+ rm $TMPDIR/closure_error.log
+ java -jar $CLOSURE --charset 'utf-8' --language_out=ES5 --js $TMPDIR/$FILE.$COMP_EXTN > $TMPDIR/$FILE.min.$COMP_EXTN 2> $TMPDIR/closure_error.log
- if [ -e /tmp/closure_error.log ]; then
+ if [ -e $TMPDIR/closure_error.log ]; then
if [ -z "$LOG" -o "$LOG" = "on" ]; then
- cat /tmp/closure_error.log
+ cat $TMPDIR/closure_error.log
fi
fi
# And add the important comment back in
- perl -i -0pe "s/^\/\*/\/*!/s" /tmp/$FILE.min.$COMP_EXTN
+ perl -i -0pe "s/^\/\*/\/*!/s" $TMPDIR/$FILE.min.$COMP_EXTN
- mv /tmp/$FILE.min.$COMP_EXTN $DIR/$FILE.min.$COMP_EXTN
- rm /tmp/$FILE.$COMP_EXTN
+ mv $TMPDIR/$FILE.min.$COMP_EXTN $DIR/$FILE.min.$COMP_EXTN
+ rm $TMPDIR/$FILE.$COMP_EXTN
echo_msg " File size: $(ls -l $DIR/$FILE.min.$COMP_EXTN | awk -F" " '{ print $5 }')"
fi
@@ -159,9 +161,10 @@
IFS='%'
cp $IN_FILE $IN_FILE.build
- grep "_buildInclude('" $IN_FILE.build > /dev/null
+ CODE=0
+ grep "_buildInclude('" $IN_FILE.build > /dev/null || CODE=$?
- while [ $? -eq 0 ]; do
+ while [ $CODE -eq 0 ]; do
REQUIRE=$(grep "_buildInclude('" $IN_FILE.build | head -n 1)
SPACER=$(echo ${REQUIRE} | cut -d _ -f 1)
@@ -175,7 +178,7 @@
rm ${DIR}/${FILE}.build
- grep "_buildInclude('" $IN_FILE.build > /dev/null
+ grep "_buildInclude('" $IN_FILE.build > /dev/null || CODE=$?
done
mv $IN_FILE.build $OUT
--- a/build/make.sh
+++ b/build/make.sh
@@ -40,9 +40,10 @@
OLD_IFS=$IFS
IFS='%'
cp $IN_FILE DataTables.js.build
- grep "_buildInclude('" DataTables.js.build > /dev/null
+ CODE=0
+ grep "_buildInclude('" DataTables.js.build > /dev/null || CODE=$?
- while [ $? -eq 0 ]; do
+ while [ $CODE -eq 0 ]; do
REQUIRE=$(grep "_buildInclude('" DataTables.js.build | head -n 1)
SPACER=$(echo ${REQUIRE} | cut -d _ -f 1)
@@ -56,7 +57,7 @@
rm ${DIR}/${FILE}.build
- grep "_buildInclude('" DataTables.js.build > /dev/null
+ grep "_buildInclude('" DataTables.js.build > /dev/null || CODE=$?
done
mv DataTables.js.build $OUT_FILE
@@ -76,7 +77,7 @@
js_compress $OUT_FILE
- cp jquery.js $OUT_DIR
+ #cp jquery.js $OUT_DIR
cp integration/* $OUT_DIR
# Compress the integration files
|