rename mamba-archive mamba-package

rename umamba subcom archive, package
turn on parallel extraction of mamba in CI by building mamba-package target
This commit is contained in:
Adrien DELSALLE 2021-10-29 17:32:43 +02:00
parent 435dbf03de
commit 2f349dca96
No known key found for this signature in database
GPG Key ID: 639D9226C33B92BB
12 changed files with 82 additions and 80 deletions

View File

@ -213,6 +213,7 @@ jobs:
-DBUILD_LIBMAMBAPY=ON \
-DBUILD_LIBMAMBA=ON \
-DBUILD_SHARED=ON \
-DBUILD_MAMBA_PACKAGE=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
..
@ -353,6 +354,7 @@ jobs:
-DBUILD_LIBMAMBAPY=ON ^
-DBUILD_LIBMAMBA=ON ^
-DBUILD_SHARED=ON ^
-DBUILD_MAMBA_PACKAGE=ON ^
-GNinja ^
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
-DCMAKE_C_COMPILER_LAUNCHER=ccache

View File

@ -22,7 +22,7 @@ option(BUILD_LIBMAMBA "Build libmamba library" OFF)
option(BUILD_LIBMAMBAPY "Build libmamba Python bindings" OFF)
option(BUILD_LIBMAMBA_TESTS "Build libmamba C++ tests" OFF)
option(BUILD_MICROMAMBA "Build micromamba" OFF)
option(BUILD_MAMBA_ARCHIVE "Build mamba package archive utility" OFF)
option(BUILD_MAMBA_PACKAGE "Build mamba package utility" OFF)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNOMINMAX")
@ -54,7 +54,7 @@ if (BUILD_MICROMAMBA)
add_subdirectory(micromamba)
endif()
# mamba package tarball extraction utility
if (BUILD_MAMBA_ARCHIVE)
add_subdirectory(mamba_archive)
# mamba package tarball utility
if (BUILD_MAMBA_PACKAGE)
add_subdirectory(mamba_package)
endif()

View File

@ -440,11 +440,11 @@ namespace mamba
std::vector<std::string> args;
if (Context::instance().is_micromamba)
{
args = { get_self_exe_path(), "archive", "extract", file, dest };
args = { get_self_exe_path(), "package", "extract", file, dest };
}
else
{
args = { "mamba-archive", "extract", file, dest };
args = { "mamba-package", "extract", file, dest };
}
std::string out, err;

View File

@ -1,61 +0,0 @@
# Copyright (c) 2019, QuantStack and Mamba Contributors
#
# Distributed under the terms of the BSD 3-Clause License.
#
# The full license is in the file LICENSE, distributed with this software.
cmake_minimum_required (VERSION 3.2)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
cmake_policy(SET CMP0077 NEW)
project(mamba-archive)
# Build options
# =============
set(MAMBA_ARCHIVE_LINKAGE "DYNAMIC" CACHE STRING "mamba-archive linkage against libraries")
string(TOUPPER "${MAMBA_ARCHIVE_LINKAGE}" linkage_upper)
if (NOT ${linkage_upper} MATCHES "^(DYNAMIC|STATIC|FULL_STATIC)$")
message(FATAL_ERROR "Invalid executable linkage: ${MAMBA_ARCHIVE_LINKAGE}, should be one of { DYNAMIC, STATIC, FULL_STATIC }")
endif ()
message(STATUS "'mamba-archive' linkage: ${MAMBA_ARCHIVE_LINKAGE}")
# Source files
# ============
set(MAMBA_ARCHIVE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/archive.cpp
)
set(MAMBA_ARCHIVE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/archive.hpp
)
# Dependencies
# ============
if(NOT (TARGET libmamba OR TARGET libmamba-static OR TARGET libmamba-full-static))
find_package(libmamba REQUIRED)
endif ()
# Build definition
# ================
add_executable(mamba-archive ${MAMBA_ARCHIVE_SRCS} ${MAMBA_ARCHIVE_HEADERS})
if (${MAMBA_ARCHIVE_LINKAGE} STREQUAL "FULL_STATIC")
target_link_libraries(mamba-archive PRIVATE libmamba-full-static)
elseif (${MAMBA_ARCHIVE_LINKAGE} STREQUAL "STATIC")
target_link_libraries(mamba-archive PRIVATE libmamba-static)
else ()
target_link_libraries(mamba-archive PRIVATE libmamba)
endif ()
set_property(TARGET mamba-archive PROPERTY CXX_STANDARD 17)
install(TARGETS mamba-archive)

View File

