Skip to content

Commit

Permalink
git subrepo pull --force --branch=v0.2.8 _support/latex/sbabook
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "_support/latex/sbabook"
  merged:   "ffabafe"
upstream:
  origin:   "https://github.com/cdlm/sbabook.git"
  branch:   "v0.2.8"
  commit:   "ffabafe"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/Homebrew/brew"
  commit:   "82c2e743a5"
  • Loading branch information
Ducasse committed May 23, 2024
1 parent 516fa92 commit f7f01a6
Show file tree
Hide file tree
Showing 13 changed files with 341 additions and 113 deletions.
109 changes: 109 additions & 0 deletions _support/latex/sbabook/.drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
kind: pipeline
type: docker
name: TeXlive

steps:
- name: build
image: texlive/texlive
commands:
- tlmgr option repository https://ctan.gutenberg-asso.fr/systems/texlive/tlnet
- tlmgr update --self --all
- latexmk sbabook
- latexmk sbabook.bod
- latexmk sbabook.spiral

- name: build log
image: alpine
commands:
- cat sbabook.log
- cat sbabook.bod.log
- cat sbabook.spiral.log
when:
status: [failure, success]

---
kind: pipeline
type: docker
name: minimal TeXlive

steps:
- name: build
image: texlive/texlive:latest-minimal
pull: always
commands:
- tlmgr option repository https://ctan.gutenberg-asso.fr/systems/texlive/tlnet
- tlmgr update --self --all
- tlmgr install latex-bin latexmk
- xargs tlmgr install < texlive.deps
- tlmgr path add
- latexmk sbabook
- latexmk sbabook.bod
- latexmk sbabook.spiral

- name: build log
image: alpine
commands:
- cat sbabook.log
- cat sbabook.bod.log
- cat sbabook.spiral.log
when:
status: [failure, success]

---
kind: pipeline
type: docker
name: Ubuntu + TeXlive 2023

environment:
TEXLIVE_RELEASE: 2023

steps:
- name: build
image: ubuntu
commands:
- apt update && apt install -y curl perl
- export PATH=$HOME/texlive/bin/x86_64-linux:$HOME/texlive/bin/aarch64-linux:$PATH
- ./ci/install-texlive
- xargs tlmgr install < texlive-2023.deps
- latexmk sbabook
- latexmk sbabook.bod
- latexmk sbabook.spiral

- name: build log
image: alpine
commands:
- cat sbabook.log
- cat sbabook.bod.log
- cat sbabook.spiral.log
when:
status: [failure, success]

---
kind: pipeline
type: docker
name: Ubuntu + TeXlive rolling

environment:
TEXLIVE_RELEASE: rolling

steps:
- name: build
image: ubuntu
commands:
- apt update && apt install -y curl perl
- export PATH=$HOME/texlive/bin/x86_64-linux:$HOME/texlive/bin/aarch64-linux:$PATH
- ./ci/install-texlive
- xargs tlmgr install < texlive.deps
- latexmk sbabook
- latexmk sbabook.bod
- latexmk sbabook.spiral

- name: build log
image: alpine
commands:
- cat sbabook.log
- cat sbabook.bod.log
- cat sbabook.spiral.log
when:
status: [failure, success]
8 changes: 4 additions & 4 deletions _support/latex/sbabook/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
;
[subrepo]
remote = https://github.com/cdlm/sbabook.git
branch = master
commit = 6ba943f40408c19528b5c62d5c498c9507e44335
parent = d9663feb3a92f12b7cc6268e6cc41a5d6aef60da
branch = v0.2.8
commit = ffabafecf60c20d856b706f9377595a45be7704f
parent = 516fa928fd5a8f70f1dbbb6ff56d18244d549681
method = merge
cmdver = 0.4.1
cmdver = 0.4.6
27 changes: 0 additions & 27 deletions _support/latex/sbabook/.travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions _support/latex/sbabook/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ SBAbook — A LaTeX class for technical books
This is a set of layout, typography, and markup definitions for LaTeX books based on the [memoir][] document class.
It is intended for use by [Square Bracket Associates (SBA)][sba], and heavily customized in this direction — by this I mean it's made to setup specific semantic markup and typographic style, rather than to be flexible.

