diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2020-01-19 22:42:24 +0000 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2020-01-19 22:58:48 +0000 |
commit | 8cfc728ecfb81775fd7bcfde887d1fccc4e4e8ad (patch) | |
tree | db351e3575085ab10933401bf8c3c679d9d38815 | |
parent | 0ccea404bf994525a6f42ccea8ed7e325660627a (diff) |
New --check-config option to ./project to check software build status
Until now, it was necessry to run a long `while true' loop to see what is
currently being built at configure time. So with this commit, a new
`--checkconfig' option has been added to `./project' that can be called to
run that loop and make it easier to check.
-rw-r--r-- | README-hacking.md | 45 | ||||
-rwxr-xr-x | project | 42 |
2 files changed, 56 insertions, 31 deletions
diff --git a/README-hacking.md b/README-hacking.md index 241f2dc..91846ea 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -556,20 +556,22 @@ First custom commit - **Prepare to build project**: The `./project configure` command of the next step will build the different software packages within the - "build" directory (that you will specify), nothing else on your system - will be touched. But since it takes long, it is useful to see what it - is building at every instant (its almost impossible to tell from the - torrent of commands that are produced!). So open another terminal on - your desktop and navigate to the same project directory that you - cloned (output of last command above). Then run the following - command. It will just print the date, once every second. But as soon - as the next step starts building software, you'll see the names of - software come while they are being built, and go once they are - installed in the project build directory (again: don't worry, nothing - will be installed outside the build directory). + "build" directory (that you will specify). Nothing else on your system + will be touched. However, since it takes long, it is useful to see + what it is being built at every instant (its almost impossible to tell + from the torrent of commands that are produced!). So open another + terminal on your desktop and navigate to the same project directory + that you cloned (output of last command above). Then run the following + command. Once every second, this command will just print the date + (possibly followed by a non-existant directory notice). But as soon as + the next step starts building software, you'll see the names of + software get printed as they are being built. Once any software is + installed in the project build directory it will be removed. Again, + don't worry, nothing will be installed outside the build directory. ```shell - $ while true; do echo; date; ls .build/software/build-tmp; sleep 1; done + # On another terminal (go to top project directory) + $ project --check-config ``` - **Test the template**: Before making any changes, it is important to @@ -1236,25 +1238,6 @@ for the benefit of others. $ git clone my-project-git.bundle ``` - - **Inspecting software building status**: When you run `./project - configure`, several programs and libraries start to get configured and - build (in many cases, simultaneously). To understand the building - process, or for debugging a strange situation, it is sometimes useful - to know which programs are being built at every moment. To do this, - you can look into the `.build/software/build-tmp` directory (from the - top project directory). This temporary directory is only present while - building the software. At every moment, it contains the unpacked - source tarball directories of the all the packages that are being - built. After a software is successfully installed in your project, it - is removed from this directory. To automatically get a listing of this - directory every second, you can run the command below (on another - terminal while the software are being built). Press `CTRL-C` to stop - it and return back to the command-line). - - ```shell - $ while true; do echo; date; ls .build/software/build-tmp; sleep 1; done - ``` - @@ -33,6 +33,7 @@ host_cc=0 operation= build_dir= input_dir= +check_config= make_targets= software_dir= clean_texdir=0 @@ -97,6 +98,7 @@ Configure options: -i, --input-dir=STR Directory containing input datasets (optional). -m, --minmapsize=INT [Gnuastro] Minimum number of bytes to use RAM. -s, --software-dir=STR Directory containing necessary software tarballs. + --check-config During configuration, show what is being built. --clean-texdir Remove possibly existing build-time subdirectories under the project's 'tex/' directory (can happen when source is from arXiv for example). @@ -170,6 +172,8 @@ do -s|--software-dir) software_dir="$2"; check_v "$1" "$software_dir"; shift;shift;; -s=*|--software-dir=*) software_dir="${1#*=}"; check_v "$1" "$software_dir"; shift;; -s*) software_dir=$(echo "$1" | sed -e's/-s//'); check_v "$1" "$software_dir"; shift;; + --check-config) check_config=1; shift;; + --check-config=*) on_off_option_error --check-config;; --clean-texdir) clean_texdir=1; shift;; --clean-texdir=*) on_off_option_error --clean-texdir;; @@ -202,6 +206,44 @@ done +# Check configuration status +# -------------------------- +if ! [ x$check_config = x ]; then + # Find the color option to pass to `ls'. Note that `--color' (for GNU + # Coreutils `ls') should be checked first because it also has `-G', but + # for something else. + if ls --color &> /dev/null; then coloropt="--color=auto" + elif ls -G &> /dev/null; then coloropt="-G" + else coloropt="" + fi + + # Print a notice to let the user know what is happening. + cat <<EOF + +This is an infinite loop that will print what software are being built at +every moment. It is actually a listing ('ls' command) of the temporary +directory where software source code are unpacked while they are being +built. If the project isn't being configured, the output (every second) +will either be empty (only a date) or a with an error about a non-existant +directory. This feature is thus only useful when the project's software are +being built. + +EOF + + # Run the infinite loop. + while true; do + echo; + echo "$(date) [[press CTRL-C to stop]]"; + ls $coloropt .build/software/build-tmp || junk=1; + sleep 1; + done + exit 0 +fi + + + + + # Basic group settings # -------------------- if ! [ x$group = x ]; then |