From cbe30304c50c659b088a698c148b86a24da6b7d6 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Sun, 10 Jan 2021 03:32:54 +0000 Subject: make dist: removing temp files moved after project-specific files Until now, when you ran './project make dist', first it would delete the temporary files (like files ending in '~' or '.swp' created by some editors), then it had a place to add project-specific operations for the distribution. However, in the process of cleaning the temporary files, it would 'cd' into the directory that would later be packaged. So project-specific operations would first have to 'cd' back into the top source directory. This was prone to hard-to-find bugs. With this commit, to avoid the problem the project-specific operations are now placed before the cleaning phase. This is also technically good because in the project-specific operations there may also be temporary files that shouldn't go into the distribution tarball. --- reproduce/analysis/make/initialize.mk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'reproduce/analysis/make') diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk index 3b1ffe5..81943db 100644 --- a/reproduce/analysis/make/initialize.mk +++ b/reproduce/analysis/make/initialize.mk @@ -374,16 +374,17 @@ $(project-package-contents): paper.pdf | $(texdir) sed -e's|{tikz/}|{tex/tikz/}|' $$pgfsettings > $$pgfsettings.new mv $$pgfsettings.new $$pgfsettings - # Clean temporary (currently those ending in `~') files. - cd $(texdir) - find $(project-package-name) -name \*~ -delete - find $(project-package-name) -name \*.swp -delete - # PROJECT SPECIFIC # ---------------- - # Put any project specific distribution steps here. + # Put any project-specific distribution steps here. + # ---------------- + # Clean temporary files that may have been created by text editors. + cd $(texdir) + find $(project-package-name) -name \*~ -delete + find $(project-package-name) -name \*.swp -delete + # Package into `.tar.gz' or '.tar.lz'. dist dist-lzip: $(project-package-contents) curdir=$$(pwd) -- cgit v1.2.1 From ecbaadcc88ae38adb34e08755459318372ec13b8 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Tue, 12 Jan 2021 16:15:47 +0000 Subject: Default LaTeX preamble: some packages moved to preamble-project.tex Until now, important LaTeX packages like 'caption' (for managing figure captions), 'hyperref' (for managing links) and 'xcolor' (for managing colors) were being loaded inside the optional 'tex/src/preamble-maneagge-defualt-style.tex' file. We recommend to remove this file from loading when you use custom journal sytels. However, these packages will often be necessary after loading special journal styles also. With this commit, these packages are now loaded into LaTeX as part of the 'tex/src/preamble-project.tex' file. This file is in charge of LaTeX settings that are custom to the project and independent of its style. Several other small corrections are made with this commit: - I noticed that './project make texclean' crashes if no PDF exists in the working directory! So a '-f' was added to the 'rm' command of the 'texclean' rule. - As part of the LaTeX Hyperref, we can set general metadata or properties for the PDF (that aren't written into the printable PDF, but into the file metadata). They can be viewed in many PDF viewers as PDF properties. Until now, we were only using the '\projecttitle' macro here to write the paper's title. However, thanks to the recently added 'reproduce/analysis/config/metadata.conf', we now have a lot of useful information that can also go here. So the 'metadata-copyright-owner' is now used to define the PDF author, and the project's 'metadata-git-repository' and commit hash are written into the PDF subject. But to import these, it was necessary to define them as LaTeX macros, hence the addition of these macros in 'initialize.mk'. - Some extra packages that aren't necessary to build the default PDF were removed in 'preamble-project.tex'. --- reproduce/analysis/make/initialize.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'reproduce/analysis/make') diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk index 81943db..886c0a7 100644 --- a/reproduce/analysis/make/initialize.mk +++ b/reproduce/analysis/make/initialize.mk @@ -237,7 +237,7 @@ clean-mmap:; rm -f reproduce/config/gnuastro/mmap* # ------------------------------------------ texclean: - rm *.pdf + rm -f *.pdf rm -rf $(texdir)/build/* mkdir $(texdir)/build/tikz # 'tikz' is assumed to already exist. @@ -505,6 +505,8 @@ $(mtexdir)/initialize.tex: | $(mtexdir) echo "\newcommand{\projectdate}{$$d}" > $@ echo "\newcommand{\projecttitle}{$(metadata-title)}" >> $@ echo "\newcommand{\projectversion}{$(project-commit-hash)}" >> $@ + echo "\newcommand{\projectgitrepo}{$(metadata-git-repository)}" >> $@ + echo "\newcommand{\projectcopyrightowner}{$(metadata-copyright-owner)}" >> $@ # Calculate the latest Maneage commit used to build this # project: -- cgit v1.2.1 From 611c2f1e6ebbd4e4f83b66325707afb7038d1026 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 26 Mar 2021 20:37:35 +0000 Subject: Initialization: removed other Gnuastro-specific features In the previous commit, some Gnuastro-specific initializations were removed but a few more cases remained that are removed with this commit. --- reproduce/analysis/make/initialize.mk | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'reproduce/analysis/make') diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk index 886c0a7..15a4dbf 100644 --- a/reproduce/analysis/make/initialize.mk +++ b/reproduce/analysis/make/initialize.mk @@ -229,19 +229,15 @@ project-package-contents = $(texdir)/$(project-package-name) # 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. -.PHONY: all clean dist dist-zip dist-lzip texclean distclean clean-mmap \ +.PHONY: all clean dist dist-zip dist-lzip texclean distclean \ $(project-package-contents) $(mtexdir)/initialize.tex -# --------- Delete for no Gnuastro --------- -clean-mmap:; rm -f reproduce/config/gnuastro/mmap* -# ------------------------------------------ - texclean: rm -f *.pdf rm -rf $(texdir)/build/* mkdir $(texdir)/build/tikz # 'tikz' is assumed to already exist. -clean: clean-mmap +clean: # Delete the top-level PDF file. rm -f *.pdf @@ -266,8 +262,7 @@ distclean: clean # `rm' program. So for this recipe, we'll use the host system's # `rm', not our own. $$sys_rm -rf $(BDIR) - $$sys_rm -f $(pconfdir)/LOCAL.conf - $$sys_rm -f Makefile .gnuastro .local .build + $$sys_rm -f .local .build $(pconfdir)/LOCAL.conf -- cgit v1.2.1 From 20b6273a65ab4d99ad760fd715ca935494d4fc2e Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Sun, 28 Mar 2021 12:55:03 +0100 Subject: Configuration: corrected check of group name When built in 'group' mode, the write permissions of all created files will be activated for a certain group of users in the host operating system. The user specifies the name of the group with the '--group' option at configure time. At the very start, the './project' script checks to see if the given group name actually exists or not (to avoid hard-to-debug errors popping up later). Until now, the checking 'sg' command (that was used to build the project with group-writable permissions) would always fail due to the excessive number of redirections. Therefore, it would always print the error message and abort. With this commit, the output of 'sg' is no longer re-directed (which also helps users in debuggin). If the group does actually exist, it will just print a small statement saying so, and if it fails, the error message is printed. This fixed the problem, allowing maneage to be built in group-mode. I also noticed that the variable name keeping the group name ('reproducible_paper_group_name') used the old name for the project (which was "Reproducible paper template"! So it has been changed/corrected to 'maneage_group_name'. --- reproduce/analysis/make/top-make.mk | 4 ++-- reproduce/analysis/make/top-prepare.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'reproduce/analysis/make') diff --git a/reproduce/analysis/make/top-make.mk b/reproduce/analysis/make/top-make.mk index 026220e..596cc0d 100644 --- a/reproduce/analysis/make/top-make.mk +++ b/reproduce/analysis/make/top-make.mk @@ -51,7 +51,7 @@ include reproduce/software/config/LOCAL.conf # Controlling this requires two variables that are available at this stage: # # - `GROUP-NAME': from `LOCAL.conf' (which was built by `./project configure'). -# - `reproducible_paper_group_name': value to the `--group' option. +# - `maneage_group_name': value to the `--group' option. # # The analysis is only done when both have the same group name. Note that # when the project isn't being built for a group, both variables will be an @@ -64,7 +64,7 @@ include reproduce/software/config/LOCAL.conf # If you are just interested in the processing and don't want to build the # PDF, you can skip the creation of the final PDF by giving a value of # `yes' to `pdf-build-final' in `reproduce/analysis/config/pdf-build.conf'. -ifeq (x$(reproducible_paper_group_name),x$(GROUP-NAME)) +ifeq (x$(maneage_group_name),x$(GROUP-NAME)) all: paper.pdf else all: diff --git a/reproduce/analysis/make/top-prepare.mk b/reproduce/analysis/make/top-prepare.mk index f81ac07..fb5700e 100644 --- a/reproduce/analysis/make/top-prepare.mk +++ b/reproduce/analysis/make/top-prepare.mk @@ -35,7 +35,7 @@ include reproduce/software/config/LOCAL.conf # ------------------------------- # # See `top-make.mk' for complete explanation. -ifeq (x$(reproducible_paper_group_name),x$(GROUP-NAME)) +ifeq (x$(maneage_group_name),x$(GROUP-NAME)) all: $(BDIR)/software/preparation-done.mk @echo "Project preparation is complete."; else -- cgit v1.2.1 From 6e4ec9a305f7021643fe22e08fe0ad17dd363a93 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Sat, 17 Apr 2021 04:31:31 +0100 Subject: IMPORTANT: print-general-metadata new name for print-copyright Summary: - Use the new name of this variable in your Makefiles. - In 'metadata.conf', remove fixed URL prefixes for DOIs ('https://doi.org/') or arXiv ('https://arxiv.org/abs'). Until now, the Make variable that would print the general metadata (of whole project) into each to-be-published dataset was called 'print-copyright'! But it now does much more than simply printing the copyright, it will also print a lot of metadata like arXiv ID, Zenodo DOI and etc into plain-text outputs. The out-dated name could thus be misleading and cause confusions. With this commit, the variable is therefore called 'print-general-metadata'. After merging your project with the Maneage branch, please replace any usage of 'print-copyright' to 'print-general-metadata'. Also with this commit, 'README-hacking.md' mentions 'metadata.conf' and 'print-general-metadata' in the "Publication checklist" section and reminds you to keep the first up to date, and use the second in your to-be-published datasets. --- reproduce/analysis/make/delete-me.mk | 4 ++-- reproduce/analysis/make/initialize.mk | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'reproduce/analysis/make') diff --git a/reproduce/analysis/make/delete-me.mk b/reproduce/analysis/make/delete-me.mk index f275051..c160e51 100644 --- a/reproduce/analysis/make/delete-me.mk +++ b/reproduce/analysis/make/delete-me.mk @@ -48,7 +48,7 @@ $(dm-squared): $(pconfdir)/delete-me-squared-num.conf | $(tex-publish-dir) echo "# Column 2: X_POW2 [arbitrary, f32] The horizontal axis to the power of two." \ >> $@.tmp echo "# " >> $@.tmp - $(call print-copyright, $@.tmp) + $(call print-general-metadata, $@.tmp) # Generate the table of random values. awk 'BEGIN {for(i=1;i<=$(delete-me-squared-num);i+=0.5) \ @@ -107,7 +107,7 @@ $(dm-img-histogram): $(tex-publish-dir)/%-histogram.txt: $(indir)/%.fits \ echo "# " >> $@.tmp awk '/^# Column .:/' $@.data >> $@.tmp echo "# " >> $@.tmp - $(call print-copyright, $@.tmp) + $(call print-general-metadata, $@.tmp) # Add the column numbers in a formatted manner, rename it to the # output and clean up. diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk index 15a4dbf..744ecbf 100644 --- a/reproduce/analysis/make/initialize.mk +++ b/reproduce/analysis/make/initialize.mk @@ -461,19 +461,27 @@ $(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 = \ +# The 'print-general-metadata' can be used to print the general metadata in +# published datasets that are in plain-text format. It should be called +# with make's 'call' function like this (where 'FILENAME' is the name of +# the file it will append this content to): +# +# $(call print-general-metadata, FILENAME) +# +# See 'reproduce/analysis/make/delete-me.mk' (in the Maneage branch) for a +# real-world usage of this variable. +doi-prefix-url = https://doi.org +arxiv-prefix-url = https://arxiv.org/abs +print-general-metadata = \ 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); \ + echo "\# Git repository: $(metadata-git-repository)" >> $(1); \ if [ x$(metadata-arxiv) != x ]; then \ - echo "\# Pre-print server: https://arxiv.org/abs/$(metadata-arxiv)" >> $(1); fi; \ + echo "\# Pre-print: $(arxiv-prefix-url)/abs/$(metadata-arxiv)" >> $(1); fi; \ if [ x$(metadata-doi-journal) != x ]; then \ - echo "\# DOI (Journal): $(metadata-doi-journal)" >> $(1); fi; \ + echo "\# DOI (Journal): $(doi-prefix-url)/$(metadata-doi-journal)" >> $(1); fi; \ if [ x$(metadata-doi-zenodo) != x ]; then \ - echo "\# DOI (Zenodo): $(metadata-doi-zenodo)" >> $(1); fi; \ + echo "\# DOI (Zenodo): $(doi-prefix-url)/$(metadata-doi-zenodo)" >> $(1); fi; \ echo "\#" >> $(1); \ echo "\# Copyright (C) $$(date +%Y) $(metadata-copyright-owner)" >> $(1); \ echo "\# Dataset is available under $(metadata-copyright)." >> $(1); \ -- cgit v1.2.1