Exemple #1
0
void repository::extractor::extract_build(
    const entry &package, const boost::filesystem::path &destination) {
  try {
    const tempfile tmp = local_system_().tempdir_for_build();
    cache_().unpack_build(package, tmp.path());
    merge_directories(tmp.path(), destination);
  } catch (std::exception &) {
    BOOST_THROW_EXCEPTION(extractor_extract_build_error()
                          << extractor_extract_build_error::package(package)
                          << extractor_extract_build_error::destination(
                                 destination) << enable_nested_current());
  }
}
Exemple #2
0
Pathname * merge_pathnames(Pathname * pathname, Pathname * default_pathname,
                           Value default_version)
{
    Value host;
    if (pathname->host() != NIL)
        host = pathname->host();
    else
        host = default_pathname->host();
    Value device;
    if (pathname->device() != NIL)
        device = pathname->device();
    else
        device = default_pathname->device();
    Value directory =
        merge_directories(pathname->directory(), default_pathname->directory());
    Value name;
    if (pathname->name() != NIL)
        name = pathname->name();
    else
        name = default_pathname->name();
    Value type;
    if (pathname->type() != NIL)
        type = pathname->type();
    else
        type = default_pathname->type();
    Value version;
    if (pathname->version() != NIL)
        version = pathname->version();
    else if (stringp(pathname->name()))
        version = default_version;
    else if (default_pathname->version() != NIL)
        version = default_pathname->version();
    else
        version = default_version;
    if (logical_pathname_p(pathname))
        return new LogicalPathname(host, device, directory, name, type, version);
    else
        return new Pathname(host, device, directory, name, type, version);
}