aboutsummaryrefslogtreecommitdiff
path: root/reproduce/analysis/make/initialize.mk
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/analysis/make/initialize.mk')
-rw-r--r--reproduce/analysis/make/initialize.mk65
1 files changed, 48 insertions, 17 deletions
diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk
index 6b25f02..fbd110f 100644
--- a/reproduce/analysis/make/initialize.mk
+++ b/reproduce/analysis/make/initialize.mk
@@ -302,27 +302,47 @@ $(project-package-contents): paper.pdf | $(texdir)
sed -e's|\\newcommand{\\makepdf}{}|%\\newcommand{\\makepdf}{}|' \
paper.tex > $$dir/paper.tex
- # Build the top-level directories.
- mkdir $$dir/reproduce $$dir/tex $$dir/tex/tikz $$dir/tex/build
-
- # Copy all the necessary `reproduce' and `tex' contents.
+ # Copy ONLY the version-controlled files in 'reproduce' and
+ # 'tex/src'. This is important because files like 'LOCAL.conf' (in
+ # 'reproduce/software/config') should not be archived, they contain
+ # information about the host computer and are irrelevant for
+ # others. Also some project authors may have temporary files here
+ # that are not under version control and thus shouldn't be archived
+ # (although this is bad practice, but that is up to the user).
+ #
+ # To keep the sub-directory structure, we are packaging the files
+ # with Tar, piping it, and unpacking it in the archive
+ # directory. So afterwards we need to come back to the current
+ # directory.
+ tar -c -f - $$(git ls-files reproduce tex/src) \
+ | (cd $$dir ; tar -x -f -)
+ cd $(curdir)
+
+ # Build the other two subdirectories of 'tex/' that we need in the
+ # archive (in the actual project, these are symbolic links to the
+ # build directory).
+ mkdir $$dir/tex/tikz $$dir/tex/build
+
+ # Copy the 'tex/build' directory into the archive (excluding the
+ # temporary archive directory that we are now copying to). We will
+ # be using Bash's extended globbing ('extglob') for excluding this
+ # directory.
shopt -s extglob
- cp -r tex/src $$dir/tex/src
- cp -r tex/img $$dir/tex/img
- cp tex/tikz/*.eps $$dir/tex/tikz
- cp -r reproduce/* $$dir/reproduce
+ cp -r tex/img $$dir/tex/img
+ cp tex/tikz/*.eps $$dir/tex/tikz
cp -r tex/build/!($(project-package-name)) $$dir/tex/build
- # Clean up un-necessary/local files: 1) the $(texdir)/build*
- # directories (when building in a group structure, there will be
- # `build-user1', `build-user2' and etc), are just temporary LaTeX
- # build files and don't have any relevant/hand-written files in
- # them. 2) The `LOCAL.conf' and `gnuastro-local.conf' files just
- # have this machine's local settings and are irrelevant for anyone
- # else.
+ # Clean up the $(texdir)/build* directories in the archive (when
+ # building in a group structure, there will be `build-user1',
+ # `build-user2' and etc). These are just temporary LaTeX build
+ # files and don't have any relevant/hand-written files in them.
rm -rf $$dir/tex/build/build*
- rm $$dir/reproduce/software/config/LOCAL.conf
- rm $$dir/reproduce/analysis/config/gnuastro/gnuastro-local.conf
+
+ # If the project has any PDFs in its 'tex/tikz' directory (TiKZ or
+ # PGFPlots was used to generate them), copy them too.
+ if ls tex/tikz/*.pdf &> /dev/null; then
+ cp tex/tikz/*.pdf $$dir/tex/tikz
+ fi
# When submitting to places like arXiv, they will just run LaTeX
# once and won't run `biber'. So we need to also keep the `.bbl'
@@ -474,3 +494,14 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
# Zenodo identifier (necessary for download link):
v=$$(echo $(metadata-doi-zenodo) | sed -e's/\./ /g' | awk '{print $$NF}')
echo "\newcommand{\projectzenodoid}{$$v}" >> $@
+
+ # Calculate the latest Maneage commit used to build this
+ # project:
+ # - 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
+ echo "\newcommand{\maneageversion}{$$v}" >> $@