|
1 |
| -# Tectonic TeXLive Bundle Builder |
| 1 | +# Tectonic Bundles |
| 2 | + |
| 3 | +This repository contains scripts for building bundles for |
| 4 | +[Tectonic](https://tectonic-typesetting.github.io), each of which is a complete TeX distribution. |
| 5 | + |
| 6 | +**You do not need this repository to build Tectonic.** \ |
| 7 | +You only need these scripts if you want to make your own bundles of TeX files. |
| 8 | + |
| 9 | +**Warning:** The `./tests` do not work yet, they need to be reworked for the new bundle spec! |
| 10 | + |
2 | 11 |
|
3 |
| -This repository contains scripts for building “bundles” for |
4 |
| -[Tectonic](https://tectonic-typesetting.github.io) based on [Norbert Preining’s |
5 |
| -Git mirror](http://git.texlive.info/texlive/) of [the TeXLive Subversion |
6 |
| -repository](http://tug.org/svn/texlive/). |
7 | 12 |
|
8 |
| -*You do not need this repository to build Tectonic.* You only need these scripts |
9 |
| -if you want to make your own bundle of TeX files based on the TeXLive sources. |
10 | 13 |
|
11 | 14 |
|
12 | 15 | ## Prerequisites
|
13 | 16 |
|
14 | 17 | To use these tools, you will need:
|
15 | 18 |
|
16 |
| -- An installation of [Docker](https://www.docker.com/). |
17 |
| -- A checkout of the Preining TeXLive Git repository |
18 |
| - (`git://git.texlive.info/texlive.git`), placed or symlinked in a subdirectory |
19 |
| - named `state/repo` below this file. Be aware that this repository currently |
20 |
| - weighs in at **40 gigabytes**! |
21 |
| -- A Rust toolchain if you want to create “indexed tar” bundles. (So, you don’t |
22 |
| - need Rust if you want to create a bundle and test it locally.) |
| 19 | +- Bash, `pv`, GNU `patch` and `diff` |
| 20 | +- A [TeXlive tarball](https://tug.org/texlive/acquire-tar.html). Different bundles need different TeXlive versions. |
| 21 | +- A Rust toolchain (`cargo`). |
23 | 22 |
|
24 |
| -Data files associated with the staging process will land in other subdirectories |
25 |
| -of `state/`. |
26 | 23 |
|
27 | 24 |
|
28 |
| -## Getting started: creating the bundler image |
29 | 25 |
|
30 |
| -The first step is to create a Docker container that will host most of the |
31 |
| -computations — this promotes reproducibility and portability, regardless of what |
32 |
| -kind of system you are using. To create this container, run: |
| 26 | +## Bundles: |
| 27 | +Each directory in `./bundles` is a bundle specification, which contains everything we need to reproducibly build a bundle.\ |
| 28 | +See [`./bundles/README.md`](./bundles/README.md) for details. |
33 | 29 |
|
34 |
| -``` |
35 |
| -./driver.sh build-image |
36 |
| -``` |
| 30 | +The following bundles are available: |
| 31 | + - `texlive2023-nopatch`: based on `texlive2023-20230313`. |
37 | 32 |
|
38 | 33 |
|
39 |
| -## Creating TeXLive containers |
40 | 34 |
|
41 |
| -The next step is to create TeXLive “containers” — which are different than |
42 |
| -Docker containers. A *Docker* container is an encapsulated Linux machine that |
43 |
| -provides a reproducible build environment. *TeXLive* containers are archives |
44 |
| -containing the files associated with the various TeXLive packages. |
45 | 35 |
|
46 |
| -To create TeXLive container files for all of the packages associated with your |
47 |
| -TeXLive checkout, run: |
48 | 36 |
|
49 |
| -``` |
50 |
| -./driver.sh update-containers |
51 |
| -``` |
52 | 37 |
|
53 |
| -This will use the Docker container to generate TeXLive container files in |
54 |
| -`state/containers`. *The results of this step will depend on what version of the |
55 |
| -TeXLive tree you currently have checked out in `state/repo`.* |
| 38 | +## Build Process: |
| 39 | +Before building any bundles, acquire a [TeXlive tarball](https://tug.org/texlive/acquire-tar.html) with a version that matches the bundle you want to build. These are usually distributed as compressed tarballs, which you'll have to manually decompress. **`build.sh` expects an uncompressed `.tar` file!** It checks the hash of this file, and will refuse to work if that hash doesn't match. |
56 | 40 |
|
| 41 | +The tarball you end up with should have a name of the form `texlive-YYYYMMDD-texmf.tar`. **Do not rename this file!** |
57 | 42 |
|
58 |
| -## Creating a TeXLive installation tree |
59 | 43 |
|
60 |
| -Run: |
61 | 44 |
|
62 |
| -``` |
63 |
| -./driver.sh make-installation bundles/tlextras |
64 |
| -./driver.sh install-packages bundles/tlextras |
65 |
| -``` |
| 45 | +To build a bundle, run the following jobs. These **must** be run in order! |
66 | 46 |
|
67 |
| -(In the future, we might add more specifications to the `bundles` directory for |
68 |
| -creating specialized bundles. The `tlextras` bundle is the one-size-fits-all |
69 |
| -default bundle.) |
| 47 | + - `./build.sh <tarball> extract`: extracts texlive into `./build/texlive/<version>`\ |
| 48 | + This also generates `TEXLIVE-SHA256SUM` in the texlive version directory. |
70 | 49 |
|
| 50 | + - `./build.sh <bundle> content`: assemble all files into a bundle at `./build/output/<bundle>content`.\ |
| 51 | + This will delete all bundles in `output/<bundle>/`, move them elsewhere if you still need them. |
71 | 52 |
|
72 |
| -## Updating patches |
| 53 | +Once `./build/output/content` has been created, run any of the following commands to package the bundle.\ |
| 54 | +See [`builder/README.md`](./scripts/builder/README.md) for details. |
73 | 55 |
|
74 |
| -As of TeXLive 2021, we have bitten the bullet and decided to maintain some |
75 |
| -patches against the TeXLive tree. |
| 56 | + - `./build.sh <bundle> ttbv1`: create a ttb (version 1) bundle from the content directory.\ |
| 57 | + TTB bundles may be used locally or hosted on the web. |
76 | 58 |
|
77 |
| -Maintaining long-lived patches is never fun, but Git makes life a lot easier |
78 |
| -than it could be. We use a secondary branch named `vendor-pristine` to help |
79 |
| -maintain our patches. The way we do that is to copy the “vendor” (TeXLive |
80 |
| -original) files into branch, then use `git merge` to update the main branch with |
81 |
| -whatever changes have been introduced between TeXLive updates. |
82 | 59 |
|
83 |
| -First, bump the version of your bundle and run the standard update steps through |
84 |
| -the `install-packages` step described above. Make sure that the current branch |
85 |
| -is clean with no changes in the working tree or index. Then run: |
86 | 60 |
|
87 |
| -``` |
88 |
| -./driver.sh get-vendor-pristine bundles/tlextras |
89 |
| -``` |
90 | 61 |
|
91 |
| -Then follow the suggested workflow as printed out by that command. The basic |
92 |
| -plan is to commit the vendor files into the bundle’s `patched/` directory *on |
93 |
| -the vendor-pristine* branch, then merge them back into the main branch. |
94 | 62 |
|
95 | 63 |
|
96 |
| -## Exporting to a Zip-format bundle |
| 64 | +## Output Files |
97 | 65 |
|
98 |
| -Run: |
99 | 66 |
|
100 |
| -``` |
101 |
| -./driver.sh make-zipfile bundles/tlextras |
102 |
| -``` |
| 67 | +**`./build.sh <bundle> content` produces the following:** |
| 68 | + - `./build/output/<bundle>/content`: contains all bundle files. It is organized by source: files from the bundle's `include` dir will be under `./include`, texlive files will be under `./texlive`, and so on. See `main.rs` of `scripts/select`. |
| 69 | + This directory also contains some metadata: |
| 70 | + - `content/FILES`: each line of this file is `<path> <hash>`, sorted by file name.\ |
| 71 | + Files with identical names are included.\ |
| 72 | + Files not in any search path are also included.\ |
| 73 | + `<hash>` is either a hex sha256 of that file's contents, or `nohash` for a few special files. |
| 74 | + - `content/SHA256SUM`: The sha256sum of `content/FILES`. This string uniquely defines this bundle. |
| 75 | + - `content/SEARCH`: File search order for this bundle. See bundle spec documentation. |
| 76 | + - `search-report`: debug file. Lists all directories that will not be searched by the rules in `search-order`.\ |
| 77 | + The entries in this file are non-recursive: If `search-report` contains a line with `/texlive`, this means that direct children of `/texlive` (like `/texlive/file.tex`) will not be found, but files in *subdirectories* (like `/texlive/tex/file.tex`) may be. |
103 | 78 |
|
104 |
| -This will create a large Zip-format bundle file with a name something like |
105 |
| -`state/artifacts/tlextras-2020.0r0/tlextras-2020.0r0.zip`. Such a bundle file |
106 |
| -can be used with the `tectonic` command-line program with the `-b` argument. |
107 | 79 |
|
| 80 | +**`./build.sh <bundle> ttbv1` produces the following:** |
| 81 | + - `<bundle>.ttb`: the bundle. Note that the ttb version is *not* included in the extension. |
| 82 | + - Index location and length are printed once this job completes. |
| 83 | + - You can extract files from this bundle by running `dd if=file.ttb ibs=1 skip=<start> count=<len> | gunzip` |
108 | 84 |
|
109 |
| -## Converting to an “indexed tar” bundle |
110 | 85 |
|
111 |
| -This step is needed to create a bundle that will be hosted on the web. Run: |
112 | 86 |
|
113 |
| -``` |
114 |
| -./driver.sh make-itar bundles/tlextras |
115 |
| -``` |
| 87 | +## Testing |
116 | 88 |
|
117 |
| -This will create both the `.tar` and the `.tar.index.gz` files that need to be |
118 |
| -uploaded for use as a web bundle. |
| 89 | +Tests are under `./tests`, and are currently a work in progress. All tests are run through `test.sh` as follows: `./test.sh <path-to-ttb> <test set>`. |
119 | 90 |
|
| 91 | +Tests require the following: |
| 92 | + - a `ttb` bundle (local or remote) |
| 93 | + - a recent installation of Tectonic |
120 | 94 |
|
121 |
| -## Testing |
| 95 | +### Test Sets |
| 96 | +The following test sets are avaiable: |
| 97 | + - `files`, which tries to compile all files under `tests/files` and `tests/formats` |
| 98 | + - `classes`, which tries to compile a simple document using `tests/classes.list` |
122 | 99 |
|
123 |
| -Bundle definitions come with testing information. To test a bundle, you need the |
124 |
| -`tectonic` command-line program to be in your $PATH, as well as a Python 3 |
125 |
| -interpreter and the [toml] package. |
| 100 | +Note that most test files contain comments explaining the reason and expected outcome of the test. |
126 | 101 |
|
127 |
| -[toml]: https://pypi.org/project/toml/ |
128 | 102 |
|
129 |
| -Test scripts are located in the `tests` directory. Currently available: |
130 | 103 |
|
131 |
| -- `tests/classes.py`: basic compilation smoketest of the documentclasses in a bundle |
132 |
| -- `tests/formats.py`: test generation of the format files defined in the bundle |
133 |
| -- `tests/packages.py`: test loading if the package (style) files defined in the |
134 |
| - bundle. There are thousands of style files in a typical bundle, so this |
135 |
| - program uses a framework to run a random-but-reproducible subset of the tests. |
136 |
| - See the header comment in the Python file for more information. |
| 104 | +### Test Output |
| 105 | +All test output ends up under `tests/build` |
137 | 106 |
|
| 107 | +**Output for `files`:** |
| 108 | + - `files/logs`: log files for all builds (passed or failed) |
| 109 | + - `files/*.{pdf,fmt,etc}`: output files for each build |
138 | 110 |
|
139 |
| -#### Copyright and Licensing |
140 | 111 |
|
141 |
| -The infrastructure scripts in this repository are licensed under the MIT |
142 |
| -License. Their copyright is assigned to the Tectonic Project. |
| 112 | +**Output for `classes` |
| 113 | + - `failed`: classes that failed to compile |
| 114 | + - `passed`: classes that complied without error |
| 115 | + - `logs`: log files for all compile jobs |
0 commit comments