Other tasks: 1, 2, 3, 4, 5, 6, 7.

General notes

Use your GitLab repository to submit your solutions. Please, use exact filenames as specified in the task name.

Please, respect language requirements of individual tasks. For Python, we expect Python 3 as the default (if you really need to use Python 2, use a proper shebang). For shell scripts, we expect that you will use Bash although none of the tasks requires any use of Bashisms for an efficient solution.

Deadline for this set of tasks is 2020-07-26 AoE, it is required to get at least 5 points from this group.

Tasks description

06/Makefile (4 points)

Source code for this group of tasks is in thesis subdirectory of teaching/nswi177/2020-summer/upstream/examples repository.

The whole subdirectory contains LaTeX template for typesetting bachelor thesis at our faculty. The template comes originally from here. We have extended it a little bit to show you that you can use LaTeX even without learning it in great detail.

If you look into content/, you will see several Markdown files. Each represents one chapter. These files are processed by Pandoc that converts them to LaTeX and they are inserted into the main LaTeX document that is later converted into PDF.

All this is automated by the build.sh script that converts the individual chapters and generates the final PDF.

Your first task is to convert this script into Makefile to ensure that the final PDF is properly re-made but no unnecessary computation takes place.

Updates

You will need to install the following packages: pandoc, latexmk and TeX Live. Note that Tex Live packaging differs across distributions, for Fedora we recommend to install texlive-scheme-medium that covers most of the usually needed packages and also texlive-pdfx.

If the PDF generation stops in the middle with a ? prompt, you probably have not installed some package: its name is hidden in some of the preceding lines. You can also try to hit Enter only to continue the compilation (of the PDF) or X to terminate.

Note that we have also updated the upstream repository: we have moved thesis.xmpdata one folder up.

make clean (1 point)

Add target clean to the Makefile that removes all generated files.

Automated table (2 points)

The table src/tab_test_overview.tex is actually computed from data/tests.csv.

To ensure that the (fictional) thesis would always contain the most up-to-date data, implement a script that generates the table from the CSV source data.

Ensure that the Makefile rule captures properly the dependency (i.e. do not regenerate the table if the source CSV does not change but regenerate the PDF if the table changes).

The table is actually very simple – it lists tests, configurations and number of rows for this pair.

You can use Python or Shell for implementing this script. Note that the core of the script is just sort | uniq -c so do not look for extra complexities.

Do not forget to remove the original table from src/. There is no need to store the table in Git if we are able to recompute it. And recompute it quickly.

Also note that it would make more sense to store the table in out/ as other generated files.

Automated plots (3 points)

You probably noticed that the thesis contains one plot. Use pyplot to generate a bar-plot showing maximum for each test (i.e. ignore the configuration column altogether).

Note that the current plot was taken as a demonstration only and does not show the intended result of your script.

Look into content/80-evaluation.md to see how the image is inserted into the final PDF. You will probably want to change the path to the file, you will not need to modify the rest of the code.

Ensure that the Makefile rule captures properly the dependency (i.e. do not regenerate the plot if the source CSV does not change but regenerate the PDF if the plot changes).

Important: generate the image as PDF or other LaTeX-compatible vector format. We will not accept solution generating a bitmap.

Spell checker (2 points)

Add (phony) target spelling to your Makefile that runs Aspell on your input files to help you fix spelling typos.

We leave it to you what exactly the command will do. It can run the interactive check, it can highlight misspelled words (grep --color style) or …

GitLab job artifact (2 points)

Add .gitlab-ci.yml to your repository (if you do not have it there already) that builds the PDF.

Configure the job so that it stores as an artifact the generated PDF.

Please, ensure that the artefact expires in less than a week.

Update: we recommend to use aergus/latex as the image in your GitLab CI. This image also contains Pandoc and make.

Ostatní úlohy: 1, 2, 3, 4, 5, 6, 7.

Obecné požadavky

Úkoly odevzdávejte do Vašeho GitLabového repozitáře. Prosím, dodržujte přesné pojmenování souborů jak je uvedeno u názvu úkolu.

Prosím, dodržujte požadovaný jazyk jednotlivých úloh. Pro úlohy v Pythonu očekáváme použití Pythonu verze 3 (pokud doopravdy potřebujete verzi 2, nezapomeňte na správný shebang). Pro shellové skripty, očekáváme, že budete používat Bash. Nicméně, žádný z úkolů nevyžaduje použití Bashismu pro efektivní řešení.

Deadline pro tuto sadu úloh je 2020-07-26 KnZ, pro úspěšné splnění potřebujete získat alespoň 5 bodů.

Úlohy

06/Makefile (4 body)