[![Build Status](https://travis-ci.org/cdlm/sbabook.svg?branch=master)](https://travis-ci.org/cdlm/sbabook)
[![Flattr this git repo](https://button.flattr.com/flattr-badge-large.png)](https://flattr.com/submit/auto?url=https%3A%2F%2Fgithub.com%2Fcdlm%2Fsbabook)
[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/cdlm/donate "Donate using Liberapay")


## Usage (nearly there)

The preamble is limited to the minimum:
Here is the minimal preamble:

```latex
\documentclass{sbabook}
Expand Down
73 changes: 33 additions & 40 deletions _support/latex/sbabook/ci/install-texlive
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,43 @@ trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
IFS=$'\n\t'
# preamble from https://disconnected.systems/blog/another-bash-strict-mode/

: "${TEXLIVE_TARBALL:=install-tl-unx.tar.gz}"

function die() {
echo "$@" >&2
exit 1
}

function texlive-repo() {
[[ $# -eq 1 ]] || die "${FUNCNAME[0]}: No release specified (YYYY or rolling)"
local release="$1"
local release="$1" url

if [[ "$release" = rolling ]]; then
echo 'http://mirror.ctan.org/systems/texlive/tlnet'
url='http://mirror.ctan.org/systems/texlive/tlnet'
else
[[ "$release" = [0-9][0-9][0-9][0-9] ]] || die "${FUNCNAME[0]}: incorrect release '$release'"
echo "https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/${release}/tlnet-final/"
url="https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/${release}/tlnet-final/"
# the rolling release is missing the shasum, and the tlnet directory
# US mirror: http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${release}/
fi
}

function deps-file() {
if [[ "$1" = [0-9][0-9][0-9][0-9] ]]; then
echo "texlive-$1.deps"
else
echo texlive.deps
fi
}

function texlive-release() {
tlmgr --version \
| grep 'TeX Live .*version' \
| grep --only-matching '\d\d\d\d'
# resolve possible mirror to fixed URL
curl -LIs -o /dev/null -w '%{url_effective}' "$url"
}

# Ensure meaningful default values for required environment variables.
# Override the full repository URL or set TEXLIVE_RELEASE to pick that year's frozen release.
# Defaults to the current rolling release.
: "${TEXLIVE_RELEASE:=rolling}"
: "${TEXLIVE_REPOSITORY:="$(texlive-repo "$TEXLIVE_RELEASE")"}"
: "${TEXLIVE_TARBALL:=install-tl-unx.tar.gz}"

function get-texlive-installer() {
[[ $# -eq 1 ]] || die "Usage: ${FUNCNAME[0]} texlive-repo-url"
local repo="$1"

# download, checksum, extract
curl --silent --location --remote-name-all "${TEXLIVE_REPOSITORY}/${TEXLIVE_TARBALL}"{,.sha512}
shasum --check "${TEXLIVE_TARBALL}.sha512"
curl --silent --location --remote-name-all "${repo}/${TEXLIVE_TARBALL}"{,.sha512}
sha512sum --check "${TEXLIVE_TARBALL}.sha512"
tar --extract --gzip --file "${TEXLIVE_TARBALL}"
}

function texlive-profile() {
cat <<EOF
selected_scheme scheme-basic
selected_scheme scheme-infraonly
TEXDIR $HOME/texlive
TEXMFLOCAL \$TEXDIR/texmf-local
Expand All @@ -76,36 +63,42 @@ tlpdbopt_generate_updmap 0
tlpdbopt_install_docfiles 0
tlpdbopt_install_srcfiles 0
tlpdbopt_post_code 1
tlpdbopt_sys_bin /usr/local/bin
tlpdbopt_sys_info /usr/local/info
tlpdbopt_sys_man /usr/local/man
EOF
}

function install-texlive() {
[[ $TRAVIS = true ]] || die "Should only run on Travis"
echo "Downloading minimal TeXlive..."
echo " release $TEXLIVE_RELEASE"
echo " from $TEXLIVE_REPOSITORY"
[[ $# -eq 2 ]] || die "Usage: ${FUNCNAME[0]} (YYYY | rolling) texlive-repository-url"
local release="$1" repo="$2"

get-texlive-installer
echo "Downloading TeXlive..."
echo " release ${release}"
echo " from ${repo}"

get-texlive-installer "$repo"

# find installer path from archive listing, sanity check
local installer
installer="$(tar --list --gzip --file "${TEXLIVE_TARBALL}" | grep '/install-tl$' )"
[[ -x "$installer" ]] || die "can not find TeXlive installer at ${installer}";

texlive-profile >> texlive.profile
"$installer" --repository "$TEXLIVE_REPOSITORY" --profile texlive.profile
}
"$installer" --repository "$repo" --profile texlive.profile
tlmgr option repository "$repo"

function install-deps() {
xargs tlmgr install \
latexmk \
< "$(deps-file "$TEXLIVE_RELEASE")"
tlmgr update --self --all
tlmgr install latex-bin latexmk
}

# Only call the main function if this script was called as a command. This makes
# it possible to source this script as a library.
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
install-texlive
install-deps
# Override the full repository URL or set TEXLIVE_RELEASE to pick that year's frozen release.
# Defaults to the current rolling release.
release="${1:-${TEXLIVE_RELEASE:-rolling}}"
repo="${2:-${TEXLIVE_REPOSITORY:-$(texlive-repo "$release")}}"

install-texlive "$release" "$repo"
fi
100 changes: 100 additions & 0 deletions _support/latex/sbabook/ci/list-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o errtrace
set -o pipefail
IFS=
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR

shopt -s extglob
declare -A DEPS

: "${TEXLIVE_REPOSITORY:=http://mirror.ctan.org/systems/texlive/tlnet}"
TEXLIVE_REPOSITORY="$(curl -LIs -o /dev/null -w '%{url_effective}' "$TEXLIVE_REPOSITORY")"
PREFIX="$(kpsewhich --var-value TEXMFROOT)"

function die {
local code="${1:-1}"
[[ $# -ge 1 ]] && shift

printf "$(tput setaf 1)%s$(tput sgr0)\n" "$@" 1>&2
exit "$code"
}

function info-inline {
printf "$(tput setaf 3)%s$(tput sgr0)" "$@" 1>&2
}

function info {
info-inline "$@"
printf "\n" 1>&2
}

function texlive-release() {
tlmgr --version \
| sed '/^tlmgr/d ; s/.*version //'
}

function filter-inputs {
sed -e '\#^INPUT '"$PREFIX"'/texmf-dist#!d' \
-e 's#^INPUT '"$PREFIX"'/##' \
"$@"
}

function query-package-containing {
local filename="${1?}"
tlmgr --repository "$TEXLIVE_REPOSITORY" \
search --global --file "$filename" \
| sed '/^\t/d ; /^tlmgr:/d ; s/:$//'
}

function list-package-files {
local pkgname="${1?}"
tlmgr --repository "$TEXLIVE_REPOSITORY" \
info --list "$pkgname" \
| sed '/^ /!d ; s/^ *//'
}

function encache-file {
local filename="${1?}" pkgname
pkgname="$(query-package-containing "${filename}")"
while read -r provided; do
DEPS["$provided"]="$pkgname"
done < <(list-package-files "$pkgname")
}

function package-name {
local filename="${1?}"
info-inline "$filename"
if [[ -z "${DEPS["$filename"]+found}" ]]; then
info " (querying ${TEXLIVE_REPOSITORY})"
encache-file "$filename"
echo "${DEPS["$filename"]}" || info "failed to resolve ${filename}"
else
info " (from ${DEPS[$filename]})"
fi
}

function find-packages {
while read -r filename; do
package-name "$filename"
done
}

function list-deps {
local main="${1:-main}"
main="${main%.@(tex|aux|fls)}" # extglob
[[ -f "$main.fls" ]] || die 1 "no such file: $main.fls"

filter-inputs "$main.fls" | sort --unique > "$main.inputs"
info "$(wc -l "$main.inputs")"

find-packages < "$main.inputs" | tee "$main.deps"
sort --unique --output "$main.deps" "$main.deps"
}

# Only call the main function if this script was called as a command. This makes
# it possible to source this script as a library.
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
list-deps "$@"
fi
Empty file modified _support/latex/sbabook/gitinfo2.sh
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions _support/latex/sbabook/sbabook.bod.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
% Paper format for https://librairie.bod.fr
\providecommand{\setuppage}{\bodpage}\input{sbabook}

0 comments on commit f7f01a6

Please sign in to comment.