In C++ namespace-scope static object are created and destructed in an
unspecified order before and after `main()` execution, respectively.
The only guarantee is that such objects in the same translation unit
shall be constructed in apparition order in the file and destructed in
the reverse order. Another guarantee is that local (inside functoins)
static object are guaranteed to be created only at the first call to
that function, but then there is no guarantee on the destruction order.
This is fine until these objects interacts, that is, at least one of
these objects have a dependency/usage of another object defined in a
different translation unit.
We currently have singletons which are implemented as global statics
spread through various translation units, and several of these
singletons are also accessed through construction and destruction of
other singletons. Basically, we have undefined behavior around their
creation and destruction, so it is not always visible because often
memory looks like valid objects even if it is not. Some recent fixes
made this even more visible (which is helpful).
This change moves all the singleton object definitions into the same
translation unit to begin improving guarantees on their construction
and destruction order after `main()` execution.
Scopes lifetime of any thread used by libmamba to `main()`'s scope.
This fixes undefined behavior when threads are running after `main()`
is finished. At the end of `main()`, static objects are destroyed in
an unspecified order which can also lead easilly to undefined behaviors.
This change should fix both issues.
For now the implementation of `MainExecutor` is simple: it spawn a
new thread for each task scheduled and does not provide means to track
the progress and/or end of tasks. This reflects the previous behavior.
The intent is to enabled changing the implementation of `MainExecutor`
in the future to improve execution speed and/or execution resources
usage.
* Fixed: `--json` throwing exceptions in some situations (lockfiles)
* Refactored Console pimpl handling
* Automatic json printing instead of explicit.
* added a way to cancel the print of json log from libmamba, used in mamba which already output the right json;
From now on the json output will be automatically printed at the end of the program
(after `main()` call) instead of explicitly invoked.
* refactor progress bars
* use fmt to better format progress bars fields
* add a Chrono class to handle time and status/state
* add a ProgressBarRepr class to handle representation of the bars
* add capability to remove progress bars from a manager
* add capability to set width when computing bars repr and printing
* handle no_progress_bars context value in all situations
* also ensure quiet, not a tty, and json modes are handled
* add and update tests
* make it optional to display sub-bars in aggregated mode
* display a carrousel of downloading or extracting packages is the aggregated bar
* make sure extracting packages from cache are printed by the progress bars manager
* remove postfix when printing the completed download status
* protect chrono state against modifications when sorting bars
* fix to_human_readable_filesize free function
* only wait for watch_print thread to exit if started
* store speed, also compute average speed from member or Chrono elapsed time
* use the average speed on download aggregated bar if cURL info is missing
* allows to get average speed on total elapsed time
* improved color scheme of progress bars
* collect and show the in-progress status using cyan
* init the progress randomly when activating spinner
* control sorting of multi downloads using an option
* use C-style options also for fastfail
* make sure pbar manager is init on multi bars when dl channels
* refactor on api changes
use MAMBA_EXTRACT_THREADS env var in mamba
set max extract threads before transaction
make sure the context value is used by setting context value in fetch_extract_packages
add error handling in mamba in case env var can't be converted to integer
split verbosity and log level
use backtrace to replay logs on critical error
use backtrace to replay logs emitted before setting the log level, with the appropriate level
make libmamba compile time log level a cmake option
break circular dependencies
remove hard-coded config loading sequence
create a libmamba-full-static target to expose static deps
remove automagic activation of libmamba build options to fix packaging
add find_package libmamba in micromamba and libmambapy
add umamba MICROMAMBA_LINKAGE option to select libmamba target
update documentation
* make a clear split between CMake targets
* split versions between libmamba and mamba
* add libmambapy target for python bindings and make mamba depend on it
* rename CMake options to make them homogeneous, simplify CMake
* remove termcolor from thirdparties, use it as a dependency
* remove unnecessary version global vars and convert to functions
* update CI workflows