gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-devel] [task #14300] gnuastro.conf for common option, better .


From: Mohammad Akhlaghi
Subject: [gnuastro-devel] [task #14300] gnuastro.conf for common option, better .conf file/option management
Date: Wed, 4 Jan 2017 15:19:04 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

URL:
  <http://savannah.gnu.org/task/?14300>

                 Summary: gnuastro.conf for common option, better .conf
file/option management
                 Project: GNU Astronomy Utilities
            Submitted by: makhlaghi
            Submitted on: Thu 05 Jan 2017 12:19:03 AM JST
         Should Start On: Wed 04 Jan 2017 12:00:00 AM JST
   Should be Finished on: Wed 04 Jan 2017 12:00:00 AM JST
                Category: All Gnuastro
                Priority: 5 - Normal
              Item Group: Enhancement
                  Status: Postponed
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                  Effort: 0.00

    _______________________________________________________

Details:

With the expansion of Gnuastro and its libraries (which will centralize many
operations), the number of common options
<https://www.gnu.org/software/gnuastro/manual/html_node/Common-options.html>
will increase. So it would be much more easier for the gnuastro users to set
the values of common options only once for all of Gnuastro's programs (when
they want to). 

One example maybe that you want your work to be reproducible, and so all the
programs must run with the same version fo Gnuastro, and you want them to only
use the current directory configuration file. To do this, you have to manually
add the two `onlydirconf' and `onlyversion' to the configuration files of all
the Gnuastro programs that you use. 

This can be buggy and cause errors, for example, during your research (before
you publish/release the reproduction pipeline), a new version of Gnuastro
comes and you want to use it instead, this step of checking/changing all those
configuration files can be hard and a cause of avoiding this update. 

There are many other examples like log files, or (later) printing/file formats
for programs that output tables.

So here, I am suggesting to add a `gnuastro.conf' configuration file which
will only be used in reading common options to all the programs. Its
precedence
<https://www.gnu.org/software/gnuastro/manual/html_node/Configuration-file-precedence.html#Configuration-file-precedence>
would be lower than the configuration file for that utility in the same
directory.

It would also be great if as part of this transition we could also re-write
the way each program's configuration files are read, and values are checked.
Currently each program does this in its own `ui.c' file and uses macros a lot.
There might be better/cleaner ways to do all this in the library so the
programs just have to call the appropriate function.

This might be possible with the new root data structure (task #14245), in a
similar way to how we read table columns (see `gal_table_read' in the new
lib/table.c
<https://gitlab.com/makhlaghi/gnuastro/blob/datastruct/lib/table.c>). In
short, each program makes a linked list of `gal_data_t' with the `name' field
set to the long option name (short options are only for the command-line).
This linked list is passed to the library function along with the program's
name (to determine the name of the configuration file). 

The library function will then start looking for the directory, user-wide and
system-wide configuration files and fill in the option values as they are read
from the lines. Every option that is read will be popped from the input linked
list (and added to the output linked list) so any future occurance of that
option (in lower precedence configuration file) is never checked (since it is
no longer in the list that is searched).

This will also remove the need for the `*set' variables in the `uiparams'
structure of each program's `main.h' file. Because the options that have been
set on the command-line will not be in the linked list that is passed onto the
library function for reading configuration files. This can be a good way
forward to greatly simplifying the process of option management in Gnuastro's
programs and simplifying the life of developers/users :-).




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/task/?14300>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]