Compare commits
16 Commits
bb6cb783cc
...
1ac4d7a596
Author | SHA1 | Date |
---|---|---|
Martin Scheidt | 1ac4d7a596 | |
Martin Scheidt | 42dd769fcf | |
Martin Scheidt | bb1f41080a | |
Martin Scheidt | 864d0dfb87 | |
Martin Scheidt | 5afacf62fc | |
Martin Scheidt | 8f7ecbc04b | |
Martin Scheidt | c317a8dc0c | |
Martin Scheidt | 07de619804 | |
Martin Scheidt | 520d94848a | |
Martin Scheidt | 6c64c241c9 | |
Martin Scheidt | 7bfdbfacfc | |
Martin Scheidt | d0710c39f2 | |
Martin Scheidt | 4567a56fa2 | |
Martin Scheidt | 1a9fa2ea68 | |
Martin Scheidt | cc0c6306f0 | |
Martin Scheidt | 4974780cf5 |
|
@ -23,9 +23,6 @@ jobs:
|
|||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: "change ImageMagick policy to allow pdf->png conversion"
|
||||
run: sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
|
||||
|
||||
- name: "install ghostscript"
|
||||
run: sudo apt-get install -y ghostscript
|
||||
|
||||
|
@ -43,23 +40,22 @@ jobs:
|
|||
# with:
|
||||
# requirements-file: .github/tex/packages.test.txt
|
||||
# ##
|
||||
- name: "setup TeX Live (via teatimeguest)"
|
||||
uses: teatimeguest/setup-texlive-action@v2
|
||||
with:
|
||||
package-file: .github/tex/packages.test.txt
|
||||
##
|
||||
# - name: "setup TeX Live (via paolobrasolin)"
|
||||
# # # tlmgr needs updates and fails
|
||||
# uses: paolobrasolin/setup-texlive-action@v1
|
||||
# - name: "setup TeX Live (via teatimeguest)"
|
||||
# uses: teatimeguest/setup-texlive-action@v2
|
||||
# with:
|
||||
# profile-path: ${{ github.workspace }}/.github/tex/texlive.profile.txt
|
||||
# packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt
|
||||
# package-file: .github/tex/packages.test.txt
|
||||
# ##
|
||||
- name: "setup TeX Live (via paolobrasolin)"
|
||||
uses: paolobrasolin/setup-texlive-action@v1
|
||||
with:
|
||||
profile-path: ${{ github.workspace }}/.github/tex/texlive.profile.txt
|
||||
packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt
|
||||
|
||||
# - name: "install tikz-trackschematic"
|
||||
# run: ./build.sh --local-dev-install
|
||||
# run: ./build.sh --noninteractive --install-dev
|
||||
|
||||
# - name: "test tikz-trackschematic"
|
||||
# run: ./build.sh --test
|
||||
# run: ./build.sh --noninteractive --test --verbose
|
||||
|
||||
# ## create varibale ${{ steps.tag.outputs.tag }}
|
||||
# - name: "get tag"
|
||||
|
@ -70,11 +66,10 @@ jobs:
|
|||
# strip_v: false
|
||||
|
||||
# - name: "create tikz-trackschematic package"
|
||||
# run: ./build.sh --release ${{ steps.tag.outputs.tag }} --batch-mode
|
||||
# run: ./build.sh --noninteractive --release ${{ steps.tag.outputs.tag }}
|
||||
|
||||
## opening a debug console
|
||||
- name: Setup upterm session
|
||||
uses: lhotari/action-upterm@v1
|
||||
with:
|
||||
## limits ssh access and adds the ssh public keys of the listed GitHub users
|
||||
limit-access-to-users: railtoolkit,kaat0,apriljunge
|
||||
limit-access-to-actor: true
|
||||
|
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
strip_v: false
|
||||
|
||||
- name: "create tikz-trackschematic package"
|
||||
run: ./build.sh --batch-mode --release ${{ steps.tag.outputs.tag }}
|
||||
run: ./build.sh --noninteractive --release ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: "create release"
|
||||
id: create_release
|
||||
|
|
|
@ -24,9 +24,6 @@ jobs:
|
|||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: "change ImageMagick policy to allow pdf->png conversion"
|
||||
run: sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
|
||||
|
||||
- name: "install ghostscript"
|
||||
run: sudo apt-get install -y ghostscript
|
||||
|
||||
|
@ -37,7 +34,7 @@ jobs:
|
|||
packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt
|
||||
|
||||
- name: "install tikz-trackschematic"
|
||||
run: ./build.sh --batch-mode --local-dev-install
|
||||
run: ./build.sh --noninteractive --install-dev
|
||||
|
||||
- name: "test tikz-trackschematic"
|
||||
run: ./build.sh --test --verbose
|
||||
run: ./build.sh --noninteractive --test --verbose
|
||||
|
|
|
@ -277,4 +277,5 @@ Temporary Items
|
|||
.apdisk
|
||||
|
||||
# Archives for upload
|
||||
*.zip
|
||||
tikz-trackschematic-*.zip
|
||||
release-note-*.md
|
460
build.sh
460
build.sh
|
@ -20,9 +20,17 @@ install, test or release a package for tikz-trackschematic
|
|||
|
||||
-v, --verbose Run script in verbose mode.
|
||||
|
||||
-b, --batch-mode Run script with no interaction.
|
||||
-m, --messy Do not clean up afterwards.
|
||||
|
||||
-l, --local-dev-install Install as dev-package in local TeX Live environment
|
||||
-n, --noninteractive Run script with no interaction.
|
||||
|
||||
-i, --install-dev Install as dev-package in local TeX Live environment
|
||||
The -i option overrides any previous -u options.
|
||||
|
||||
-u, --uninstall-dev Deinstall dev-package from local TeX Live environment
|
||||
The -u option overrides any previous -i options.
|
||||
|
||||
-u, --uninstall-dev Deinstall dev-package from local TeX Live environment
|
||||
|
||||
-t, --test Tests the current src/ against the test/
|
||||
|
||||
|
@ -33,18 +41,12 @@ EOF
|
|||
}
|
||||
|
||||
## -- processes getopts
|
||||
|
||||
# run variables
|
||||
VERBOSE=0 # set by cli argument
|
||||
BATCHMODE=0 # set by cli argument
|
||||
INSTALL=0 # set by cli argument
|
||||
TESTING=0 # set by cli argument
|
||||
RELEASE=0 # set by cli argument
|
||||
#
|
||||
CONVERT=0 # set by check_imagemagick_policy
|
||||
CLEANUP=0 # set by check_imagemagick_policy
|
||||
#
|
||||
ERROR_OCCURRED=0
|
||||
VERBOSE=0 # set by cli argument
|
||||
NOINTERACT=0 # set by cli argument
|
||||
INSTALL=0 # set by cli argument
|
||||
TESTING=0 # set by cli argument
|
||||
RELEASE=0 # set by cli argument
|
||||
CLEANUP=1 # set by cli argument
|
||||
|
||||
process_arguments() {
|
||||
while true; do
|
||||
|
@ -61,12 +63,18 @@ process_arguments() {
|
|||
-v|--verbose)
|
||||
VERBOSE=1
|
||||
;;
|
||||
-b|--batch-mode)
|
||||
BATCHMODE=1
|
||||
-m|--messy)
|
||||
CLEANUP=0
|
||||
;;
|
||||
-l|--local-dev-install)
|
||||
-n|--noninteractive)
|
||||
NOINTERACT=1
|
||||
;;
|
||||
-i|--install-dev)
|
||||
INSTALL=1
|
||||
;;
|
||||
-u|--uninstall-dev)
|
||||
INSTALL=2
|
||||
;;
|
||||
-t|--test)
|
||||
TESTING=1
|
||||
;;
|
||||
|
@ -92,6 +100,13 @@ process_arguments() {
|
|||
done
|
||||
}
|
||||
|
||||
## -- run variables
|
||||
#
|
||||
PDFTOPPM_CONVERT=0 # set by check_pdftoppm
|
||||
POLICY_MOD=0 # set by check_imagemagick_policy
|
||||
#
|
||||
ERROR_OCCURRED=0
|
||||
|
||||
## -- colors
|
||||
RED="\033[0;31m"
|
||||
GREEN="\033[0;32m"
|
||||
|
@ -119,6 +134,8 @@ check_path() {
|
|||
fi
|
||||
}
|
||||
|
||||
## checks for installed software
|
||||
|
||||
check_zip() {
|
||||
# check for zip
|
||||
STATUS=0
|
||||
|
@ -135,12 +152,181 @@ check_zip() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
check_sudo() {
|
||||
# checks if sudo is available
|
||||
rootrun=""
|
||||
# If we are root, we do note require sudo
|
||||
if [ "$EUID" = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "you are root"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if sudo -v >/dev/null 2>&1; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "sudo ok"
|
||||
fi
|
||||
rootrun="sudo"
|
||||
else
|
||||
echo "sudo failed"
|
||||
# Check if user is root (might be unnecessary)
|
||||
if ! [ $(id -u) = 0 ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_texlive() {
|
||||
# check for kpsewhich (and mktexlsr)
|
||||
STATUS=0
|
||||
command -v kpsewhich >/dev/null 2>&1 || STATUS=1
|
||||
command -v mktexlsr >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "kpsewhich and mktexlsr found"
|
||||
fi
|
||||
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'kpsewhich' not found."
|
||||
echo "Be sure to use texlive or mactex!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_pdflatex() {
|
||||
# check for pdflatex
|
||||
STATUS=0
|
||||
command -v pdflatex >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "pdflatex found"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'pdflatex' not found."
|
||||
echo "Be sure to have texlive or mactex installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_imagemagick() {
|
||||
# check for ImageMagick/compare
|
||||
STATUS=0
|
||||
command -v compare >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "compare found"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'compare' not found."
|
||||
echo "Be sure to have ImageMagick installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_pdftoppm() {
|
||||
# check for poppler/pdftoppm
|
||||
STATUS=0
|
||||
command -v pdftoppm >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "pdftoppm found"
|
||||
fi
|
||||
PDFTOPPM_CONVERT=1
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'pdftoppm' not found."
|
||||
# exit 1
|
||||
}
|
||||
|
||||
check_imagemagick_policy() {
|
||||
STATUS=1
|
||||
convert -list policy | grep -q "pattern: PDF" || STATUS=0
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "ImageMagick allows to convert PDFs. Great!"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "ImageMagick does not allow to convert PDFs."
|
||||
fi
|
||||
|
||||
## check for alternative
|
||||
check_pdftoppm # if pdftoppm is available, then PDFTOPPM_CONVERT=1
|
||||
|
||||
if [ $PDFTOPPM_CONVERT = 0 ]; then
|
||||
## modify ImageMagick-6/policy.xml
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo ""
|
||||
echo "Be sure to have either poppler(-utils) installed or an ImageMagick policy which allows for PDF conversion!"
|
||||
echo "Do you wish to temporaly remove the policy preventing ImageMagick from converting PDFs?"
|
||||
echo $n "(y/n) $c"
|
||||
while true; do
|
||||
read -p "" answer
|
||||
case $answer in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit 1;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
check_sudo
|
||||
|
||||
POLICY_PATH=$(convert -list policy | grep "Path" | awk "NR==1" | cut -d " " -f2) # default /etc/ImageMagick-*/policy.xml
|
||||
if [ ! -d $POLICY_PATH ]; then
|
||||
VERSION=$(convert --version | grep "Version" | cut -d " " -f3 | cut -d "." -f1 )
|
||||
POLICY_PATH="/etc/ImageMagick-${VERSION}/policy.xml"
|
||||
if [ ! -d $POLICY_PATH ]; then
|
||||
echo "${RED}ImageMagick policy is preventing converting PDFs to PNGs and${COLOR_RESET}"
|
||||
echo "${RED}program 'pdftoppm' was not found.${COLOR_RESET}"
|
||||
echo "${RED}Modifying the policy temporaly failed!${COLOR_RESET}"
|
||||
echo "${RED}Be sure to have either poppler(-utils) installed or${COLOR_RESET}"
|
||||
echo "${RED}an ImageMagick policy which allows for PDF conversion!${COLOR_RESET}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
POLICY_MOD=1
|
||||
$rootrun sed -i".backup" 's/^.*policy.*coder.*none.*PDF.*//' $POLICY_PATH
|
||||
echo "Modified ${POLICY_PATH}!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_trackschematic() {
|
||||
# check for tikz-trackschematic
|
||||
STATUS=0
|
||||
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
||||
DEVDIR=$(find $TEXMFLOCAL -name 'tikz-trackschematic-dev')
|
||||
|
||||
ls $DEVDIR/tikz-trackschematic-dev.sty >> /dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "tikz-trackschematic-dev found"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Library 'tikz-trackschematic-dev' not found."
|
||||
echo "Be sure to have tikz-trackschematic-dev installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
## checks for updated repository
|
||||
|
||||
check_version_number() {
|
||||
while true; do
|
||||
# loop condition - test format of $VERSION_STR:
|
||||
echo "$VERSION_STR" | egrep -q "v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)?" && break;
|
||||
# loop test
|
||||
if [ "$BATCHMODE" = 0 ]; then
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo "${RED}Your version '$VERSION_STR' has not the correct format!${COLOR_RESET}"
|
||||
echo $n "Please specify as Semantic Versioning ( e.g. v1.0.0 ): $c"
|
||||
read VERSION_STR
|
||||
|
@ -239,7 +425,7 @@ check_url2() {
|
|||
echo "WARNING: URL for [Unreleased] in CHANGELOG.md does not reflect the current version $VERSION_NUM."
|
||||
echo "WARNING: Be sure to edit CHANGELOG.md and specify current version!"
|
||||
|
||||
if [ "$BATCHMODE" -eq 0 ]; then
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo "Do you wish to continue without updated URL for [Unreleased]?"
|
||||
echo $n "(y/n) $c"
|
||||
while true; do
|
||||
|
@ -256,8 +442,14 @@ check_url2() {
|
|||
fi
|
||||
}
|
||||
|
||||
## functionality
|
||||
|
||||
create_release() {
|
||||
if [ $BATCHMODE = 0 ]; then
|
||||
####
|
||||
# This function produces a .zip-file in accordance to the requirements for CTAN.
|
||||
# For more information see https://ctan.org/help/upload-pkg.
|
||||
####
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo ""
|
||||
echo "Do you wish to create a release for the version $VERSION_NUM?"
|
||||
echo $n "(y/n) $c"
|
||||
|
@ -327,7 +519,7 @@ create_release() {
|
|||
}
|
||||
|
||||
create_release_notes() {
|
||||
if [ $BATCHMODE = 0 ]; then
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo ""
|
||||
echo "Do you wish to create a release notes for the version $VERSION_NUM?"
|
||||
echo $n "(y/n) $c"
|
||||
|
@ -351,106 +543,6 @@ create_release_notes() {
|
|||
# extract the excerpt
|
||||
awk "NR>$TOP&&NR<$BOTTOM" CHANGELOG.md > release-note-$VERSION_STR.md
|
||||
sedi "s/###/##/g" release-note-$VERSION_STR.md
|
||||
|
||||
|
||||
## -- cleanup
|
||||
# remove TMP-file
|
||||
rm release-note-tmp.md
|
||||
}
|
||||
|
||||
check_sudo() {
|
||||
# checks if sudo is available
|
||||
rootrun=""
|
||||
# If we are root, we do note require sudo
|
||||
if [ "$EUID" = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "you are root"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if sudo -v >/dev/null 2>&1; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "sudo ok"
|
||||
fi
|
||||
rootrun="sudo"
|
||||
else
|
||||
echo "sudo failed"
|
||||
# Check if user is root (might be unnecessary)
|
||||
if ! [ $(id -u) = 0 ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_texlive() {
|
||||
# check for kpsewhich (and mktexlsr)
|
||||
STATUS=0
|
||||
command -v kpsewhich >/dev/null 2>&1 || STATUS=1
|
||||
command -v mktexlsr >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "kpsewhich and mktexlsr found"
|
||||
fi
|
||||
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'kpsewhich' not found."
|
||||
echo "Be sure to use texlive or mactex!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_pdflatex() {
|
||||
# check for pdflatex
|
||||
STATUS=0
|
||||
command -v pdflatex >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "pdflatex found"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'pdflatex' not found."
|
||||
echo "Be sure to have texlive or mactex installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_trackschematic() {
|
||||
# check for tikz-trackschematic
|
||||
STATUS=0
|
||||
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
||||
DEVDIR="tex/latex/local/tikz-trackschematic-dev"
|
||||
|
||||
ls $TEXMFLOCAL/$DEVDIR/tikz-trackschematic-dev.sty >> /dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "tikz-trackschematic-dev found"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Library 'tikz-trackschematic-dev' not found."
|
||||
echo "Be sure to have tikz-trackschematic-dev installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_imagemagick() {
|
||||
# check for ImageMagick/compare
|
||||
STATUS=0
|
||||
command -v compare >/dev/null 2>&1 || STATUS=1
|
||||
if [ $STATUS = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "compare found"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Program 'compare' not found."
|
||||
echo "Be sure to have ImageMagick installed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
run_test_cases() {
|
||||
|
@ -485,7 +577,7 @@ run_test_cases() {
|
|||
#
|
||||
EXIT_CODE=0
|
||||
/usr/bin/time -p -o .tex/${NAME}.time \
|
||||
pdflatex -output-directory=.tex -interaction=batchmode -halt-on-error ${NAME}.tex >> /dev/null 2>&1 || EXIT_CODE=1
|
||||
pdflatex -output-directory=.tex -interaction=NOINTERACT -halt-on-error ${NAME}.tex >> /dev/null 2>&1 || EXIT_CODE=1
|
||||
#
|
||||
TIME=$(awk "NR==2" .tex/${NAME}.time | cut -d " " -f2)
|
||||
# understanding TeX statistics:
|
||||
|
@ -528,7 +620,20 @@ run_test_cases() {
|
|||
# SSIM: structural similarity index
|
||||
#
|
||||
EXIT_CODE=0
|
||||
compare -metric RMSE -colorspace RGB .tex/${NAME}.pdf ${NAME}_expected.pdf NULL: >> /dev/null 2>&1 || EXIT_CODE=1
|
||||
if [ $PDFTOPPM_CONVERT = 0 ]; then
|
||||
# 'compare' will convert the pdf to png
|
||||
# unless the policy of ImageMagick prevents it
|
||||
# -> this reasonably fast!
|
||||
compare -metric RMSE -colorspace RGB .tex/${NAME}.pdf ${NAME}_expected.pdf NULL: >> /dev/null 2>&1 || EXIT_CODE=1
|
||||
else
|
||||
# use 'pdftoppm' convert the pdf to png
|
||||
# then use 'compare' for comparison without converting
|
||||
# -> this is slower!
|
||||
pdftoppm -png -rx 600 -ry 600 .tex/${NAME}.pdf .tex/${NAME}
|
||||
pdftoppm -png -rx 600 -ry 600 ${NAME}_expected.pdf .tex/${NAME}_expected
|
||||
compare -metric RMSE -colorspace RGB .tex/${NAME}-1.png .tex/${NAME}_expected-1.png NULL: >> /dev/null 2>&1 || EXIT_CODE=1
|
||||
fi
|
||||
|
||||
if [ $EXIT_CODE = 0 ]; then
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo " - ${GREEN}comparison succesful${COLOR_RESET}."
|
||||
|
@ -571,13 +676,13 @@ run_test_cases() {
|
|||
|
||||
link_dev_files() {
|
||||
# destination folder inside the TeX Live installation
|
||||
DEVDIR="tex/latex/local/tikz-trackschematic-dev"
|
||||
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
||||
DEVDIR="$TEXMFLOCAL/tex/latex/tikz-trackschematic-dev"
|
||||
PROJECTDIR=$(pwd -P)
|
||||
if [ $BATCHMODE = 0 ]; then
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo ""
|
||||
echo "Do you wish to link this package from"
|
||||
echo "$PROJECTDIR/src to"
|
||||
echo "$TEXMFLOCAL/$DEVDIR?"
|
||||
echo "Do you wish to install this package for development to"
|
||||
echo "$DEVDIR?"
|
||||
echo $n "(y/n) $c"
|
||||
while true; do
|
||||
read -p "" answer
|
||||
|
@ -590,8 +695,8 @@ link_dev_files() {
|
|||
fi
|
||||
|
||||
# make sure that destination folder exists
|
||||
if [ ! -d "$TEXMFLOCAL/$DEVDIR" ]; then
|
||||
$rootrun mkdir -p $TEXMFLOCAL/$DEVDIR
|
||||
if [ ! -d "$DEVDIR" ]; then
|
||||
$rootrun mkdir -p $DEVDIR
|
||||
fi
|
||||
|
||||
# link every file in src/ and rename it
|
||||
|
@ -608,7 +713,7 @@ link_dev_files() {
|
|||
DST="$PREFIX-dev.$POSTFIX.$EXT"
|
||||
fi
|
||||
|
||||
$rootrun ln -sfn $PROJECTDIR/$SRC $TEXMFLOCAL/$DEVDIR/$DST
|
||||
$rootrun ln -sfn $PROJECTDIR/$SRC $DEVDIR/$DST
|
||||
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "linked '$DST'"
|
||||
|
@ -624,66 +729,111 @@ link_dev_files() {
|
|||
fi
|
||||
}
|
||||
|
||||
remove_dev_files() {
|
||||
# destination folder inside the TeX Live installation
|
||||
cd $DEVDIR # from check_trackschematic
|
||||
if [ $NOINTERACT = 0 ]; then
|
||||
echo ""
|
||||
echo "Do you wish to remove the package '$DEVDIR'?"
|
||||
echo $n "(y/n) $c"
|
||||
while true; do
|
||||
read -p "" answer
|
||||
case $answer in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit 1;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "removing $DEVDIR!"
|
||||
fi
|
||||
$rootrun rm -f *
|
||||
cd ..
|
||||
$rootrun rmdir tikz-trackschematic-dev
|
||||
|
||||
# update TeX Live installation
|
||||
TEXlsr=`which mktexlsr`
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
$rootrun $TEXlsr
|
||||
else
|
||||
$rootrun $TEXlsr --quiet
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
## -- cleanup
|
||||
## from create_release
|
||||
if [ $RELEASE = 1 ]; then
|
||||
# remove TMP-folder
|
||||
rm -rf $TMP
|
||||
# undo changes to tikz-trackschematic.sty by sed
|
||||
mv src/tikz-trackschematic.sty.backup src/tikz-trackschematic.sty
|
||||
fi
|
||||
if [ $CLEANUP = 1 ]; then
|
||||
if [ $RELEASE = 1 ]; then
|
||||
# remove TMP-folder
|
||||
rm -rf $TMP
|
||||
# undo changes to tikz-trackschematic.sty by sed
|
||||
mv src/tikz-trackschematic.sty.backup src/tikz-trackschematic.sty
|
||||
# remove TMP-release-note
|
||||
rm release-note-tmp.md
|
||||
fi
|
||||
|
||||
## from run_test_cases
|
||||
if [ $TESTING = 1 ]; then
|
||||
# remove TMP-folder
|
||||
rm -rf test/.tex
|
||||
fi
|
||||
## from check_imagemagick_policy
|
||||
if [ $POLICY_MOD = 1 ]; then
|
||||
# undo changes to /etc/ImageMagick-6/policy.xml by sed
|
||||
$rootrun mv ${POLICY_PATH}.backup $POLICY_PATH
|
||||
fi
|
||||
|
||||
##
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "Clean up done!"
|
||||
## from run_test_cases
|
||||
if [ $TESTING = 1 ]; then
|
||||
# remove TMP-folder
|
||||
rm -rf test/.tex
|
||||
fi
|
||||
|
||||
##
|
||||
if [ $VERBOSE = 1 ]; then
|
||||
echo "Clean up done!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## -- execution
|
||||
## Process user arguments
|
||||
process_arguments $@
|
||||
check_path
|
||||
|
||||
## do what is requested
|
||||
if [ $INSTALL = 1 ]; then
|
||||
##
|
||||
check_path
|
||||
## install package
|
||||
check_texlive
|
||||
check_sudo
|
||||
|
||||
##
|
||||
link_dev_files
|
||||
fi
|
||||
|
||||
if [ $INSTALL = 2 ]; then
|
||||
## deinstall package
|
||||
check_texlive
|
||||
check_trackschematic
|
||||
check_sudo
|
||||
|
||||
##
|
||||
remove_dev_files
|
||||
fi
|
||||
|
||||
if [ $TESTING = 1 ]; then
|
||||
##
|
||||
check_path
|
||||
check_pdflatex
|
||||
check_trackschematic
|
||||
check_imagemagick
|
||||
check_imagemagick_policy
|
||||
|
||||
##
|
||||
run_test_cases
|
||||
|
||||
fi
|
||||
|
||||
if [ $RELEASE = 1 ]; then
|
||||
####
|
||||
# This script produces a .zip-file in accordance to the requirements for CTAN.
|
||||
# For more information see https://ctan.org/help/upload-pkg.
|
||||
####
|
||||
|
||||
## check if version ist in the correct format
|
||||
check_version_number
|
||||
|
||||
## check if $VERSION is present in README.md and versionhistory.tex
|
||||
## check if $VERSION is present in CHANGELOG.md and versionhistory.tex
|
||||
check_versionhistory
|
||||
check_changelog
|
||||
check_url1
|
||||
|
|
Loading…
Reference in New Issue