diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2020-06-10 23:44:13 +0100 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2020-06-27 16:32:59 +0100 |
commit | c151eddbcc5f4208b40dc3037a8ae8adb0ff9173 (patch) | |
tree | 5a5eadb85053a0cf5852d9daa6992d5bdffba531 /project | |
parent | 5c3f2c4e38bec20616e4cf6ac568298a614df040 (diff) |
IMPORTANT: many improvements to low-level software building phase
POSSIBLE EFFECT ON YOUR PROJECT: The changes in this commit may only cause
conflicts to your project if you have changed the software building
Makefiles in your project's branch (e.g., 'basic.mk', 'high-level.mk' and
'python.mk'). If your project has only added analysis, it shouldn't be
affected.
This is a large commit, involving a long series of corrections in a
differnt branch which is now finally being merged into the core Maneage
branch. All changes were related and came up naturally as the low-level
infrastructure was improved. So separating them in the end for the final
merge would have been very time consuming and we are merging them as one
commit.
In general, the software building Makefiles are now much more easier to
read, modify and use, along with several new features that have been
added. See below for the full list.
- Until now, Maneage needed the host to have a 'make' implementation
because Make was necessary to build Lzip. Lzip is then used to
uncompress the source of our own GNU Make. However, in the
minimalist/slim versions of operating systems (for example used to build
Docker images) Make isn't included by default. Since Lzip was the only
program before our own GNU Make was installed, we consulting Antonio
Diaz Diaz (creator of Lzip) and he kindly added the necessary
functionality to a new version of Lzip, which we are using now. Hence we
don't need to assume a Make implementation on the host any more. With
this commit, Lzip and GNU Make are built without Make, allowing
everything else to be safely built with our own custom version of GNU
Make and not using the host's 'make' at all.
- Until recently (Commit 3d8aa5953c4) GNU Make was built in
'basic.mk'. Therefore 'basic.mk' was written in a way that it can be
used with other 'make' implementations also (i.e., important shell
commands starting with '&&' and ending in '\' without any comments
between them!). Furthermore, to help in style uniformity, the rules in
'high-level.mk' and 'python.mk' also followed a similar structure. But
due to the point above, we can now guarantee that GNU Make is used from
the very first Makefile, so this hard-to-read structure has been removed
in the software build recipes and they are much more readable and
edit-friendly now.
- Until now, the default backup servers where at some fixed URLs, on our
own pages or on Gitlab. But recently we uploaded all the necessary
software to Zenodo (https://doi.org/10.5281/zenodo.3883409) which is
more suitable for this task (it promises longevity, has a fixed DOI,
while allowing us to add new content, or new software tarball
versions). With this commit, a small script has been written to extract
the most recent Zenodo upload link from the Zenodo DOI and use it for
downloading the software source codes.
- Until now, we primarily used the webpage of each software for
downloading its tarball. But this caused many problems: 1) Some of them
needed Javascript before the download, 2) Some URLs had a complex
dependency on the version number, 3) some servers would be randomly down
for maintenance and etc. So thanks to the point above, we now use the
Zenodo server as the primary download location. However, if a user wants
to use a custom software that is not (yet!) in Zenodo, the download
script gives priority to a custom URL that the users can give as Make
variables. If that variable is defined, then the script will use that
URL before going onto Zenodo. We now have a special place for such URLs:
'reproduce/software/config/urls.conf'. The old URLs (which are a good
documentation themselves) are preserved here, but are commented by
default.
- The software source code downloading and checksum verification step has
been moved into a Make function called 'import-source' (defined in the
'build-rules.mk' and loaded in all software Makefiles). Having taken all
the low-level steps there, I noticed that there is no more need for
having the tarball as a separate target! So with this commit, a single
rule is the only place that needs to be edited/added (greatly
simplifying the software building Makefiles).
- Following task #15272, A new option has been added to the './project'
script called '--all-highlevel'. When this option is given, the contents
of 'TARGETS.conf' are ignored and all the software in Maneage are built
(selected by parsing the 'versions.conf' file). This new option was
added to confirm the extensive changes made in all the software building
recipes and is great for development/testing purposes.
- Many of the software hadn't been tested for a long time! So after using
the newly added '--all-highlevel', we noticed that some need to be
updated. In general, with this commit, 'libpaper' and 'pcre' were added
as new software, and the versions of the following software was updated:
'boost', 'flex', 'libtirpc', 'openblas' and 'lzip'. A 'run-parts.in'
shell script was added in 'reproduce/software/shell/' which is installed
with 'libpaper'.
- Even though we intentionally add the necessary flags to add RPATH inside
the built executable at compilation time, some software don't do it
(different software on different operating systems!). Until now, for
historical reasons this check was done in different ways for different
software on GNU/Linux sytems. But now it is unified: if 'patchelf' is
present we apply it. Because of this, 'patchelf' has been put as a
top-level prerequisite, right after Tar and is installed before anything
else.
- In 'versions.conf', GNU Libtool is recognized as 'libtool', but in
'basic.mk', it was 'glibtool'! This caused many confusions and is
corrected with this commit (in 'basic.mk', it is also 'libtool').
- A new argument is added to the './project' script to allow easy loading
of the project's shell and environment for fast/temporary testing of
things in the same environment as the project. Before activating the
project's shell, we completely remove all host environment variables to
simulate the project's environment. It can be called with this command:
'./project shell'. A simple prompt has also been added to highlight that
the user is using the Maneage shell!
Diffstat (limited to 'project')
-rwxr-xr-x | project | 85 |
1 files changed, 63 insertions, 22 deletions
@@ -41,6 +41,7 @@ make_targets= software_dir= clean_texdir=0 prepare_redo=0 +all_highlevel=0 existing_conf=0 scriptname="./project" minmapsize=10000000000 @@ -77,6 +78,7 @@ operation is defined by the (mandatory) second argument: configure - Configure project for this machine (e.g., build software). make - Run the project (do analysis and build outputs). + shell - Execute the project's shell for interactive testing. RECOMMENDATION: If this is the first time you are configuring this template, please don't use the options and let the script explain each @@ -108,6 +110,7 @@ Configure options: --clean-texdir Remove possibly existing build-time subdirectories under the project's 'tex/' directory (can happen when source is from arXiv for example). + --all-highlevel Build all high-level software (for development). Configure and Make options: -g, --group=STR Build and run with write permissions for a group. @@ -159,6 +162,7 @@ do # Main operation. configure) func_operation_set $1; shift;; make) func_operation_set $1; shift;; + shell) func_operation_set $1; shift;; # Configure options: @@ -182,6 +186,8 @@ do --check-config=*) on_off_option_error --check-config;; --clean-texdir) clean_texdir=1; shift;; --clean-texdir=*) on_off_option_error --clean-texdir;; + --all-highlevel) all_highlevel=1; shift;; + --all-highlevel=*) on_off_option_error --all-highlevel;; # Configure and Make options: -g|--group) group="$2"; check_v group "$group"; shift;shift;; @@ -274,6 +280,35 @@ fi +# Error when configuration isn't run +configuration_necessary() { + cat <<EOF + +The project is either (1) not configured on this system, or (2) the +configuration wasn't successful. + +(1) If it hasn't been configured at all, use the command below to configure +it (set a build directory and let it build its necessary software in it). + + $ ./project configure + +(2) If it has been configured, but the configuration failed in a step, you +can re-configure it using your previous settings with the command +below. All successful steps will be skipped, allowing a fast completion. + + $ ./project configure -e + +If there was a problem, please let us know by filling this online form: + http://savannah.nongnu.org/support/?func=additem&group=reproduce + +EOF + exit 1 +} + + + + + # Run operations in controlled environment # ---------------------------------------- controlled_env() { @@ -347,6 +382,7 @@ case $operation in export minmapsize=$minmapsize export software_dir=$software_dir export existing_conf=$existing_conf + export all_highlevel=$all_highlevel export reproducible_paper_group_name=$group # Run the configuration script @@ -372,33 +408,13 @@ case $operation in - # Run the project. + # Batch execution of the project. make) # Make sure the configure script has been completed properly # (`configuration-done.txt' exists). if ! [ -f .build/software/configuration-done.txt ]; then - cat <<EOF - -The project is either (1) not configured on this system, or (2) the -configuration wasn't successful. - -(1) If it hasn't been configured at all, use the command below to configure -it (set a build directory and let it build its necessary software in it). - - $ ./project configure - -(2) If it has been configured, but the configuration failed in a step, you -can re-configure it using your previous settings with the command -below. All successful steps will be skipped, allowing a fast completion. - - $ ./project configure -e - -If there was a problem, please let us know by filling this online form: - http://savannah.nongnu.org/support/?func=additem&group=reproduce - -EOF - exit 1 + configuration_necessary fi # Run data preparation phase (optionally build Makefiles with @@ -417,7 +433,32 @@ EOF ;; + shell) + # Make sure the configure script has been completed properly + # (`configuration-done.txt' exists). + if ! [ -f .build/software/configuration-done.txt ]; then + configuration_necessary + fi + + # Run the project's own shell without inheriting any environment + # from the host. + bdir=`.local/bin/realpath .build` + instdir=$bdir/software/installed + .local/bin/env -i \ + HOME=$bdir \ + CCACHE_DISABLE=1 \ + PATH=$instdir/bin \ + LDFLAGS=-L$instdir/lib \ + SHELL=$instdir/bin/bash \ + CPPFLAGS=-I$instdir/include \ + LD_LIBRARY_PATH=$instdir/lib \ + OMPI_MCA_plm_rsh_agent=/bin/false \ + PYTHONPATH=$instdir/lib/python/site-packages \ + PYTHONPATH3=$instdir/lib/python/site-packages \ + PS1="[\[\033[32m\](maneage)\[\033[00m\] \u@\h \W]$ " \ + $instdir/bin/bash + ;; # Operation not specified. |