Zdrojové kódy pro tuto sérii úloh se nachází v podadresáři thesis v repositáři teaching/nswi177/2020-summer/upstream/examples.

Celý podadresář obsahuje šablonu pro sázecí systém LaTeX, který můžete použít pro přípravu bakalářské práce na naší fakultě. Originál šablony můžete najít zde. Šablonu jsme trochu rozšířili, abychom Vám ukázali, že se dá LaTeX použít i když s ním nemáte příliš mnoho zkušeností.

V adresáři content/, uvidíte řadu souborů ve formátu Markdown. Každý reprezentuje jednu kapitolu práce. Tyto soubory jsou nástrojem Pandoc převedeny do formátu pro LaTeX a vloženy do hlavního LaTeX dokumentu, ze kterého se pak vyrobí výsledné PDF.

Toto všechno je automatizované skriptem build.sh, který konvertuje jednotlivé kapitoly a generuje výsledné PDF.

Váš první úkol je převést tento skript na Makefile, aby se výsledné PDF negenerovalo v případě, že se žádný ze zdrojových souboru nezmění.

Aktualizace

Budete potřebovat nainstalovat následující balíčky: pandoc, latexmk a TeX Live. Balíčkování Tex Live se liší napříč distribucemi, pro Fedoru doporučujeme nainstalovat texlive-scheme-medium, který pokrývá většinu běžně potřebých balíčků a také texlive-pdfx.

Pokud se vytváření PDF zastaví s promptem ?, asi nemáte nějaký balíček nainstalovaný: jeho jméno je ukryto někde v předchozích řádcích. Můžete také zkusit pouze stisknout Enter, aby kompilace (toho PDFka) pokračovala nebo ukončit pomocí X.

Také jsme zaktualizovali upstream repozitář: přesunuli jsme thesis.xmpdata o jednu složku výše.

make clean (1 bod)

Přidejte do Makefile target clean, který odstraní všechny generované soubory.

Automatizovaná tabulka (2 body)

Tabulka v src/tab_test_overview.tex se ve skutečnosti počítá z data/tests.csv.

Abychom zajistili, že (fiktivní) práce vždy obsahuje nejnovější data, naprogramujte skript, který generuje tabulku ze zdrojových dat v CSV formátu.

V Makefile pravidlech správně nastavte závislosti (tedy negenerujte tabulku, když se zdrojové CSV nezmění, a generujte PDF, pokud se tabulka změní).

Tabulka je ve skutečnosti velmi jednoduchá – obsahuje seznam testů, testových konfigurací a počet řádků pro tuto dvojici.

Pro implementaci můžete použít Python nebo Shell. Nehledejte v tom žádnou vědu, základem je pouze volání sort | uniq -c.

Nezapomeňte původní tabulku odstranit ze src/. Není důvod tabulku ukládat v Gitu, když jí umíme přepočítat. A umíme to rychle.

Všimněte si, že by bylo rozumnější pak tabulku ukládat v adresáři out/ jako ostatní generované soubory.

Automatizovaný graf (3 body)

Také jste si asi všimli, že práce obsahuje jeden graf. Nástrojem pyplot vygenerujte jeden sloupcový graf, ukazující maximum pro každý test (konfiguraci ignorujte).

Současný graf byl do práce vložen pro demonstrační účely a nezobrazuje předpokládaný výsledek vašeho skriptu.

Podívejte se do souboru content/80-evaluation.md, kde najdete jak se graf vkládá do PDF. Pravděpodobně budete chtít změnit cestu k souboru. Nic jiného v souboru není potřeba měnit.

V Makefile pravidlech správně nastavte závislosti (tedy negenerujte graf, když se zdrojové CSV nezmění, a generujte PDF, pokud se graf změní).

Pozor: obrázek generujte jako PDF nebo nějaký jiný vektorový formát kompatibilní se systémem LaTeX. Řešení, které generuje bitmapu neakceptujeme.

Spell checker (2 body)

Přidejte (phony) target spelling do Makefile, který na vstupních souborech spouští Aspell. Toto slouží pro opravování překlepů v práci.

Necháváme na vás, co přesně tento příkaz má dělat. Může spustit interaktivní režim, může zvýraznit chybně napsaná slova (ve stylu grep --color) nebo …

GitLab job artifact (2 body)

Do repositáře přidejte .gitlab-ci.yml (pokud jej tam ještě nemáte), který generuje výsledné PDF.

Job nakonfigurujte tak, že se výsledné PDF uloží jako artefakt.

Prosím, zajistěte, že artefaktu vyprší platnost za méně než týden.

Aktualizace: doporučujeme použít aergus/latex jako image ve vašem GitLab CI. Tento obraz obsahuje i Pandoc a make.