auto if_exists_action | auto if_exists_action | ||||
= force.Get() ? dds::if_exists::replace : dds::if_exists::throw_exc; | = force.Get() ? dds::if_exists::replace : dds::if_exists::throw_exc; | ||||
for (std::string_view tgz_where : sdist_paths.Get()) { | for (std::string_view tgz_where : sdist_paths.Get()) { | ||||
neo_assertion_breadcrumbs("Importing sdist", tgz_where); | |||||
auto tmp_sd | auto tmp_sd | ||||
= (tgz_where.starts_with("http://") || tgz_where.starts_with("https://")) | = (tgz_where.starts_with("http://") || tgz_where.starts_with("https://")) | ||||
? dds::download_expand_sdist_targz(tgz_where) | ? dds::download_expand_sdist_targz(tgz_where) | ||||
: dds::expand_sdist_targz(tgz_where); | : dds::expand_sdist_targz(tgz_where); | ||||
neo_assertion_breadcrumbs("Importing from temporary directory", | |||||
tmp_sd.tmpdir.path()); | |||||
repo.add_sdist(tmp_sd.sdist, if_exists_action); | repo.add_sdist(tmp_sd.sdist, if_exists_action); | ||||
} | } | ||||
if (import_stdin) { | if (import_stdin) { |
} | } | ||||
void repository::add_sdist(const sdist& sd, if_exists ife_action) { | void repository::add_sdist(const sdist& sd, if_exists ife_action) { | ||||
neo_assertion_breadcrumbs("Importing sdist archive", sd.manifest.pkg_id.to_string()); | |||||
if (!_write_enabled) { | if (!_write_enabled) { | ||||
dds_log( | dds_log( | ||||
critical, | critical, | ||||
| ranges::views::transform([](const sdist& sd) { return sd.manifest.pkg_id; }); | | ranges::views::transform([](const sdist& sd) { return sd.manifest.pkg_id; }); | ||||
auto avail = ctlg.by_name(name); | auto avail = ctlg.by_name(name); | ||||
auto all = ranges::views::concat(mine, avail) | ranges::to_vector; | auto all = ranges::views::concat(mine, avail) | ranges::to_vector; | ||||
ranges::sort(all, std::less<>{}); | |||||
ranges::unique(all, std::less<>{}); | |||||
ranges::sort(all, std::less{}); | |||||
ranges::unique(all, std::less{}); | |||||
return all; | return all; | ||||
}, | }, | ||||
[&](const package_id& pkg_id) { | [&](const package_id& pkg_id) { |
} | } | ||||
temporary_sdist dds::expand_sdist_targz(path_ref targz_path) { | temporary_sdist dds::expand_sdist_targz(path_ref targz_path) { | ||||
neo_assertion_breadcrumbs("Expanding sdist targz file", targz_path.string()); | |||||
auto infile = open(targz_path, std::ios::binary | std::ios::in); | auto infile = open(targz_path, std::ios::binary | std::ios::in); | ||||
return expand_sdist_from_istream(infile, targz_path.string()); | return expand_sdist_from_istream(infile, targz_path.string()); | ||||
} | } |