aboutsummaryrefslogtreecommitdiff
path: root/reproduce/analysis/make/initialize.mk
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-02 03:45:46 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-06 20:56:39 +0100
commit623ae15c95bb8575b111709705c29b10fcf7c12b (patch)
tree5ea7016e7f81428f9f484458489ef4ba91dffaaa /reproduce/analysis/make/initialize.mk
parentad2b08d9c3f2500449cb28c903930af2c677d534 (diff)
IMPORTANT: Added publication checklist, improved relevant infrastructure
Possible semantic conflicts (that may not show up as Git conflicts but may cause a crash in your project after the merge): 1) The project title (and other basic metadata) should be set in 'reproduce/analysis/conf/metadata.conf'. Please include this file in your merge (if it is ignored because of '.gitattributes'!). 2) Consider importing the changes in 'initialize.mk' and 'verify.mk' (if you have added all analysis Makefiles to the '.gitattributes' file (thus not merging any change in them with your branch). For example with this command: git diff master...maneage -- reproduce/analysis/make/initialize.mk 3) The old 'verify-txt-no-comments-leading-space' function has been replaced by 'verify-txt-no-comments-no-space'. The new function will also remove all white-space characters between the columns (not just white space characters at the start of the line). Thus the resulting check won't involve spacing between columns. A common set of steps are always necessary to prepare a project for publication. Until now, we would simply look at previous submissions and try to follow them, but that was prone to errors and could cause confusion. The internal infrastructure also didn't have some useful features to make good publication possible. Now that the submission of a paper fully devoted to the founding criteria of Maneage is complete (arXiv:2006.03018), it was time to formalize the necessary steps for easier submission of a project using Maneage and implement some low-level features that can make things easier. With this commit a first draft of the publication checklist has been added to 'README-hacking.md', it was tested in the submission of arXiv:2006.03018 and zenodo.3872248. To help guide users on implementing the good practices for output datasets, the outputs of the default project shown in the paper now use the new features). After reading the checklist, please inspect these. Some other relevant changes in this commit: - The publication involves a copy of the necessary software tarballs. Hence a new target ('dist-software') was also added to package all the project's software tarballs in one tarball for easy distribution. - A new 'dist-lzip' target has been defined for those who want to distribute an Lzip-compressed tarball. - The '\includetikz' LaTeX macro now has a second argument to allow configuring the '\includegraphics' call when the plot should not be built, but just imported.
Diffstat (limited to 'reproduce/analysis/make/initialize.mk')
-rw-r--r--reproduce/analysis/make/initialize.mk135
1 files changed, 111 insertions, 24 deletions
diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk
index 4e317bb..19447a6 100644
--- a/reproduce/analysis/make/initialize.mk
+++ b/reproduce/analysis/make/initialize.mk
@@ -202,6 +202,16 @@ $(lockdir): | $(BDIR); mkdir $@
+# Version and distribution tarball definitions
+project-commit-hash := $(shell if [ -d .git ]; then \
+ echo $$(git describe --dirty --always --long); else echo NOGIT; fi)
+project-package-name := maneaged-$(project-commit-hash)
+project-package-contents = $(texdir)/$(project-package-name)
+
+
+
+
+
# High-level Makefile management
# ------------------------------
#
@@ -212,11 +222,8 @@ $(lockdir): | $(BDIR); mkdir $@
# we want to ensure that the file is always built in every run: it contains
# the project version which may change between two separate runs, even when
# no file actually differs.
-packagebasename := $(shell if [ -d .git ]; then \
- echo paper-$$(git describe --dirty --always --long); else echo NOGIT; fi)
-packagecontents = $(texdir)/$(packagebasename)
-.PHONY: all clean dist dist-zip distclean clean-mmap $(packagecontents) \
- $(mtexdir)/initialize.tex
+.PHONY: all clean dist dist-zip dist-lzip distclean clean-mmap \
+ $(project-package-contents) $(mtexdir)/initialize.tex
# --------- Delete for no Gnuastro ---------
clean-mmap:; rm -f reproduce/config/gnuastro/mmap*
@@ -260,11 +267,11 @@ distclean: clean
# that is ready for building the final PDF with LaTeX. This is useful for
# collaborators who only want to contribute to the text of your project,
# without having to worry about the technicalities of the analysis.
-$(packagecontents): paper.pdf | $(texdir)
+$(project-package-contents): paper.pdf | $(texdir)
# Set up the output directory, delete it if it exists and remake it
# to fill with new contents.
- dir=$(texdir)/$(packagebasename)
+ dir=$@
rm -rf $$dir
mkdir $$dir
@@ -298,7 +305,7 @@ $(packagecontents): paper.pdf | $(texdir)
cp -r tex/src $$dir/tex/src
cp tex/tikz/*.pdf $$dir/tex/tikz
cp -r reproduce/* $$dir/reproduce
- cp -r tex/build/!(paper-v*) $$dir/tex/build
+ 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
@@ -337,32 +344,113 @@ $(packagecontents): paper.pdf | $(texdir)
# Clean temporary (currently those ending in `~') files.
cd $(texdir)
- find $(packagebasename) -name \*~ -delete
- find $(packagebasename) -name \*.swp -delete
+ find $(project-package-name) -name \*~ -delete
+ find $(project-package-name) -name \*.swp -delete
# PROJECT SPECIFIC
# ----------------
# Put any project specific distribution steps here.
# ----------------
-# Package into `.tar.gz'.
-dist: $(packagecontents)
+# Package into `.tar.gz' or '.tar.lz'.
+dist dist-lzip: $(project-package-contents)
curdir=$$(pwd)
cd $(texdir)
- tar -cf $(packagebasename).tar $(packagebasename)
- gzip -f --best $(packagebasename).tar
- rm -rf $(packagebasename)
+ tar -cf $(project-package-name).tar $(project-package-name)
+ if [ $@ = dist ]; then
+ suffix=gz
+ gzip -f --best $(project-package-name).tar
+ elif [ $@ = dist-lzip ]; then
+ suffix=lz
+ lzip -f --best $(project-package-name).tar
+ fi
+ rm -rf $(project-package-name)
cd $$curdir
- mv $(texdir)/$(packagebasename).tar.gz ./
+ mv $(texdir)/$(project-package-name).tar.$$suffix ./
# Package into `.zip'.
-dist-zip: $(packagecontents)
+dist-zip: $(project-package-contents)
curdir=$$(pwd)
cd $(texdir)
- zip -q -r $(packagebasename).zip $(packagebasename)
- rm -rf $(packagebasename)
+ zip -q -r $(project-package-name).zip $(project-package-name)
+ rm -rf $(project-package-name)
+ cd $$curdir
+ mv $(texdir)/$(project-package-name).zip ./
+
+# Package the software tarballs.
+dist-software:
+ curdir=$$(pwd)
+ cd $(BDIR)
+ if [ -d .git ]; then
+ dirname="software-$$(git describe --dirty --always --long)"
+ else
+ dirname="software-NOGIT";
+ fi
+ mkdir $$dirname
+ cp -L software/tarballs/* $$dirname/
+ tar -cf $$dirname.tar $$dirname
+ gzip -f --best $$dirname.tar
+ rm -rf $$dirname
cd $$curdir
- mv $(texdir)/$(packagebasename).zip ./
+ mv $(BDIR)/$$dir.tar.gz ./
+
+
+
+
+
+# Directory containing to-be-published datasets
+# ---------------------------------------------
+#
+# Its good practice (so you don't forget in the last moment!) to have all
+# the plot/figure/table data that you ultimately want to publish in a
+# single directory.
+#
+# There are two types of to-publish data in the project.
+#
+# 1. Those data that also go into LaTeX (for example to give to LateX's
+# PGFPlots package to create the plot internally) should be under the
+# '$(BDIR)/tex' directory (because other LaTeX producers may also need
+# it for example when using './project make dist'). The contents of
+# this directory are directly taken into the tarball.
+#
+# 2. The data that aren't included directly in the LaTeX run of the paper,
+# can be seen as supplements. A good place to keep them is under your
+# build-directory.
+#
+# RECOMMENDATION: don't put the figure/plot/table number in the names of
+# your to-be-published datasets! Given them a descriptive/short name that
+# would be clear to anyone who has read the paper. Later, in the caption
+# (or paper's tex/appendix), you will put links to the dataset on servers
+# like Zenodo (see the "Publication checklist" in 'README-hacking.md').
+tex-publish-dir = $(texdir)/to-publish
+data-publish-dir = $(BDIR)/data-to-publish
+$(tex-publish-dir):; mkdir $@
+$(data-publish-dir):; mkdir $@
+
+
+
+
+
+# Print Copyright statement
+# -------------------------
+#
+# This statement can be used in published datasets that are in plain-text
+# format. It assumes you have already put the data-specific statements in
+# its first argument, it will supplement them with general project links.
+print-copyright = \
+ echo "\# Project title: $(metadata-title)" >> $(1); \
+ echo "\# Git commit (that produced this dataset): $(project-commit-hash)" >> $(1); \
+ echo "\# Project's Git repository: $(metadata-git-repository)" >> $(1); \
+ if [ x$(metadata-arxiv) != x ]; then \
+ echo "\# Pre-print server: arXiv:$(metadata-arxiv)" >> $(1); fi; \
+ if [ x$(metadata-doi-journal) != x ]; then \
+ echo "\# DOI (Journal): $(metadata-doi-journal)" >> $(1); fi; \
+ if [ x$(metadata-doi-zenodo) != x ]; then \
+ echo "\# DOI (Zenodo): $(metadata-doi-zenodo)" >> $(1); fi; \
+ echo "\#" >> $(1); \
+ echo "\# Copyright (C) $$(date +%Y) $(metadata-copyright-owner)" >> $(1); \
+ echo "\# Dataset is available under $(metadata-copyright)." >> $(1); \
+ echo "\# License URL: $(metadata-copyright-url)" >> $(1);
@@ -377,7 +465,6 @@ dist-zip: $(packagecontents)
# actually exists, it is also aded as a `.PHONY' target above.
$(mtexdir)/initialize.tex: | $(mtexdir)
- # Version of the project.
- @if [ -d .git ]; then v=$$(git describe --dirty --always --long);
- else v=NO-GIT; fi
- echo "\newcommand{\projectversion}{$$v}" > $@
+ # Version and title of project.
+ echo "\newcommand{\projecttitle}{$(metadata-title)}" > $@
+ echo "\newcommand{\projectversion}{$(project-commit-hash)}" >> $@