@ -0,0 +1,61 @@
# Copyright (c) 2019, QuantStack and Mamba Contributors
#
# Distributed under the terms of the BSD 3-Clause License.
#
# The full license is in the file LICENSE, distributed with this software.
cmake_minimum_required (VERSION 3.2)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
cmake_policy(SET CMP0077 NEW)
project(mamba-package)
# Build options
# =============
set(MAMBA_PACKAGE_LINKAGE "DYNAMIC" CACHE STRING "mamba-package linkage against libraries")
string(TOUPPER "${MAMBA_PACKAGE_LINKAGE}" linkage_upper)
if (NOT ${linkage_upper} MATCHES "^(DYNAMIC|STATIC|FULL_STATIC)$")
message(FATAL_ERROR "Invalid executable linkage: ${MAMBA_PACKAGE_LINKAGE}, should be one of { DYNAMIC, STATIC, FULL_STATIC }")
endif ()
message(STATUS "'mamba-package' linkage: ${MAMBA_PACKAGE_LINKAGE}")
# Source files
# ============
set(MAMBA_PACKAGE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/package.cpp
)
set(MAMBA_PACKAGE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/package.hpp
)
# Dependencies
# ============
if(NOT (TARGET libmamba OR TARGET libmamba-static OR TARGET libmamba-full-static))
find_package(libmamba REQUIRED)
endif ()
# Build definition
# ================
add_executable(mamba-package ${MAMBA_PACKAGE_SRCS} ${MAMBA_PACKAGE_HEADERS})
if (${MAMBA_PACKAGE_LINKAGE} STREQUAL "FULL_STATIC")
target_link_libraries(mamba-package PRIVATE libmamba-full-static)
elseif (${MAMBA_PACKAGE_LINKAGE} STREQUAL "STATIC")
target_link_libraries(mamba-package PRIVATE libmamba-static)
else ()
target_link_libraries(mamba-package PRIVATE libmamba)
endif ()
set_property(TARGET mamba-package PROPERTY CXX_STANDARD 17)
install(TARGETS mamba-package)

View File

@ -4,7 +4,7 @@
//
// The full license is in the file LICENSE, distributed with this software.
#include "archive.hpp"
#include "package.hpp"
#include "mamba/version.hpp"
@ -23,7 +23,7 @@ main(int argc, char** argv)
using namespace mamba; // NOLINT(build/namespaces)
CLI::App app{ "Version: " + version() + "\n" };
set_archive_command(&app);
set_package_command(&app);
try
{

View File

@ -4,7 +4,7 @@
//
// The full license is in the file LICENSE, distributed with this software.
#include "archive.hpp"
#include "package.hpp"
#include "mamba/core/util.hpp"
#include "mamba/core/package_handling.hpp"
@ -12,7 +12,7 @@
using namespace mamba; // NOLINT(build/namespaces)
void
set_archive_command(CLI::App* com)
set_package_command(CLI::App* com)
{
static std::string infile, dest;
static int compression_level = -1;

View File

@ -4,12 +4,12 @@
//
// The full license is in the file LICENSE, distributed with this software.
#ifndef MAMBA_ARCHIVE_ARCHIVE_HPP
#define MAMBA_ARCHIVE_ARCHIVE_HPP
#ifndef MAMBA_PACKAGE_PACKAGE_HPP
#define MAMBA_PACKAGE_PACKAGE_HPP
#include <CLI/CLI.hpp>
void
set_archive_command(CLI::App* com);
set_package_command(CLI::App* com);
#endif

View File

@ -21,7 +21,6 @@ set(MICROMAMBA_LINKAGE "DYNAMIC" CACHE STRING "micromamba linkage against librar
# ============
set(MICROMAMBA_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/src/archive.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/clean.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/config.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/completer.cpp
@ -33,6 +32,7 @@ set(MICROMAMBA_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/src/list.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common_options.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/package.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/remove.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/shell.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/umamba.cpp

View File

@ -12,7 +12,7 @@
using namespace mamba; // NOLINT(build/namespaces)
void
set_archive_command(CLI::App* subcom)
set_package_command(CLI::App* subcom)
{
static std::string infile, dest;
static int compression_level = -1;

View File

@ -56,9 +56,9 @@ set_umamba_command(CLI::App* com)
CLI::App* list_subcom = com->add_subcommand("list", "List packages in active environment");
set_list_command(list_subcom);
CLI::App* archive_subcom
= com->add_subcommand("archive", "Extract a package or bundle files into an archive");
set_archive_command(archive_subcom);
CLI::App* package_subcom
= com->add_subcommand("package", "Extract a package or bundle files into an archive");
set_package_command(package_subcom);
CLI::App* clean_subcom = com->add_subcommand("clean", "Clean package cache");
set_clean_command(clean_subcom);

View File

@ -47,7 +47,7 @@ void
set_shell_command(CLI::App* subcom);
void
set_archive_command(CLI::App* subcom);
set_package_command(CLI::App* subcom);
void
set_umamba_command(CLI::App* com);