Skip to content

Commit

Permalink
Merge pull request #39 from fykosak/texmf-refactoring
Browse files Browse the repository at this point in the history
Texmf refactoring
  • Loading branch information
Werkov authored Oct 10, 2017
2 parents 2e1d546 + 685d409 commit 45427c4
Show file tree
Hide file tree
Showing 184 changed files with 1,449 additions and 12 deletions.
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
addons:
apt:
packages:
- fonts-sil-doulos
- lmodern
- pgf
- texlive-base
- texlive-science
- texlive-fonts-extra
- texlive-fonts-recommended
- texlive-font-utils
- texlive-lang-greek
- texlive-lang-czechslovak
- texlive-latex-base
- texlive-latex-extra
- texlive-latex-recommended
- texlive-math-extra
- texlive-xetex
# for tests
- latex-beamer
- python-matplotlib
- python-numpy


before_install:
# - sudo sed 's/deb /deb [trusted=yes] /' -i /etc/apt/sources.list /etc/apt/sources.list.d/*
# we need poppler-utils >= 0.25
- sudo add-apt-repository -y ppa:alexis-via/poppler-utils-backport
- sudo apt-get update -qy --allow-unauthenticated || true
- sudo apt-get install --allow-unauthenticated -y poppler-utils

install:

before_script:

script:
- make test

after_failure:
- cat ./tests/out/*.log
- echo "MARK"
- tar cj ./tests/out/*-diff.png | base64
- echo "MARK"
- echo "Test failed, `cat MARK/MARK | base64 -d | tar xj` to see respective diff PNGs"
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DESTDIR=
DST=$(DESTDIR)/usr/share/texmf

build:
true

clean:
true

install:
mkdir -p $(DST)
cp -r texmf/* -t $(DST)/

test:
make -C tests
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# fks-texmf

TeX macros for physics (contest) typesetting.

* TODO installation (Linux distros, windows)
* TODO maintenance (tests, branching, packaging)


## Packaging

Packages for Linux distributions are built in [Open Build Service](http://build.opensuse.org/).
All data are stored in the main Git repository and build service package
contains just a `_service` file that references the Git repository and
transformations to comply with OBS package format.

To rebuild packages with a fresh pull from the repo call

osc service remoterun

### Debian

* Beware that Build-Depends is duplicated both in `*.dsc` and
`debian.control` file (does not need frequent changes though).

## Tests

* `tests/source` any `t*.tex` files are compiled with the macros.
* `tests/exp-res` here you should put PNG files with expected test results
(matching respective source filename).
* Simply call `make test-results` to refresh the PNG patterns.

### Metadata

The test files can arbitrary key=value metadata comments
```
%META_TEST foo=bar
```

Following keys are supported:

* `META_TEST ignore=1` test is run but results are ignored
* `META_TEST nopdf=1` test is supposed to produce no PDF output
* `META_TEST roi=<l>x<t>,<w>x<h>` left and top coordinate, width and height
size (all relative [0,1]) of region of interest that is compared against
the pattern

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions packaging/debian.changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fks-texmf (3.0~alpha1-1) UNRELEASED; urgency=medium

* Initial release

-- Michal Koutný <[email protected]> Wed, 13 Sep 2017 01:09:00 +0200
1 change: 1 addition & 0 deletions packaging/debian.compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
19 changes: 19 additions & 0 deletions packaging/debian.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Source: fks-texmf
Section: tex
Priority: optional
Maintainer: FKS TeX group <[email protected]>
Build-Depends: debhelper (>=9), make (>=3.8)
Standards-Version: 3.9.6
Homepage: https://github.com/fykosak/fks-texmf

Package: fks-tex-base
Architecture: all
Depends: fonts-sil-doulos, lmodern, pgf,
texlive-base, texlive-science,
texlive-fonts-extra, texlive-fonts-recommended, texlive-font-utils,
texlive-lang-greek, texlive-lang-czechslovak,
texlive-latex-base, texlive-latex-extra, texlive-latex-recommended (>=2012),
texlive-math-extra,
texlive-xetex (>=2012)
Description: TeX macros for typesetting physics contests
And metapost pictures and so on.
40 changes: 40 additions & 0 deletions packaging/debian.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
# postinst script for fks-texmf
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
configure)
mktexlsr
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
38 changes: 38 additions & 0 deletions packaging/debian.postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
# postrm script for fks-texmf
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
mktexlsr
;;

*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
27 changes: 27 additions & 0 deletions packaging/debian.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
dh $@


# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_test:
true
11 changes: 11 additions & 0 deletions packaging/fks-texmf.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Format: 3.0 (quilt)
Source: fks-texmf
Binary: fks-tex-base
Architecture: all
Version: 3.0~alpha1-1
Maintainer: FKS TeX group <[email protected]>
Homepage: https://github.com/fykosak/fks-texmf
Standards-Version: 3.9.6
Build-Depends: debhelper (>= 9), make (>= 3.8)
Package-List:
fks-tex-base deb tex optional arch=all
51 changes: 51 additions & 0 deletions packaging/suse.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# spec file for package suse
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name: fks-tex-base
Version:
Release: 0
Summary:
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:
Url:
Source:
# TODO check those propagates to binary package too
BuildRequires: texlive-cm-unicode
BuildRequires: sil-doulos-fonts
BuildRoot: %{_tmppath}/%{name}-%{version}-build

%description

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
%make_install

%post
%postun

%files
%defattr(-,root,root)

1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/*
6 changes: 6 additions & 0 deletions tests/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "components/texmf.base"]
path = components/texmf.base
url = [email protected]:fykosak/fks-texmf.git
[submodule "components/texmf.fonts"]
path = components/texmf.fonts
url = [email protected]:texmf.fonts.git
41 changes: 41 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.PHONY: test test-results

mkfile_path:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

TESTS=$(mkfile_path)
TESTS_RES=$(TESTS)/exp-res
TESTS_SRC=$(TESTS)/source
TESTS_OUT=out
TEXMF_TESTED=$(mkfile_path)/../texmf
TEXMF_STAMP=out/texmf.stamp

#
# Test working copy version
#
test:
ifdef TEST
./run.sh -v -t $(TEST) $(TEXMF_TESTED) $(TESTS) $(TESTS_OUT)
else
./run.sh -v $(TEXMF_TESTED) $(TESTS) $(TESTS_OUT)
endif

#
# Recreate tests expected results with current working copy
#
test_files:=$(addprefix $(TESTS_OUT)/,$(notdir \
$(patsubst %.tex,%.pdf,$(wildcard $(TESTS_SRC)/t*.tex))))

test-results: $(test_files)
# TODO this recipe should be called regardless prerequsities success
rm $(TEXMF_STAMP)


$(TEXMF_STAMP):
touch $@

# PNG files are created as side-effect of this rule
$(TESTS_OUT)/%.pdf: $(TESTS_SRC)/%.tex $(TEXMF_STAMP)
@rm -f $(TESTS_RES)/$**.png
./make-result.sh $(TEXMF_TESTED) $< $(TESTS_RES)


Loading

0 comments on commit 45427c4

Please sign in to comment.