From b910b2e493972db368874752ac033ab7c41696dd Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Mon, 14 Dec 2020 02:14:34 +0000 Subject: Better warnings when maneage branch not present and PDF not built Until now, there was no warning when the 'maneage' branch didn't exist in the Git history. This can happen when you forget to push the 'maneage' branch to a remote for your project, and you later clone your project from that remote (for example on another computer). We use the 'maneage' branch to report the latest commit hash and date in the final paper (which can greatly help future readers). Since we check the 'maneage' branch on every run of './project make' (in 'initialize.mk') this would result in a printed statement like this: fatal: Not a valid object name maneage Also until now, the description of what to do when TeXLive wasn't installed properly wasn't complete: it didn't mention that it is necessary to delete the TeXLive target files. This could confuse users (they would re-run './project configure -e', but with no effect). With this commit, for the 'maneage' branch issue a complete warning will be printed. Telling the user what to do to get the 'maneage' branch (and thus fix this warning). Also, the LaTeX macros that go in the paper are now red when the 'maneage' branch doesn't exist, telling the user to see the printed warning (thus encouraging the user to get the branch). For the TeXLive issue, the necessary commands to run are now also printed in the warning. --- reproduce/analysis/make/initialize.mk | 28 +++++++++++++++++++++++----- reproduce/analysis/make/paper.mk | 15 ++++++++------- 2 files changed, 31 insertions(+), 12 deletions(-) (limited to 'reproduce/analysis/make') diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk index 3649fd2..ce0ac95 100644 --- a/reproduce/analysis/make/initialize.mk +++ b/reproduce/analysis/make/initialize.mk @@ -489,13 +489,31 @@ $(mtexdir)/initialize.tex: | $(mtexdir) # Calculate the latest Maneage commit used to build this # project: + # - The project may not have the 'maneage' branch (for example + # after cloning from a fork that didn't include it!). In this + # case, we'll print a descriptive warning, telling the user what + # should be done (reporting the last merged commit and its date + # is very useful for the future). # - The '--dirty' option (used in 'project-commit-hash') isn't # applicable to "commit-ishes" (direct quote from Git's error # message!). - # - The project may not have the 'maneage' branch (for example - # after cloning from a fork that didn't include it!). In this - # case, we'll just return the string a clear string. - v=$$(git describe --always --long maneage) || v=maneage-ref-missing - d=$$(git show -s --format=%aD $$v | awk '{print $$2, $$3, $$4}') + if git log maneage -1 &> /dev/null; then + c=$$(git merge-base HEAD maneage) + v=$$(git describe --always --long $$c) + d=$$(git show -s --format=%aD $$v | awk '{print $$2, $$3, $$4}') + else + echo + echo "WARNING: no 'maneage' branch found! Without it, the latest merge of " + echo "this project with Maneage can't be reported in the paper (which is bad " + echo "for your readers; that includes yourself in a few years). Please run " + echo "the commands below to fetch the 'maneage' branch from its own server " + echo "and remove this warning (these commands will not affect your project):" + echo " $ git remote add origin-maneage http://git.maneage.org/project.git" + echo " $ git fetch origin-maneage" + echo " $ git branch maneage --track origin-maneage/maneage" + echo + v="\textcolor{red}{NO-MANEAGE-BRANCH (see printed warning to fix this)}" + d="\textcolor{red}{NO-MANEAGE-DATE}" + fi echo "\newcommand{\maneagedate}{$$d}" >> $@ echo "\newcommand{\maneageversion}{$$v}" >> $@ diff --git a/reproduce/analysis/make/paper.mk b/reproduce/analysis/make/paper.mk index fc10699..2d8a0c9 100644 --- a/reproduce/analysis/make/paper.mk +++ b/reproduce/analysis/make/paper.mk @@ -72,14 +72,15 @@ $(mtexdir)/project.tex: $(mtexdir)/verify.tex echo "LaTeX-built PDF paper will not be built." echo if [ x$(more-on-building-pdf) = x1 ]; then - echo "To build the PDF, make sure you have LaTeX within the " - echo "project (you can check by running " - echo "'./.local/bin/latex --version'), _AND_ make sure that " - echo "the 'pdf-build-final' variable has a value of 'yes', it " - echo "is defined in: 'reproduce/analysis/config/pdf-build.conf'." + echo "To build the PDF, make sure that the 'pdf-build-final' " + echo "variable has a value of 'yes' (it is defined in this file)" + echo " reproduce/analysis/config/pdf-build.conf" echo - echo "If you don't have LaTeX within the project, please re-run" - echo "'./project configure -e' when you have internet access." + echo "If you still see this message, there was a problem with " + echo "building LaTeX within the project. You can re-try building" + echo "it when you have internet access with the two commands below:" + echo " $ rm .local/version-info/tex/texlive*" + echo " $./project configure -e" else echo "For more, run './project make more-on-building-pdf=1'" fi -- cgit v1.2.1