From 8570e0be5519748b17f0fac52367b609daa2f11d Mon Sep 17 00:00:00 2001 From: rm-dr <96270320+rm-dr@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:42:51 -0700 Subject: [PATCH 1/4] Fix swapped logging bug --- src/bin/tectonic/v2cli/commands/bundle/select/picker.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/tectonic/v2cli/commands/bundle/select/picker.rs b/src/bin/tectonic/v2cli/commands/bundle/select/picker.rs index 0249cd73..7d99e4cb 100755 --- a/src/bin/tectonic/v2cli/commands/bundle/select/picker.rs +++ b/src/bin/tectonic/v2cli/commands/bundle/select/picker.rs @@ -420,14 +420,14 @@ impl FilePicker { if x.hash().unwrap() != hash { if cli.allow_hash_mismatch { warn!("hash of tarball for source `{source}` doesn't match expected value"); - warn!("expected: {}", x.hash().unwrap()); - warn!("got: {}", hash); + warn!("expected: {}", hash); + warn!("got: {}", x.hash().unwrap()); } else { error!( "hash of tarball for source `{source}` doesn't match expected value" ); - error!("expected: {}", x.hash().unwrap()); - error!("got: {}", hash); + error!("expected: {}", hash); + error!("got: {}", x.hash().unwrap()); bail!("hash of tarball for source `{source}` doesn't match expected value") } } From 51ddb240960c5c3ce210555b6851c8b7f11f30f3 Mon Sep 17 00:00:00 2001 From: rm-dr <96270320+rm-dr@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:54:04 -0700 Subject: [PATCH 2/4] Added `texlive2024-0312` bundle --- bundles/bundles/texlive2024-0312/bundle.toml | 89 +++++++++++++++++++ .../tectonic/tectonic-format-latex.tex | 1 + .../tectonic/tectonic-format-plain.tex | 1 + .../patches/texlive/fithesis-mu-base.sty.diff | 24 +++++ .../patches/texlive/fontawesome.sty.diff | 5 ++ .../patches/texlive/latex.ltx.diff | 32 +++++++ .../patches/texlive/listings.sty.diff | 25 ++++++ 7 files changed, 177 insertions(+) create mode 100644 bundles/bundles/texlive2024-0312/bundle.toml create mode 100644 bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-latex.tex create mode 100644 bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-plain.tex create mode 100644 bundles/bundles/texlive2024-0312/patches/texlive/fithesis-mu-base.sty.diff create mode 100644 bundles/bundles/texlive2024-0312/patches/texlive/fontawesome.sty.diff create mode 100644 bundles/bundles/texlive2024-0312/patches/texlive/latex.ltx.diff create mode 100644 bundles/bundles/texlive2024-0312/patches/texlive/listings.sty.diff diff --git a/bundles/bundles/texlive2024-0312/bundle.toml b/bundles/bundles/texlive2024-0312/bundle.toml new file mode 100644 index 00000000..9ae6b185 --- /dev/null +++ b/bundles/bundles/texlive2024-0312/bundle.toml @@ -0,0 +1,89 @@ +[bundle] +name = "texlive2024-0312" +expected_hash = "8fae742a1d9453fc3abfe7c6971363696f611ade1266c17788ccb5c18ffd1312" + +search_order = ["/", { input = "include" }, { input = "texlive" }] + +# Note the triple-quoted multiline strings: +# this is the best way to get raw strings in TOML. +ignore = [ + # Files and extensions we usually want to ignore. + '''.*/00readme\.txt''', + '''.*/LICENSE\.md''', + '''.*/Makefile''', + '''.*/README''', + '''.*/README.md''', + '''.*/readme\.txt''', + '''.*/ls-R''', + '''.*\.fmt''', + '''.*\.log''', + '''.*\.lua''', + '''.*\.mf''', + '''.*\.pl''', + '''.*\.ps''', +] + + +[inputs."include"] +source.dir.path = "include" + + +# Requires texlive-20240312-texmf, which is available at +# https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2024/texlive-20240312-texmf.tar.xz +# download and extract this file as a .tar in this directory. +[inputs."texlive"] +source.tarball.path = "texlive-20240312-texmf.tar" +source.tarball.hash = "87f7f5fd9618689cd9ae436ad37cefe43fabf1f2f457ac3860ec2aa854578d20" +source.tarball.root_dir = "texlive-20240312-texmf/texmf-dist" +patch_dir = "patches/texlive" + +ignore = [ + # I don't think tectonic has xindy support, ignore for now + '''xindy/.*''', + + # We may need this, but exclude for now. + '''tex4ht/.*''', + + # These require pLaTeX2e, tectonic uses XeTeX + '''tex/uplatex/.*''', + '''tex/uptex/.*''', + + # Other odd tex formats & unnecessary files + '''tex/cslatex/.*''', + '''tex/csplain/.*''', + '''tex/ptex/.*''', + '''tex/platex/.*''', + '''tex/lollipop/.*''', + '''tex/context/.*''', + '''context/.*''', + '''texdoc/.*''', + '''texdoctk/.*''', + '''texconfig/.*''', + '''scripts/.*''', + '''dvips/.*''', + '''asymptote/.*''', + '''makeindex/.*''', + '''luatex-cache/.*''', + '''hb2gf/.*''', + '''chktex/.*''', + '''source/.*''', + '''doc/.*''', + '''tex/luatex/.*''', + '''tex/lualatex/.*''', + '''tex/lambda/.*''', + '''omega/.*''', +] + +search_order = [ + "tex/{xelatex,latex,xetex,plain,generic}//", + "bibtex/{bib,bst,csf}//", + "web2c//", + "fonts//", + "biber//", + "mft//", + "dvips//", + "makeindex//", + "{web,cweb}//", + "ttf2pk//", + "dvipdfmx/", +] diff --git a/bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-latex.tex b/bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-latex.tex new file mode 100644 index 00000000..94673dfc --- /dev/null +++ b/bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-latex.tex @@ -0,0 +1 @@ +\input xelatex.ini diff --git a/bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-plain.tex b/bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-plain.tex new file mode 100644 index 00000000..665dff47 --- /dev/null +++ b/bundles/bundles/texlive2024-0312/include/tectonic/tectonic-format-plain.tex @@ -0,0 +1 @@ +\input plain \dump diff --git a/bundles/bundles/texlive2024-0312/patches/texlive/fithesis-mu-base.sty.diff b/bundles/bundles/texlive2024-0312/patches/texlive/fithesis-mu-base.sty.diff new file mode 100644 index 00000000..f3605d0b --- /dev/null +++ b/bundles/bundles/texlive2024-0312/patches/texlive/fithesis-mu-base.sty.diff @@ -0,0 +1,24 @@ +tex/latex/fithesis/style/mu/fithesis-mu-base.sty +131c131,138 +< \setmainfont[Ligatures=TeX]{TeX Gyre Pagella} +--- +> \setmainfont{texgyrepagella}[ +> Ligatures = TeX, +> Extension = .otf, +> UprightFont = *-regular, +> ItalicFont = *-italic, +> BoldFont = *-bold, +> BoldItalicFont = *-bolditalic, +> ] +136c143,151 +< \setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros} +--- +> \setmainfont{texgyreheros}[ +> Ligatures = TeX, +> Scale = MatchLowercase, +> Extension = .otf, +> UprightFont = *-regular, +> ItalicFont = *-italic, +> BoldFont = *-bold, +> BoldItalicFont = *-bolditalic, +> ] diff --git a/bundles/bundles/texlive2024-0312/patches/texlive/fontawesome.sty.diff b/bundles/bundles/texlive2024-0312/patches/texlive/fontawesome.sty.diff new file mode 100644 index 00000000..9c7cf900 --- /dev/null +++ b/bundles/bundles/texlive2024-0312/patches/texlive/fontawesome.sty.diff @@ -0,0 +1,5 @@ +tex/latex/fontawesome/fontawesome.sty +45c45 +< \newfontfamily{\FA}{FontAwesome} +--- +> \newfontfamily{\FA}{FontAwesome.otf} diff --git a/bundles/bundles/texlive2024-0312/patches/texlive/latex.ltx.diff b/bundles/bundles/texlive2024-0312/patches/texlive/latex.ltx.diff new file mode 100644 index 00000000..866e60a3 --- /dev/null +++ b/bundles/bundles/texlive2024-0312/patches/texlive/latex.ltx.diff @@ -0,0 +1,32 @@ +tex/{latex,latex-dev}/base/latex.ltx +7211,7237c7211,7212 +< \typeout{^^J! LaTeX Error: File `#1.#2' not found.^^J^^J% +< Type X to quit or to proceed,^^J% +< or enter new name. (Default extension: #2)^^J}% +< \message{Enter file name: }% +< {\endlinechar\m@ne +< \global\read\m@ne to\@gtempa}% +< \ifx\@gtempa\@empty +< \let\@missingfile@area\@empty +< \let\@missingfile@base\@empty +< \def\@missingfile@ext{tex}% +< \else +< \def\reserved@b{\batchmode\read-1 to \reserved@a}% +< \def\reserved@a{x}\ifx\reserved@a\@gtempa\reserved@b\fi +< \def\reserved@a{X}\ifx\reserved@a\@gtempa\reserved@b\fi +< \filename@parse\@gtempa +< \edef\filename@ext{% +< \ifx\filename@ext\relax#2\else\filename@ext\fi}% +< \edef\reserved@a{% +< \noexpand\IfFileExists +< {\filename@area\filename@base.\filename@ext}% +< {\def\noexpand\@missingfile@area{\filename@area}% +< \def\noexpand\@missingfile@base{\filename@base}% +< \def\noexpand\@missingfile@ext {\filename@ext}}% +< {\noexpand\@missingfileerror +< {\filename@area\filename@base}{\filename@ext}}}% +< \reserved@a +< \fi +--- +> % Tectonic: no terminal input allowed, so this is always a fatal error. +> \errmessage{! LaTeX Error: File `#1.#2' not found.}% diff --git a/bundles/bundles/texlive2024-0312/patches/texlive/listings.sty.diff b/bundles/bundles/texlive2024-0312/patches/texlive/listings.sty.diff new file mode 100644 index 00000000..64c78d0c --- /dev/null +++ b/bundles/bundles/texlive2024-0312/patches/texlive/listings.sty.diff @@ -0,0 +1,25 @@ +tex/latex/listings/listings.sty +2057,2075c2057,2059 +< \typeout{^^J! Package Listings Error: File `#1(.#2)' not found.^^J% +< ^^JType X to quit or to proceed,^^J% +< or enter new name. (Default extension: #2)^^J}% +< \message{Enter file name: }% +< {\endlinechar\m@ne \global\read\m@ne to\@gtempa}% +< \ifx\@gtempa\@empty \else +< \def\reserved@a{x}\ifx\reserved@a\@gtempa\batchmode\@@end\fi +< \def\reserved@a{X}\ifx\reserved@a\@gtempa\batchmode\@@end\fi +< \filename@parse\@gtempa +< \edef\filename@ext{% +< \ifx\filename@ext\relax#2\else\filename@ext\fi}% +< \edef\reserved@a{\noexpand\IfFileExists % +< {\filename@area\filename@base.\filename@ext}% +< {\noexpand\lst@InputListing % +< {\filename@area\filename@base.\filename@ext}}% +< {\noexpand\lst@MissingFileError +< {\filename@area\filename@base}{\filename@ext}}}% +< \expandafter\reserved@a % +< \fi} +--- +> % Tectonic: no terminal input allowed, so this is always a fatal error. +> \errmessage{! Package Listings Error: File `#1(.#2)' not found.}% +> } From 3ba50cefe84236324ee48000071db736d9a6eb42 Mon Sep 17 00:00:00 2001 From: rm-dr <96270320+rm-dr@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:59:38 -0700 Subject: [PATCH 3/4] Modify gitignore --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 00d35f46..7f0f313f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,16 @@ +# Build files /cross /docs/book/* /target + +# Tests /tests/plain.fmt /tests/00*00-latex-*.fmt /tests/*-plain-*.fmt /tests/xenia/paper.pdf + +# Tectonic bundles +*.ttb + +# Misc +*.ignore \ No newline at end of file From 68d14f1f31808fc20d56fb10907523de39224892 Mon Sep 17 00:00:00 2001 From: rm-dr <96270320+rm-dr@users.noreply.github.com> Date: Mon, 14 Oct 2024 21:30:13 -0700 Subject: [PATCH 4/4] Create subdir with bundle name --- .../tectonic/v2cli/commands/bundle/actions.rs | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/bin/tectonic/v2cli/commands/bundle/actions.rs b/src/bin/tectonic/v2cli/commands/bundle/actions.rs index 3b2b7c19..412a0f9b 100644 --- a/src/bin/tectonic/v2cli/commands/bundle/actions.rs +++ b/src/bin/tectonic/v2cli/commands/bundle/actions.rs @@ -38,32 +38,27 @@ pub(super) fn select(cli: &BundleCreateCommand) -> Result<()> { return Err(e); }; + let build_dir = cli.build_dir.join(&bundle_config.bundle.name); + // Remove build dir if it exists - if cli.build_dir.exists() { - warn!( - "build dir {} aleady exists", - cli.build_dir.to_str().unwrap() - ); + if build_dir.exists() { + warn!("build dir {} aleady exists", build_dir.to_str().unwrap()); for i in (1..=5).rev() { warn!( "recursively removing {} in {i} second{}", - cli.build_dir.to_str().unwrap(), + build_dir.to_str().unwrap(), if i != 1 { "s" } else { "" } ); thread::sleep(Duration::from_secs(1)); } thread::sleep(Duration::from_secs(2)); - fs::remove_dir_all(&cli.build_dir)?; + fs::remove_dir_all(&build_dir)?; } - fs::create_dir_all(&cli.build_dir).context("while creating build dir")?; + fs::create_dir_all(&build_dir).context("while creating build dir")?; - let mut picker = FilePicker::new( - bundle_config.clone(), - cli.build_dir.clone(), - bundle_dir.clone(), - )?; + let mut picker = FilePicker::new(bundle_config.clone(), build_dir.clone(), bundle_dir.clone())?; // Run selector let sources: Vec = picker.iter_sources().map(|x| x.to_string()).collect(); @@ -110,16 +105,18 @@ pub(super) fn pack(cli: &BundleCreateCommand) -> Result<()> { file.read_to_string(&mut file_str)?; let bundle_config: BundleSpec = toml::from_str(&file_str)?; + let build_dir = cli.build_dir.join(&bundle_config.bundle.name); + if !cli.build_dir.join("content").is_dir() { error!( "content directory `{}/content` doesn't exist, can't continue", - cli.build_dir.to_str().unwrap() + build_dir.to_str().unwrap() ); return Ok(()); } let target_name = format!("{}.ttb", &bundle_config.bundle.name); - let target = cli.build_dir.join(&target_name); + let target = build_dir.join(&target_name); if target.exists() { if target.is_file() { warn!("target bundle `{target_name}` exists, removing"); @@ -132,7 +129,7 @@ pub(super) fn pack(cli: &BundleCreateCommand) -> Result<()> { match cli.format { BundleFormat::BundleV1 => { - BundleV1::make(Box::new(File::create(target)?), cli.build_dir.clone())? + BundleV1::make(Box::new(File::create(target)?), build_dir.clone())? } }